diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-01-17 00:32:33 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-01-17 00:32:33 (GMT) |
commit | 44739ccd4715cc9e15595575700e945341fcdbcc (patch) | |
tree | 732a9381da5d3f0246a8d931da0074e2c5756704 /test | |
parent | 46c3bc6b98bc467d46ca22cfc1b912c741a9d886 (diff) | |
parent | 55670c88cfa07a4fd5a884502f8bd32768f70256 (diff) | |
download | hdf5-44739ccd4715cc9e15595575700e945341fcdbcc.zip hdf5-44739ccd4715cc9e15595575700e945341fcdbcc.tar.gz hdf5-44739ccd4715cc9e15595575700e945341fcdbcc.tar.bz2 |
Merge branch 'develop' into stack_size_warnings
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | test/CMakeVFDTests.cmake | 2 | ||||
-rw-r--r-- | test/cache_tagging.c | 73 | ||||
-rw-r--r-- | test/chunk_info.c | 2 | ||||
-rw-r--r-- | test/cork.c | 174 | ||||
-rw-r--r-- | test/direct_chunk.c | 12 | ||||
-rw-r--r-- | test/dsets.c | 50 | ||||
-rw-r--r-- | test/dtypes.c | 14 | ||||
-rw-r--r-- | test/fillval.c | 4 | ||||
-rw-r--r-- | test/flushrefresh.c | 65 | ||||
-rw-r--r-- | test/genall5.c | 72 | ||||
-rw-r--r-- | test/getname.c | 10 | ||||
-rw-r--r-- | test/h5test.c | 4 | ||||
-rw-r--r-- | test/links.c | 4998 | ||||
-rw-r--r-- | test/mount.c | 119 | ||||
-rw-r--r-- | test/mtime.c | 16 | ||||
-rw-r--r-- | test/null_vol_connector.c | 5 | ||||
-rw-r--r-- | test/objcopy.c | 1052 | ||||
-rw-r--r-- | test/objcopy_ref.c | 116 | ||||
-rw-r--r-- | test/ohdr.c | 25 | ||||
-rw-r--r-- | test/stab.c | 24 | ||||
-rw-r--r-- | test/tattr.c | 177 | ||||
-rw-r--r-- | test/tfile.c | 52 | ||||
-rw-r--r-- | test/th5o.c | 475 | ||||
-rw-r--r-- | test/titerate.c | 168 | ||||
-rw-r--r-- | test/tmisc.c | 140 | ||||
-rw-r--r-- | test/trefer.c | 14 | ||||
-rw-r--r-- | test/trefer_deprec.c | 14 | ||||
-rw-r--r-- | test/trefer_shutdown.c | 83 | ||||
-rw-r--r-- | test/tsohm.c | 24 | ||||
-rw-r--r-- | test/tvlstr.c | 5 | ||||
-rw-r--r-- | test/unlink.c | 29 | ||||
-rw-r--r-- | test/vds.c | 18 | ||||
-rw-r--r-- | test/vol.c | 13 | ||||
-rw-r--r-- | test/vol_plugin.c | 2 |
35 files changed, 6520 insertions, 1535 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c7a945e..77f9191 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -525,4 +525,6 @@ else () endif () set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) -include (CMakeTests.cmake) +if (HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index cf938f5..d4a5ddc 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -15,7 +15,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## -# included from CMakeTEsts.cmake +# included from CMakeTests.cmake set (VFD_LIST sec2 diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 7ce4e88..564e5bc 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -24,6 +24,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5HLprivate.h" +#include "H5VLnative_private.h" /* Native VOL connector */ /* ============ */ /* Test Defines */ @@ -374,14 +375,15 @@ error: static int get_object_header_tag(hid_t loc_id, haddr_t *tag) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Retrieve the info for the object */ - if(H5Oget_info2(loc_id, &oinfo, H5O_INFO_ALL) < 0) + if(H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR; /* Set the tag to return */ - *tag = oinfo.addr; + if(H5VLnative_token_to_addr(loc_id, oinfo.token, tag) < 0) + TEST_ERROR; return 0; @@ -439,7 +441,9 @@ check_file_creation_tags(hid_t fcpl_id, int type) { /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose test outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; @@ -526,7 +530,9 @@ check_file_open_tags(hid_t fcpl, int type) { /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag; /* Root Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ @@ -639,7 +645,9 @@ check_group_creation_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ haddr_t g_tag; /* Group Tag */ @@ -740,7 +748,9 @@ check_multi_group_creation_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ char gname[16]; /* group name buffer */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access prop list */ @@ -869,7 +879,9 @@ check_link_iteration_tags(void) hid_t fid = -1; /* File Identifier */ hid_t sid = -1; /* Group Identifier */ hid_t did = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int i = 0; /* iterator */ haddr_t root_tag = 0; /* Root Group Tag Value */ char dsetname[500]; /* Name of dataset */ @@ -989,7 +1001,9 @@ check_dense_attribute_tags(void) hid_t sid = -1; /* Group Identifier */ hid_t did = -1; /* Group Identifier */ hid_t dcpl = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access property list */ haddr_t d_tag = 0; /* Dataset tag value */ @@ -1171,7 +1185,9 @@ check_group_open_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file output */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -1280,7 +1296,9 @@ check_attribute_creation_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Root group tag */ haddr_t g_tag = 0; @@ -1414,7 +1432,9 @@ check_attribute_open_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; @@ -1551,7 +1571,9 @@ check_attribute_rename_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -1726,7 +1748,9 @@ check_attribute_delete_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -1892,7 +1916,9 @@ check_dataset_creation_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2025,7 +2051,9 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2162,7 +2190,9 @@ check_dataset_open_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2288,7 +2318,9 @@ check_dataset_write_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2430,7 +2462,9 @@ check_attribute_write_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -2583,7 +2617,9 @@ check_dataset_read_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2720,7 +2756,9 @@ check_dataset_size_retrieval(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2859,7 +2897,9 @@ check_dataset_extend_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2996,11 +3036,13 @@ check_object_info_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file output */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; - H5O_info_t oinfo; /* Object info struct */ + H5O_native_info_t ninfo; /* Native object info struct */ /* Testing Macro */ TESTING("tag application during object info retrieval"); @@ -3040,7 +3082,10 @@ check_object_info_tags(void) /* Get information on an object by name */ /* ===================================== */ - if ( H5Oget_info_by_name2(fid, GROUPNAME, &oinfo, H5O_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR; + /* Even though we do nothing with this, touching the internal + * data structures is needed for the test to pass. + */ + if ( H5Oget_native_info_by_name(fid, GROUPNAME, &ninfo, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -3105,7 +3150,9 @@ check_object_copy_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file output */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -3226,7 +3273,9 @@ check_link_removal_tags(hid_t fcpl, int type) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ hid_t gid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -3385,7 +3434,9 @@ check_link_getname_tags(void) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ hid_t gid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -3534,7 +3585,9 @@ check_external_link_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t fid2 = -1; /* File Identifier */ hid_t gid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; @@ -3640,7 +3693,10 @@ check_external_link_open_tags(void) hid_t fid2 = -1; /* File Identifier */ hid_t gid = -1; /* Dataspace Identifier */ hid_t xid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ + H5O_native_info_t ninfo; /* Native object info struct */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t root2_tag = 0; @@ -3694,6 +3750,11 @@ check_external_link_open_tags(void) if ( (fid2 = H5Iget_file_id(xid)) < 0) TEST_ERROR; if ( get_object_header_tag(xid, &link_tag) < 0 ) TEST_ERROR; + /* Even though we do nothing with this, touching the internal + * data structures is needed for the test to pass. + */ + if ( H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0 ) TEST_ERROR; + /* =================================== */ /* Verification of Metadata Tag Values */ /* =================================== */ @@ -3836,8 +3897,8 @@ check_invalid_tag_application(void) return 0; -error: #if H5C_DO_TAGGING_SANITY_CHECKS +error: if(api_ctx_pushed) H5CX_pop(); #endif /* H5C_DO_TAGGING_SANITY_CHECKS */ diff --git a/test/chunk_info.c b/test/chunk_info.c index 057991c..0afff66 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -119,7 +119,7 @@ const char *FILENAME[] = { #define INVALID_CHK_INDEX 5 /* For compressed data */ -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12.0) /* For use in error reporting */ #define MSG_CHK_ADDR "Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY." diff --git a/test/cork.c b/test/cork.c index 78b6b01..125c53e 100644 --- a/test/cork.c +++ b/test/cork.c @@ -102,7 +102,7 @@ verify_old_dset_cork(void) int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ int *buf_data = NULL; /* Data buffer (actual data) */ int i = 0, j = 0; /* Local index variables */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */ /* Testing Macro */ @@ -127,7 +127,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Get dataset object header address: DSET_BT1 */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT1 */ @@ -135,7 +135,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Set up data array */ @@ -156,7 +156,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_BT1 */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create compact dataset: DSET_COMPACT */ @@ -172,7 +172,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_COMPACT */ @@ -180,7 +180,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -220,7 +220,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address: DSET_CONTIG */ - if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_CONTIG */ @@ -228,11 +228,11 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Verify the cork status for DSET_BT1 */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Un-cork the dataset: DSET_CONTIG */ @@ -240,7 +240,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -307,7 +307,7 @@ verify_obj_dset_cork(hbool_t swmr) int i = 0; /* Local index variable */ hsize_t dim[1] = {100}; /* Dataset dimension size */ hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */ - H5O_info_t oinfo, oinfo2; /* Object metadata information */ + H5O_info2_t oinfo, oinfo2; /* Object metadata information */ char attrname[500]; /* Name of attribute */ unsigned flags; /* File access flags */ @@ -340,11 +340,11 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -356,7 +356,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Close the attribute */ @@ -364,7 +364,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create dcpl */ @@ -383,7 +383,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_NONE */ @@ -402,7 +402,7 @@ verify_obj_dset_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the dataset: DSET_NONE */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -431,7 +431,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR /* Open the attribute attached to the dataset object: DSET_NONE */ @@ -443,7 +443,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET_NONE */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Close the attribute */ @@ -451,7 +451,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -510,8 +510,8 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ int *buf_data = NULL; /* Data buffer (actual data) */ int i = 0, j = 0; /* Local index variables */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ - unsigned flags; /* File access flags */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + unsigned flags; /* File access flags */ /* Testing Macro */ if(swmr) { @@ -559,7 +559,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_EA */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_EA */ @@ -567,7 +567,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create chunked dataset with fixed array indexing: DSET_FA */ @@ -577,7 +577,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_FA */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_FA */ @@ -589,11 +589,11 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_FA */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify the cork status for DSET_EA */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Create chunked dataset with v2-Btree indexing */ @@ -604,7 +604,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_BT2 */ - if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -612,7 +612,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -663,7 +663,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_EA */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Open and write to the dataset: DSET_FA */ @@ -677,7 +677,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_FA */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Open and write to the dataset: DSET_BT2 */ @@ -687,7 +687,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -695,7 +695,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -757,11 +757,11 @@ verify_group_cork(hbool_t swmr) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ int i = 0; /* Local index variable */ /* Testing Macro */ @@ -798,19 +798,19 @@ verify_group_cork(hbool_t swmr) TEST_ERROR /* Get group object header addresses */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the groups */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Close the second group: GRP2 */ @@ -822,7 +822,7 @@ verify_group_cork(hbool_t swmr) FAIL_STACK_ERROR /* Verify cork status of the second group: GRP2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -863,7 +863,7 @@ verify_group_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(gid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -871,7 +871,7 @@ verify_group_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the third group: GRP3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -925,12 +925,12 @@ verify_named_cork(hbool_t swmr) hid_t fapl = -1; /* File access property list */ hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */ - hid_t aid = -1; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ - hid_t did; /* Dataset ID */ + H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */ + hid_t aid = -1; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + hid_t did; /* Dataset ID */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ int i = 0; /* Local index variable */ /* Testing Macro */ @@ -987,19 +987,19 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Get named datatype object header addresses */ - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Close the datatypes */ @@ -1019,11 +1019,11 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1079,7 +1079,7 @@ verify_named_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(tid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -1091,7 +1091,7 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo4, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo4, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -1099,20 +1099,20 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Un-cork the datatype: DT3 */ if(H5Oenable_mdc_flushes(tid3) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Cork the datatype: DT */ @@ -1120,14 +1120,14 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.token, TRUE) < 0) TEST_ERROR /* Close the dataset */ @@ -1135,11 +1135,11 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1206,10 +1206,10 @@ verify_multiple_cork(hbool_t swmr) hid_t aidd1 = -1, aidd2 = -1; /* Attribute ID */ hid_t aidt1 = -1, aidt2 = -1; /* Attribute ID */ hid_t sid = -1; /* Dataspace ID */ - H5O_info_t oinfo1, oinfo2, oinfo3; /* Object metadata information */ - hsize_t dim[1] = {5}; /* Dimension sizes */ - unsigned flags; /* File access flags */ - hbool_t corked; /* Cork status */ + H5O_info2_t oinfo1, oinfo2, oinfo3; /* Object metadata information */ + hsize_t dim[1] = {5}; /* Dimension sizes */ + unsigned flags; /* File access flags */ + hbool_t corked; /* Cork status */ herr_t ret; /* Return value */ /* Testing Macro */ @@ -1305,9 +1305,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid2 */ - if(H5Oget_info2(gid2, &oinfo1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid2, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo1.token, TRUE) < 0) TEST_ERROR /* Check cork status of the group: gid1 */ @@ -1333,9 +1333,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5Oget_info2(did1, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did1, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.token, TRUE) < 0) TEST_ERROR /* Check cork status of the dataset: did2 */ @@ -1361,9 +1361,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: tid2 */ - if(H5Oget_info2(tid2, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid2, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo3.token, TRUE) < 0) TEST_ERROR /* Check cork status of the datatype: tid1 */ @@ -1377,9 +1377,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0) TEST_ERROR /* Check cork status of the group: gid2 */ @@ -1399,7 +1399,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0) TEST_ERROR /* Close the group: gid1 */ @@ -1411,9 +1411,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did2 */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo2.token, FALSE) < 0) TEST_ERROR /* Check cork status of the dataset: did1 */ @@ -1433,7 +1433,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.token, FALSE) < 0) TEST_ERROR /* Close the dataset: did1 */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 7b17043..6cf27c8 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -661,20 +661,20 @@ filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, size_t *buf_size, void **buf) { int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + size_t buf_left=*buf_size; /* Amount of data buffer left to process */ if(flags & H5Z_FLAG_REVERSE) { /* read */ /* Substract the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ -= (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /* write */ /* Add the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ += (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end else */ @@ -698,20 +698,20 @@ filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, size_t *buf_size, void **buf) { int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + size_t buf_left=*buf_size; /* Amount of data buffer left to process */ if(flags & H5Z_FLAG_REVERSE) { /* read */ /* Substract the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ /= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /* write */ /* Add the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ *= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end else */ diff --git a/test/dsets.c b/test/dsets.c index 2ebb6c8..7684de4 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -147,10 +147,12 @@ const char *FILENAME[] = { #define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1" #define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2" #define COPY_DCPL_EXTFILE_NAME "ext_file" +#ifndef H5_NO_DEPRECATED_SYMBOLS #define DSET_DEPREC_NAME "deprecated" #define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" #define DSET_DEPREC_NAME_COMPACT "deprecated_compact" #define DSET_DEPREC_NAME_FILTER "deprecated_filter" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Dataset names for testing Fixed Array Indexing */ #define DSET_FIXED_MAX "DSET_FIXED_MAX" @@ -176,7 +178,9 @@ const char *FILENAME[] = { #define H5Z_FILTER_CORRUPT 306 #define H5Z_FILTER_CAN_APPLY_TEST 307 #define H5Z_FILTER_SET_LOCAL_TEST 308 +#ifndef H5_NO_DEPRECATED_SYMBOLS #define H5Z_FILTER_DEPREC 309 +#endif /* H5_NO_DEPRECATED_SYMBOLS */ #define H5Z_FILTER_EXPAND 310 #define H5Z_FILTER_CAN_APPLY_TEST2 311 #define H5Z_FILTER_COUNT 312 @@ -7265,8 +7269,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i=0; i<NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7386,14 +7390,14 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) for(j = 0; j < nsize[1] / csize[1]; j++) check2[i][j] = 0; - rows = nsize[0] / csize[0]; - cols = nsize[1] / csize[1]; + rows = (long)(nsize[0] / csize[0]); + cols = (long)(nsize[1] / csize[1]); make_random_offset_and_increment(rows * cols, &ofs, &inc); /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7502,8 +7506,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -9728,8 +9732,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks[chunk_row][chunk_col]); @@ -9857,8 +9861,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS_BIG; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks_big[chunk_row][chunk_col]); @@ -10988,7 +10992,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[1] = { H5S_UNLIMITED }; const hsize_t chunk[1] = { 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Extensible array chunk index header flush dependencies handled correctly"); @@ -11053,9 +11057,9 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -11108,7 +11112,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[1] = { 64 }; const hsize_t chunk[1] = { 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Fixed array chunk index header flush dependencies handled correctly"); @@ -11173,9 +11177,9 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -11228,7 +11232,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[2] = { H5S_UNLIMITED, H5S_UNLIMITED }; const hsize_t chunk[2] = { 8, 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly"); @@ -11293,9 +11297,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -13005,13 +13009,13 @@ dls_01_read_stuff(hid_t fid) { int status = 0; hid_t did = 0; - H5O_info_t info; + H5O_info2_t info; did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT); if(did <= 0) TEST_ERROR - status = H5Oget_info2(did, &info, H5O_INFO_BASIC ); + status = H5Oget_info3(did, &info, H5O_INFO_BASIC); if(status != 0) TEST_ERROR diff --git a/test/dtypes.c b/test/dtypes.c index c4c3946..ec82ffd 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5884,7 +5884,7 @@ test_latest(void) hid_t file = (-1); /* File ID */ hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */ hid_t fapl = (-1); /* File access property list */ - H5O_info_t oi; /* Stat buffer for committed datatype */ + H5O_native_info_t oi; /* Stat buffer for committed datatype */ hsize_t old_dtype_oh_size; /* Size of object header with "old" format */ hsize_t new_dtype_oh_size; /* Size of object header with "new" format */ char filename[1024]; /* Buffer for filename */ @@ -5918,7 +5918,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR old_dtype_oh_size = oi.hdr.space.total; @@ -5943,7 +5943,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ @@ -5979,7 +5979,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR new_dtype_oh_size = oi.hdr.space.total; @@ -6008,7 +6008,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ @@ -7292,7 +7292,7 @@ test_utf_ascii_conv(void) /* Test conversion in memory */ H5E_BEGIN_TRY { - status = H5Tconvert(utf8_vtid, ascii_vtid, 1, (void *)utf8_w, NULL, H5P_DEFAULT); + status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT); } H5E_END_TRY if(status >= 0) FAIL_STACK_ERROR @@ -7325,7 +7325,7 @@ test_utf_ascii_conv(void) ************************************************/ /* Test conversion in memory */ H5E_BEGIN_TRY { - status = H5Tconvert(ascii_vtid, utf8_vtid, 1, (void *)ascii_w, NULL, H5P_DEFAULT); + status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT); } H5E_END_TRY if(status >= 0) FAIL_STACK_ERROR diff --git a/test/fillval.c b/test/fillval.c index 47cd53a..b3e2e88 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -758,7 +758,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, int fillval=(-1), val_rd, should_be; int i, j, *buf=NULL, odd; unsigned u; - comp_datatype rd_c, fill_c, should_be_c; + comp_datatype rd_c, fill_c, should_be_c; comp_datatype *buf_c=NULL; H5D_space_status_t allocation; @@ -822,7 +822,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, - (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); + (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); goto error; } } diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 92c9f87..20a4ba4 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -843,13 +843,13 @@ herr_t flush_verification(const char * obj_pathname, const char * expected) /* Variables */ hid_t oid = -1, fid = -1; herr_t status = 0; - H5O_info_t oinfo; + H5O_info2_t oinfo; /* Try to open the testfile and then obj_pathname within the file */ H5E_BEGIN_TRY { fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT); oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT); - status = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + status = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; /* Compare to expected result */ @@ -978,9 +978,12 @@ herr_t refresh_verification(const char * obj_pathname) { /* Variables */ hid_t oid,fid,status = 0; - H5O_info_t flushed_oinfo; - H5O_info_t refreshed_oinfo; + H5O_info2_t flushed_oinfo; + H5O_info2_t refreshed_oinfo; + H5O_native_info_t flushed_ninfo; + H5O_native_info_t refreshed_ninfo; int tries = 800, sleep_tries = 400; + int token_cmp; hbool_t ok = FALSE; HDremove(SIGNAL_BETWEEN_PROCESSES_2); @@ -990,8 +993,9 @@ herr_t refresh_verification(const char * obj_pathname) if((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0) PROCESS_ERROR; /* Get Object info */ - if((status = H5Oget_info2(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - + if((status = H5Oget_info3(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &flushed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; + /* Make sure there are no attributes on the object. This is just a sanity check to ensure we didn't erroneously flush the attribute before starting the verification. */ @@ -1009,18 +1013,20 @@ herr_t refresh_verification(const char * obj_pathname) /* Get object info again. This will NOT reflect what's on disk, only what's in the cache. Thus, all values will be unchanged from above, despite newer information being on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; + if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; /* Verify that before doing a refresh, getting the object info returns stale information. (i.e., unchanged from above, despite new info on disk). */ - if(flushed_oinfo.addr != refreshed_oinfo.addr) PROCESS_ERROR; - if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR; - if(flushed_oinfo.hdr.version != refreshed_oinfo.hdr.version) PROCESS_ERROR; - if(flushed_oinfo.hdr.flags != refreshed_oinfo.hdr.flags) PROCESS_ERROR; - if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR; - if(flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) PROCESS_ERROR; - if(flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) PROCESS_ERROR; - if(flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) PROCESS_ERROR; + if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR; + if(token_cmp) PROCESS_ERROR; + if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR; + if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR; + if(flushed_ninfo.hdr.version != refreshed_ninfo.hdr.version) PROCESS_ERROR; + if(flushed_ninfo.hdr.flags != refreshed_ninfo.hdr.flags) PROCESS_ERROR; + if(flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) PROCESS_ERROR; + if(flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) PROCESS_ERROR; + if(flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) PROCESS_ERROR; /* Refresh object */ /* The H5*refresh function called depends on which object we are trying @@ -1047,19 +1053,20 @@ herr_t refresh_verification(const char * obj_pathname) } /* end else */ /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) - PROCESS_ERROR; + if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; + if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR; /* Confirm following (first 4) attributes are the same: */ /* Confirm following (last 4) attributes are different */ - if( (flushed_oinfo.addr == refreshed_oinfo.addr) && - (flushed_oinfo.type == refreshed_oinfo.type) && - (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && - (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && - (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && - (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && - (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && - (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { + if( (!token_cmp) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_ninfo.hdr.version == refreshed_ninfo.hdr.version) && + (flushed_ninfo.hdr.flags == refreshed_ninfo.hdr.flags) && + (flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) && + (flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) && + (flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) ) { ok = TRUE; break; } @@ -1071,11 +1078,11 @@ herr_t refresh_verification(const char * obj_pathname) if(!ok) { HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, - (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); + (int)flushed_oinfo.num_attrs, (int)flushed_ninfo.hdr.nmesgs, + (int)flushed_ninfo.hdr.nchunks, (int)flushed_ninfo.hdr.space.total); HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, - (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); + (int)refreshed_oinfo.num_attrs, (int)refreshed_ninfo.hdr.nmesgs, + (int)refreshed_ninfo.hdr.nchunks, (int)refreshed_ninfo.hdr.space.total); PROCESS_ERROR; } diff --git a/test/genall5.c b/test/genall5.c index 849d97c..3f55930 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -479,7 +479,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[16]; htri_t link_exists; @@ -493,7 +493,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -554,7 +554,8 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDfree(slinkval); } /* end if */ else if (1 == (u % 3)) { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; @@ -563,18 +564,25 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed."; } - else if (root_oinfo.addr != lnk_info.u.address) { - pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else-if */ else { void *elinkval; @@ -888,7 +896,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[16]; htri_t link_exists; @@ -902,7 +910,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -963,7 +971,8 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDfree(slinkval); } /* end if */ else if (1 == (u % 3)) { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; @@ -972,17 +981,24 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; } - else if (root_oinfo.addr != lnk_info.u.address) { - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else-if */ else { void *elinkval; @@ -1486,7 +1502,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[32]; htri_t link_exists; @@ -1500,7 +1516,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -1557,7 +1573,8 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDfree(slinkval); } /* end if */ else { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; HDassert(1 == (u % 2)); @@ -1568,18 +1585,25 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; } - else if (root_oinfo.addr != lnk_info.u.address) { - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else */ u++; diff --git a/test/getname.c b/test/getname.c index 399f364..f677d78 100644 --- a/test/getname.c +++ b/test/getname.c @@ -101,8 +101,8 @@ test_main(hid_t file_id, hid_t fapl) hid_t space_id; hid_t type_id, type2_id; hsize_t dims[1] = { 5 }; - size_t name_len; /* Name length */ - H5O_info_t oinfo; /* Object info structs */ + size_t name_len; /* Name length */ + H5O_info2_t oinfo; /* Object info structs */ hid_t dtype; /* Object identifier for testing */ hid_t dtype_anon; /* Object identifier for testing anonymous */ ssize_t size; /* Size returned by H5Iget_name */ @@ -2390,7 +2390,7 @@ test_main(hid_t file_id, hid_t fapl) if((size = H5Iget_name(dtype_anon, NULL,0)) != 0) TEST_ERROR /* Store the address of the datatype for later use */ - if(H5Oget_info2(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Update the reference count to dtype_anon to preserve the datatype */ if(H5Oincr_refcount(dtype_anon) < 0) TEST_ERROR @@ -2400,10 +2400,10 @@ test_main(hid_t file_id, hid_t fapl) if(H5Fclose(file2_id) < 0) TEST_ERROR /* Re-open the file and check that the anonymous datatypes persist */ - if( (file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Check the H5Iget_name does not return an error for anon committed datatypes */ - if((dtype_anon = H5Oopen_by_addr(file2_id, oinfo.addr)) < 0) TEST_ERROR + if((dtype_anon = H5Oopen_by_token(file2_id, oinfo.token)) < 0) TEST_ERROR if((size = H5Iget_name(dtype_anon, NULL, 0)) != 0) TEST_ERROR diff --git a/test/h5test.c b/test/h5test.c index 6a3a5cb..ab859a5 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1697,7 +1697,7 @@ error: */ static herr_t h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, - const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) + const H5O_info2_t *oinfo, void H5_ATTR_UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) return H5G__verify_cached_stabs_test(oid); @@ -1745,7 +1745,7 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) continue; } /* end if */ - if(H5Ovisit2(file, H5_INDEX_NAME, H5_ITER_NATIVE, + if(H5Ovisit3(file, H5_INDEX_NAME, H5_ITER_NATIVE, h5_verify_cached_stabs_cb, NULL, H5O_INFO_BASIC) < 0) goto error; diff --git a/test/links.c b/test/links.c index 4dff1cf..60d3152 100644 --- a/test/links.c +++ b/test/links.c @@ -35,6 +35,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ +#include "H5VLnative_private.h" /* Native VOL connector */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -314,7 +315,119 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ +static herr_t +UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static hid_t +UD_hard_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); +static herr_t +UD_hard_delete(const char *link_name, hid_t file, const void *udata, + size_t udata_size); + +/* User-defined link class */ +const H5L_class_t UD_hard_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link", /* Link class name for debugging */ + UD_hard_create, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse, /* The actual traversal function */ + UD_hard_delete, /* Deletion callback */ + NULL /* Query callback */ +}}; + +#ifndef H5_NO_DEPRECATED_SYMBOLS +static herr_t +UD_hard_create_deprec(const char *link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static hid_t +UD_hard_traverse_deprec(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); +static herr_t +UD_hard_delete_deprec(const char *link_name, hid_t file, const void *udata, + size_t udata_size); + +/* User-defined link class */ +const H5L_class_t UD_hard_class_deprec[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link_deprec", /* Link class name for debugging */ + UD_hard_create_deprec, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse_deprec, /* The actual traversal function */ + UD_hard_delete_deprec, /* Deletion callback */ + NULL /* Query callback */ +}}; +#endif + +static hid_t +UD_rereg_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); + +/* This link class has the same ID number as the UD hard links but + * has a very different traversal function */ +const H5L_class_t UD_rereg_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_reregistered_type", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_rereg_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ +}}; + +static herr_t +UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static herr_t +UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, + size_t udata_size); +static hid_t +UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, + size_t udata_size, hid_t lapl_id, hid_t dxpl_id); +static herr_t +UD_cb_delete(const char *link_name, hid_t file, const void *udata, + size_t udata_size); +static ssize_t +UD_cb_query(const char * link_name, const void *udata, size_t udata_size, + void *buf, size_t buf_size); + +const H5L_class_t UD_cb_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CB_TYPE, /* Link type id number */ + NULL, /* NULL name (to make sure this doesn't break anything */ + UD_cb_create, /* Creation callback */ + UD_cb_move, /* Move/rename callback */ + UD_cb_move, /* Copy callback */ + UD_cb_traverse, /* The actual traversal function */ + UD_cb_delete, /* Deletion callback */ + UD_cb_query /* Query callback */ +}}; +static hid_t +UD_plist_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); + +const H5L_class_t UD_plist_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ + "UD_plist_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_plist_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ +}}; /*------------------------------------------------------------------------- * Function: fix_ext_filename @@ -499,10 +612,11 @@ static int cklinks(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; + H5O_info2_t oinfo1, oinfo2; + H5L_info2_t linfo; char linkval[LINK_BUF_SIZE]; char filename[NAME_BUF_SIZE]; + int token_cmp; herr_t status; if(new_format) @@ -515,14 +629,15 @@ cklinks(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Hard link */ - if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR + if(token_cmp) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -551,13 +666,14 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ /* Symbolic link */ - if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR + if(token_cmp) { H5_FAILED(); HDputs(" Soft link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -573,15 +689,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); TEST_ERROR } /* end if */ - if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { + if(H5Lget_info2(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -600,15 +716,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); TEST_ERROR } /* end if */ - if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { + if(H5Lget_info2(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -652,8 +768,9 @@ static int ck_new_links(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; + H5O_info2_t oi_dset, oi_hard1, oi_hard2; char filename[NAME_BUF_SIZE]; + int token_cmp1, token_cmp2; if(new_format) TESTING("new link queries (w/new group format)") @@ -665,9 +782,9 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { @@ -675,7 +792,10 @@ ck_new_links(hid_t fapl, hbool_t new_format) HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } - if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { + + if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard1.token, &token_cmp1) < 0) TEST_ERROR + if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard2.token, &token_cmp2) < 0) TEST_ERROR + if(token_cmp1 || token_cmp2) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -920,7 +1040,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) hid_t dset_id = -1; hid_t type_id = -1; hid_t lcpl_id = -1; - H5L_info_t linfo; + H5L_info2_t linfo; char filename[1024]; hsize_t dims[2]; @@ -942,7 +1062,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create and commit a datatype with the default LCPL */ @@ -951,7 +1071,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Tclose(type_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create a dataspace */ @@ -964,7 +1084,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create a link creation property list with the UTF-8 character encoding */ @@ -976,7 +1096,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create and commit a datatype with the new LCPL */ @@ -985,7 +1105,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Tclose(type_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create a dataset using the new LCPL */ @@ -993,7 +1113,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create a new link to the dataset with a different character encoding. */ @@ -1004,35 +1124,35 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR /* Check that its character encoding is ASCII */ - if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR /* Check that the first link's encoding hasn't changed */ - if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Make sure that LCPLs work properly for other API calls: */ /* H5Lcreate_soft */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* H5Lmove */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR /* H5Lcopy */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* H5Lcreate_external */ if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Close open IDs */ @@ -1328,8 +1448,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) hid_t fcpl_id=-1; /* Group creation property list ID */ hid_t lcpl_id=-1; hid_t lcpl2_id=-1; - H5O_info_t oinfo; - H5L_info_t linfo; + H5O_info2_t oinfo; + H5L_info2_t linfo; H5T_cset_t old_cset; int64_t old_corder; /* Creation order value of link */ time_t old_modification_time; @@ -1366,8 +1486,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Get the group's link's information */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR old_cset = linfo.cset; if(old_cset != H5T_CSET_UTF8) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1385,8 +1505,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR /* Get the link's character set & modification time . They should be unchanged */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(old_cset != linfo.cset) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1394,9 +1514,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Create a new link to the group. It should have a different creation order value but the same modification time */ if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(old_corder == linfo.corder) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 1) TEST_ERROR @@ -1407,9 +1527,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * should not change. */ if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 2) TEST_ERROR @@ -1418,9 +1538,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link with the default property list. */ if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 3) TEST_ERROR @@ -1428,9 +1548,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR /* Check that the original link is unchanged */ - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(old_corder != linfo.corder) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR @@ -1439,9 +1559,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * Its creation order value will change, but modification time should not * change. */ if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 4) TEST_ERROR @@ -1450,9 +1570,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link again using the default property list. */ if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 5) TEST_ERROR @@ -1625,6 +1745,3910 @@ error: } H5E_END_TRY; return 1; } /* end test_deprec() */ + +/*------------------------------------------------------------------------- + * Function: cklinks_deprec + * + * Purpose: Open the file created in the first step and check that the + * links look correct. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +cklinks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t file; + H5O_info1_t oinfo1, oinfo2; + H5L_info1_t linfo; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; + + if(new_format) + TESTING("link queries using deprecated routines (w/new group format)") + else + TESTING("link queries using deprecated routines") + + /* Open the file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + + /* Hard link */ + if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + H5E_BEGIN_TRY { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + H5E_BEGIN_TRY { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + + /* Symbolic link */ + if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(linkval, "/d1")) { + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + + /* Dangling link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info1(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "foobar")) { + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + + /* Recursive link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info1(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "/grp1/recursive")) { + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + + /* Non-existent link */ + if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR + + /* Cleanup */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + return FAIL; +} /* end chklinks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: test_lcpl_deprec + * + * Purpose: Tests Link Creation Property Lists + * + * Return: Success: 0 + * Failure: number of errors + *------------------------------------------------------------------------- + */ +static int +test_lcpl_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t file_id = -1; + hid_t group_id = -1; + hid_t space_id = -1; + hid_t dset_id = -1; + hid_t type_id = -1; + hid_t lcpl_id = -1; + H5L_info1_t linfo; + char filename[1024]; + hsize_t dims[2]; + + if(new_format) + TESTING("link creation property lists using deprecated routines (w/new group format)") + else + TESTING("link creation property lists using deprecated routines") + + /* Actually, intermediate group creation is tested elsewhere (tmisc). + * Here we only need to test the character encoding property */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create and link a group with the default LCPL */ + if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create and commit a datatype with the default LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create a dataspace */ + dims[0] = H5L_DIM1; + dims[1] = H5L_DIM2; + if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR + + /* Create a dataset using the default LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + + /* Create and link a group with the new LCPL */ + if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create and commit a datatype with the new LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a dataset using the new LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a new link to the dataset with a different character encoding. */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + + if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that its character encoding is ASCII */ + if(H5Lget_info1(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Check that the first link's encoding hasn't changed */ + if(H5Lget_info1(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Make sure that LCPLs work properly for other API calls: */ + /* H5Lcreate_soft */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lmove */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* H5Lcopy */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lcreate_external */ + if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Sclose(space_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Dclose(dset_id); + H5Tclose(type_id); + H5Pclose(lcpl_id); + H5Sclose(space_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; +} /* end test_lcpl_deprec() */ + +/*------------------------------------------------------------------------- + * Function: test_move_preserves_deprec + * + * Purpose: Tests that moving and renaming links preserves their + * properties. + * + * Return: Success: 0 + * Failure: number of errors + *------------------------------------------------------------------------- + */ +static int +test_move_preserves_deprec(hid_t fapl_id, hbool_t new_format) +{ + hid_t file_id=-1; + hid_t group_id=-1; + hid_t fcpl_id=-1; /* Group creation property list ID */ + hid_t lcpl_id=-1; + hid_t lcpl2_id=-1; + H5O_info1_t oinfo; + H5L_info1_t linfo; + H5T_cset_t old_cset; + int64_t old_corder; /* Creation order value of link */ + time_t old_modification_time; + time_t curr_time; + unsigned crt_order_flags; /* Status of creation order info for GCPL */ + char filename[1024]; + + if(new_format) + TESTING("moving and copying links using deprecated routines preserves their properties (w/new group format)") + else + TESTING("moving and copying links using deprecated routines preserves their properties") + + /* Create a file creation property list with creation order stored for links + * in the root group + */ + if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR + if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR + + /* Create file */ + /* (with creation order tracking for the root group) */ + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR + + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + + /* Create a group with that lcpl */ + if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Get the group's link's information */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + old_cset = linfo.cset; + if(old_cset != H5T_CSET_UTF8) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + old_corder = linfo.corder; + if(old_corder != 0) TEST_ERROR + old_modification_time = oinfo.mtime; + + /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */ + curr_time = HDtime(NULL); + while(HDtime(NULL) <= curr_time) + ; + + /* Close the file and reopen it */ + if(H5Fclose(file_id) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR + + /* Get the link's character set & modification time . They should be unchanged */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(old_cset != linfo.cset) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + + /* Create a new link to the group. It should have a different creation order value but the same modification time */ + if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(old_corder == linfo.corder) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 1) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Copy the first link to a UTF-8 name. + * Its creation order value should be different, but modification time + * should not change. + */ + if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 2) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link with the default property list. */ + if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 3) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Check that the original link is unchanged */ + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the first link to a UTF-8 name. + * Its creation order value will change, but modification time should not + * change. */ + if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 4) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link again using the default property list. */ + if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 5) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(fcpl_id) < 0) TEST_ERROR + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; +} /* end test_move_preserves_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_root_deprec + * + * Purpose: Build a file with external link to root group in external file + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_root_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t linfo; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ + + if(new_format) + TESTING("external link to root using deprecated routines (w/new group format)") + else + TESTING("external link to root using deprecated routines") + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + + /* Create file to point to */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that external links are registered with the library */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + + /* Create file with link to first file */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check information for external link */ + if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; + } + if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } + if(HDstrcmp(path, "/")) { + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; + } + + /* Create external link to object in first file */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check information for external link */ + if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; + } + if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } + if(HDstrcmp(path, "/")) { + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; + } + + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/")) TEST_ERROR + + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create a new object using H5Gcreate2 through the external link + * directly + */ + if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close file and group */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + /* Open first file again with read-only access and check on objects created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open objects created through external link */ + if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check names */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/new_group")) TEST_ERROR + if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/newer_group")) TEST_ERROR + + /* Close opened objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + /* Verify that new objects can't be created through a read-only external + * link. + */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + H5E_BEGIN_TRY { + gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY + if(gid >= 0) TEST_ERROR + + /* Close second file again */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end external_link_root_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_query_deprec + * + * Purpose: Query file & object names for external links, as well as + * information from H5Gget_obj_info + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_query_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + const char *file_name; /* Name of the file the external link points to */ + const char *object_name; /* Name of the object the external link points to */ + H5O_info1_t oi; /* Object information */ + H5L_info1_t li; /* Link information */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + + if(new_format) + TESTING("query aspects of external link using deprecated routines (w/new group format)") + else + TESTING("query aspects of external link using deprecated routines") + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + + /* Create first file, with external link to object in second file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if (H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if(H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } + + /* Get information for external link. It should be two strings right after each other */ + if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + + /* Extract the file and object names from the buffer */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR + + /* Compare the file and object names */ + if(HDstrcmp(file_name, filename2)) TEST_ERROR + if(HDstrcmp(object_name, "/dst")) TEST_ERROR + + /* Query information about object that external link points to */ + if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_GROUP != oi.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; + } + + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Make sure that passing in NULLs to H5Lunpack_elink_val works */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR + + /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end external_link_query_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_closing_deprec + * + * Purpose: Test that files are closed correctly when traversing + * external links. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_closing_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1); + hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); + hid_t lcpl_id=(-1); + hsize_t dims[2]; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ + H5L_info1_t li; + H5O_info1_t oi; + hobj_ref_t obj_ref; + + if(new_format) + TESTING("that external files are closed during traversal (w/new group format)") + else + TESTING("that external files are closed during traversal") + + /* In this test, external links will go from file1 to file2 and from + * file2 to file3. + * Test that all functions that can traverse external files close + * the files they open. + * Test that providing unusual paths containing external links can't + * make HDF5 forget to close a file it opened. + */ + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); + h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); + + /* Create four files */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + + /* Create external links from each file to the next */ + if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all files but the first */ + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Test creating each kind of object */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test that getting info works */ + if(H5Lget_info1(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Test move */ + if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, + "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open file 4 so we can do some fancy things */ + if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, + "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid4, "dataset1", fid1, + "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file 4 again */ + if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR + + /* Test copy (as of this test, it uses the same code as move) */ + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test H5Gset and get comment */ + if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(buf, "comment")) TEST_ERROR + + /* Test H5*open */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5*open2 */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5Oopen */ + if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test H5Fmount */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR + } H5E_END_TRY + + /* Test H5Rcreate */ + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR + + /* Test unlink */ + if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR + + /* We've tested that the various functions above don't leave files open. + * Now test that we can't confuse HDF5 by giving unusual paths with external links + */ + /* Create an external link that points to another external link */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", + H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Do an external link traversal that recursively calls another external link. */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create two more groups so that the last three elements in the path are + * all within the same external file + */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Add a few regular groups and a soft link in file2 using intermediate group creation */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", + lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Try to traverse this path. There are three soft traversals in a row; + * slink points to (file2)/elink2, which points to (file3)/elink, which + * points to file 4. + */ + if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + + /* Some simpler tests */ + if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + + + /* Close file1, the only file that should still be open */ + if(H5Fclose(fid1) < 0) TEST_ERROR + + /* Re-create each file. If they are hanging open, these creates will fail */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Cleanup */ + if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Tclose(tid2) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Tclose(tid); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid2); + H5Fclose(fid4); + H5Fclose(fid3); + H5Fclose(fid2); + H5Fclose(fid1); + } H5E_END_TRY; + return FAIL; +} /* external_link_closing_deprec() */ + +/* Callback functions for UD hard links. */ +/* UD_hard_create increments the object's reference count */ +static herr_t +UD_hard_create_deprec(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) +{ + haddr_t addr; + hid_t target_obj = -1; + herr_t ret_value = 0; + + if(udata_size != sizeof(haddr_t)) { + ret_value = -1; + goto done; + } /* end if */ + + addr = *((const haddr_t *)udata); + + /* Open the object this link points to */ + target_obj= H5Oopen_by_addr(loc_group, addr); + if(target_obj < 0) { + ret_value = -1; + goto done; + } /* end if */ + + /* Increment the reference count of the target object */ + if(H5Oincr_refcount(target_obj) < 0) { + ret_value = -1; + goto done; + } /* end if */ + +done: + /* Close the target object if we opened it */ + if(target_obj >= 0) { + switch(H5Iget_type(target_obj)) { + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + return FAIL; + } /* end switch */ + } /* end if */ + + return ret_value; +} /* end UD_hard_create() */ + +/* Traverse a hard link by opening the object */ +static hid_t +UD_hard_traverse_deprec(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) +{ + haddr_t addr; + hid_t ret_value = -1; + + if(udata_size != sizeof(haddr_t)) + return FAIL; + + addr = *((const haddr_t *) udata); + + ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */ + + return ret_value; +} /* end UD_hard_traverse() */ + +/* UD_hard_delete decrements the object's reference count */ +static herr_t +UD_hard_delete_deprec(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, + size_t udata_size) +{ + haddr_t addr; + hid_t target_obj = -1; + herr_t ret_value = 0; + + if(udata_size != sizeof(haddr_t)) { + ret_value = -1; + goto done; + } /* end if */ + + addr = *((const haddr_t *) udata); + + /* Open the object this link points to */ + target_obj= H5Oopen_by_addr(file, addr); + if(target_obj < 0) { + ret_value = -1; + goto done; + } /* end if */ + + /* Decrement the reference count of the target object */ + if(H5Odecr_refcount(target_obj) < 0) { + ret_value = -1; + goto done; + } /* end if */ + +done: + /* Close the target object if we opened it */ + if(target_obj >= 0) { + switch(H5Iget_type(target_obj)) { + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + return FAIL; + } /* end switch */ + } /* end if */ + + return ret_value; +} /* end UD_hard_delete() */ + +static int +ud_hard_links_deprec(hid_t fapl) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + h5_stat_size_t empty_size; /* Size of an empty file */ + char filename[NAME_BUF_SIZE]; + + TESTING("user-defined hard link using deprecated routines (w/new group format)") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that external links are registered and UD hard links are not */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Check that UD hard links are now registered */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD hard link to point to */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get address for the group to give to the hard link */ + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create a user-defined "hard link" to the group using the address we got + * from H5Lget_info1 */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open group through UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group")) TEST_ERROR + + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR + + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Check that H5Lget_objinfo works on the hard link */ + if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* UD hard links have no query function, thus return a "link length" of 0 */ + if(li.u.val_size != 0) TEST_ERROR + if(UD_HARD_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } /* end if */ + + /* Unlink the group pointed to by the UD link. It shouldn't be + * deleted because of the UD link. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Ensure we can open the group through the UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Unlink the group contained within it. */ + if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Now delete the UD link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_hard_links_deprec() */ + +static int +ud_link_reregister_deprec(hid_t fapl) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + h5_stat_size_t empty_size; /* Size of an empty file */ + + TESTING("registering a new class for existing UD links using deprecated routines (w/new group format)") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that UD hard links are not registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Check that UD hard links are registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Point a UD defined hard link to a group in the same way as the previous test */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ + if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Now unregister UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Check that UD hard links are no longer registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Verify that we can't traverse the ud link anymore */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR + } H5E_END_TRY + + /* Verify that we can't create any new links of this type */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY + + /* Register a new kind of link with the same ID number */ + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + + /* Check that UD hard links are registered again */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Open a group through the ud link (now a different class of link). + * It should be a different group + * than the UD hard link pointed to */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR + + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR + + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Unlink the group pointed to by the UD hard link. It shouldn't be + * deleted because the UD link incremented its reference count. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* What a mess! Re-register user-defined links to clean up the + * reference counts. We shouldn't actually need to unregister the + * other link type */ + if(H5Lregister(UD_hard_class_deprec) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR + + /* Ensure we can open the group through the UD link (now that UD hard + * links have been registered) */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Delete the UD hard link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Unlink the other two groups so that we can make sure the file is empty */ + if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_link_reregister_deprec() */ + +static int +ud_callbacks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t lcpl = -1; /* Link Creation PL */ + H5L_info1_t li; /* Link information */ + char ud_target_name[] = UD_CB_TARGET; /* Link target name */ + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + + if(new_format) + TESTING("user-defined link callbacks using deprecated routines (w/new group format)") + else + TESTING("user-defined link callbacks using deprecated routines") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR + + /* Hit two birds with one stone: register UD hard links from previous + * test to check that having two UD links registered at once presents + * no problems. */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Register user-defined link class. This is the one we'll actually be using. */ + if(H5Lregister(UD_cb_class) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD link to point to */ + if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create a user-defined link to the group. These UD links behave like soft links. */ + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try opening group through UD link */ + if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Query the link to test its query callback */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != 16) TEST_ERROR + if (UD_CB_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } + + /* Fill the query buffer */ + if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR + + /* Move the link */ + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Re-open group to ensure that move worked */ + if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Remove UD link */ + if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test that the callbacks don't work if the link class is not registered */ + + /* Create a new link. Just for fun, give it a non-default character + * encoding (to test that LAPLs work) */ + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR + if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR + + /* Check its character encoding */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Unregister the link class so the library forgets what its callbacks do */ + if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR + + /* Now test that each of the callbacks fails */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + } H5E_END_TRY + + /* The query callback should NOT fail, but should be unable to give a linklen */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 0) TEST_ERROR + if(li.type != UD_CB_TYPE) TEST_ERROR + + /* Unregister the UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_callbacks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: lapl_nlinks_deprec + * + * Purpose: Check that the maximum number of soft links can be adjusted + * by the user using the Link Access Property List. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +lapl_nlinks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist = -1; /* lapl ID */ + hid_t tid = -1, sid = -1, did = -1; /* Other IDs */ + hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + size_t nlinks; /* nlinks for H5Pset_nlinks */ + hsize_t dims[2]; + + if(new_format) + TESTING("adjusting nlinks with LAPL using deprecated routines (w/new group format)") + else + TESTING("adjusting nlinks with LAPL using deprecated routines") + + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); + + /* Create file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group with short name in file (used as target for links) */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create chain of soft links to existing object (limited) */ + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Create LAPL with higher-than-usual nlinks value */ + /* Create a non-default lapl with udata set to point to the first group */ + if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Ensure that nlinks was set successfully */ + nlinks = 0; + if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR + if(nlinks != 20) TEST_ERROR + + /* Open object through what is normally too many soft links using + * new property list */ + if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft17")) TEST_ERROR + + /* Create group using soft link */ + if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Set nlinks to a smaller number */ + nlinks = 4; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Ensure that nlinks was set successfully */ + nlinks = 0; + if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR + if(nlinks != 4) TEST_ERROR + + /* Try opening through what is now too many soft links */ + H5E_BEGIN_TRY { + gid = H5Oopen(fid, "soft5", plist); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; + } + + /* Open object through lesser soft link */ + if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft4")) TEST_ERROR + + /* Test other functions that should use a LAPL */ + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Try copying and moving when both src and dst contain many soft links + * using a non-default LAPL + */ + if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Olink */ + if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Lcreate_hard and H5Lcreate_soft */ + if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Ldelete */ + if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR + + /* H5Lget_val and H5Lget_info1 */ + if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR + if(H5Lget_info1(fid, "soft17", NULL, plist) < 0) TEST_ERROR + + /* H5Lcreate_external and H5Lcreate_ud */ + if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* Close plist */ + if(H5Pclose(plist) < 0) TEST_ERROR + + /* Create a datatype and dataset as targets inside the group */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close group */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try to open the objects using too many symlinks with default *APLs */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + } H5E_END_TRY + + /* Create property lists with nlinks set */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR + + nlinks = 20; + if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR + + /* We should now be able to use these property lists to open each kind + * of object. + */ + if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR + if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close plists */ + if(H5Pclose(gapl) < 0) TEST_ERROR + if(H5Pclose(tapl) < 0) TEST_ERROR + if(H5Pclose(dapl) < 0) TEST_ERROR + + /* Unregister UD hard link class */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end lapl_nlinks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: linkinfo_deprec + * + * Purpose: Check that the link class is returned correctly when queried. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +linkinfo_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info1_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; + + if(new_format) + TESTING("link type field in H5Lget_info using deprecated routines (w/new group format)") + else + TESTING("link type field in H5Lget_info using deprecated routines") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Register a couple of user-defined link classes with the library */ + if(H5Lregister(UD_plist_class) < 0) TEST_ERROR + + /* Create an object of each type */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all objects */ + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Make sure that link type is correct when objects are queried */ + if(H5Lget_info1(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + + if(H5Lget_info1(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR + if(H5Lget_info1(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_SOFT) TEST_ERROR + if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != UD_PLIST_TYPE) TEST_ERROR + + /* Ensure that passing a NULL pointer doesn't cause an error */ + if(H5Lget_info1(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end linkinfo_deprec() */ + +/*------------------------------------------------------------------------- + * Function: corder_create_compact_deprec + * + * Purpose: Create a group with creation order indices and insert links + * in it when in compact form + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +corder_create_compact_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned nlinks; /* Number of link messages in group's header */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + unsigned u; /* Local index variable */ + + TESTING("creating compact group with creation order indexing using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create several links, but keep group in compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != max_compact) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < max_compact; u++) { + H5L_info1_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end corder_create_compact_deprec() */ + +/*------------------------------------------------------------------------- + * Function: corder_create_dense_deprec + * + * Purpose: Create a group with creation order indices and insert links + * in it until it's in dense form + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +corder_create_dense_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned nlinks; /* Number of link messages in group's header */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + unsigned u; /* Local index variable */ + + TESTING("creating dense group with creation order indexing using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ + + /* Create another link, to push group into dense form */ + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < (max_compact + 1); u++) { + H5L_info1_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end corder_create_dense_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_check_deprec + * + * Purpose: Support routine for link_info_by_idx, to verify the link + * info is correct for a link + * + * Note: This routine assumes that the links have been inserted in the + * group in alphabetical order. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, + hbool_t hard_link, hbool_t use_index) +{ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ + H5L_info1_t linfo; /* Link info struct */ + + /* Make link value for increasing/native order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); + + /* Verify the link information for first link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in increasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in increasing creation order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order if there is no creation order index, since + * there's not a good way to easily predict the link's order in the name + * index. + */ + if(use_index) { + /* Verify the link information for first link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in native creation order (which is increasing) */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in native creation order (which is increasing) */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + } /* end if */ + + /* Verify the link information for first link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in decreasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in decreasing creation order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + + /* Verify the link information for first link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in increasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in increasing link name order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order queries on link name order, since there's not + * a good way to easily predict the order of the links in the name index. + */ + + /* Verify the link information for first link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in decreasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in decreasing link name order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Success */ + return(0); + +error: + /* Failure */ + return(-1); +} /* end link_info_by_idx_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_deprec + * + * Purpose: Create a group with creation order indices and test querying + * info by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned hard_link; /* Create hard or soft link? */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ + herr_t ret; /* Generic return value */ + + /* Loop over creating hard or soft links */ + for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + if(hard_link) { + if(use_index) + TESTING("querying info by index w/creation order index, using hard links and deprecated routines") + else + TESTING("querying info by index w/o creation order index, using hard links and deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("querying info by index w/creation order index, using soft links and deprecated routines") + else + TESTING("querying info by index w/o creation order index, using soft links and deprecated routines") + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Check for query on empty group */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify state of group */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end link_info_by_idx_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_old_deprec + * + * Purpose: Create a old-format group and test querying + * info by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + unsigned hard_link; /* Create hard or soft link? */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ + unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ + herr_t ret; /* Generic return value */ + + /* Loop over creating hard or soft links */ + for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { + if(hard_link) + TESTING("querying info by index in old-style group, using hard links and deprecated routines") + else + TESTING("querying info by index in old-style group, using soft links and deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + } /* end for */ + + /* Verify link information for created links */ + for(u = 0; u < CORDER_NLINKS; u++) { + unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */ + + /* Make link name for increasing/native order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Make link value for increasing/native order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Verify link information (in increasing order) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in increasing order) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + + + /* Verify link information (in native order - native is increasing) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in native order - native is increasing) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + + + /* Make link name for decreasing order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + + /* Make link value for decreasing order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", dec_u); + + /* Verify link information (in decreasing order) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in decreasing order) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Check for creation order index queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end link_info_by_idx_old_deprec() */ + +/*------------------------------------------------------------------------- + * Function: delete_by_idx_deprec + * + * Purpose: Create a group with creation order indices and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +delete_by_idx_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by creation order index in increasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by creation order index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by creation order index in decreasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by creation order index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by name index in increasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by name index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by name index in decreasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by name index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Delete links from one end */ + + /* Check for deletion on empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for deletion on non-existing group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from compact group */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound deletion again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from dense group, in appropriate order */ + for(u = 0; u < ((max_compact * 2) - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Check for deletion on empty group again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links in middle */ + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Delete every other link from dense group, in appropriate order */ + for(u = 0; u < max_compact; u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from dense group, in appropriate order */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 3)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end delete_by_idx_deprec() */ + +/*------------------------------------------------------------------------- + * Function: delete_by_idx_old_deprec + * + * Purpose: Create a old-format group and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +delete_by_idx_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5L_info1_t linfo; /* Link info struct */ + H5_iter_order_t order; /* Order within in the index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + /* Print test banner */ + if(order == H5_ITER_INC) + TESTING("deleting links by index in increasing order in old-style group using deprecated routines") + else + TESTING("deleting links by index in decreasing order in old-style group using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Delete links from one end */ + + /* Check for deletion in empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Check for bad index type deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for out of bounds deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS - 1); u++) { + unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */ + + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check for deletion in empty group (again) */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Delete links in middle */ + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Delete every other link from group, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS / 2); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */ + + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from group, in appropriate order */ + for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */ + + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + return FAIL; +} /* end delete_by_idx_old_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_deprec_cb + * + * Purpose: Callback routine for iterating over links in group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, + void *_op_data) +{ + link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ + char objname[NAME_BUF_SIZE]; /* Object name */ + H5L_info1_t my_info; /* Local link info */ + + /* Increment # of times the callback was called */ + op_data->ncalled++; + + /* Get the link information directly to compare */ + if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + return H5_ITER_ERROR; + + /* Check more things for link iteration (vs. group iteration) */ + if(info) { + /* Check for correct order of iteration */ + /* (if we are operating in increasing or decreasing order) */ + if(op_data->order != H5_ITER_NATIVE) + if(info->corder != op_data->curr) + return H5_ITER_ERROR; + + /* Compare link info structs */ + if(info->type != my_info.type) + return H5_ITER_ERROR; + if(info->corder_valid != my_info.corder_valid) + return H5_ITER_ERROR; + if(info->corder != my_info.corder) + return H5_ITER_ERROR; + if(info->cset != my_info.cset) + return H5_ITER_ERROR; + if(H5F_addr_ne(info->u.address, my_info.u.address)) + return H5_ITER_ERROR; + } /* end if */ + + /* Verify name of link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); + if(HDstrcmp(link_name, objname)) + return H5_ITER_ERROR; + + /* Check if we've visited this link before */ + if((size_t)op_data->curr >= op_data->max_visit) + return H5_ITER_ERROR; + if(op_data->visited[op_data->curr]) + return H5_ITER_ERROR; + op_data->visited[op_data->curr] = TRUE; + + /* Advance to next value, in correct direction */ + if(op_data->order != H5_ITER_DEC) + op_data->curr++; + else + op_data->curr--; + + /* Check for stopping in the middle of iterating */ + if(op_data->stop > 0) + if(--op_data->stop == 0) + return CORDER_ITER_STOP; + + return H5_ITER_CONT; +} /* end link_iterate_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: group_iterate_deprec_cb + * + * Purpose: Callback routine for iterating over links in group with + * H5Giterate() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +group_iterate_deprec_cb(hid_t group_id, const char *link_name, void *_op_data) +{ + return link_iterate_deprec_cb(group_id, link_name, NULL, _op_data); +} /* end group_iterate_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_fail_deprec_cb + * + * Purpose: Callback routine for iterating over links in group that + * always returns failure + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_fail_deprec_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, + const H5L_info1_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) +{ + return H5_ITER_ERROR; +} /* end link_iterate_fail_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_check_deprec + * + * Purpose: Check iteration over links in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_check_deprec(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + unsigned max_links, link_iter_info_t *iter_info) +{ + unsigned v; /* Local index variable */ + hsize_t skip; /* # of links to skip in group */ + int gskip; /* # of links to skip in group, with H5Giterate */ + herr_t ret; /* Generic return value */ + + /* Iterate over links in group */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Skip over some links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Iterate over links in group, stopping in the middle */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Check for iteration routine indicating failure */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end link_iterate_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_deprec + * + * Purpose: Create a group with creation order indices and test iterating over + * links by index. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, November 14, 2006 + * + *------------------------------------------------------------------------- + */ +static int +link_iterate_deprec(hid_t fapl) +{ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + link_iter_info_t iter_info; /* Iterator info */ + hbool_t *visited = NULL; /* Array of flags for visiting links */ + hsize_t skip; /* # of links to skip in group */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Allocate the "visited link" array */ + iter_info.max_visit = max_compact * 2; + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + iter_info.visited = visited; + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("iterating over links by creation order index in increasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("iterating over links by creation order index in decreasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("iterating over links by creation order index in native order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in native order w/o creation order index using deprecated routines") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("iterating over links by name index in increasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("iterating over links by name index in decreasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("iterating over links by name index in native order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in native order w/o creation order index using deprecated routines") + } /* end else */ + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate1(group_id, idx_type, order, NULL, link_iterate_deprec_cb, NULL) < 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on compact group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in compact group */ + if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on dense group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in dense group */ + if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + } /* end for */ + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Free resources */ + if(visited) + HDfree(visited); + + return SUCCEED; + +error: + /* Free resources */ + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + if(visited) + HDfree(visited); + + return FAIL; +} /* end link_iterate_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_deprec_cb + * + * Purpose: Callback routine for iterating over [old] links in group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, void *_op_data) +{ + link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ + char objname[NAME_BUF_SIZE]; /* Object name */ + H5L_info1_t my_info; /* Local link info */ + + /* Increment # of times the callback was called */ + op_data->ncalled++; + + /* Get the link information directly to compare */ + if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + return H5_ITER_ERROR; + + /* Check more things for link iteration (vs. group iteration) */ + if(info) { + /* Compare link info structs */ + if(info->type != my_info.type) + return H5_ITER_ERROR; + if(info->corder_valid != my_info.corder_valid) + return H5_ITER_ERROR; + if(info->corder != my_info.corder) + return H5_ITER_ERROR; + if(info->cset != my_info.cset) + return H5_ITER_ERROR; + if(H5F_addr_ne(info->u.address, my_info.u.address)) + return H5_ITER_ERROR; + } /* end if */ + + /* Verify name of link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); + if(HDstrcmp(link_name, objname)) + return H5_ITER_ERROR; + + /* Check if we've visited this link before */ + if((size_t)op_data->curr >= op_data->max_visit) + return H5_ITER_ERROR; + if(op_data->visited[op_data->curr]) + return H5_ITER_ERROR; + op_data->visited[op_data->curr] = TRUE; + + /* Advance to next value, in correct direction */ + if(op_data->order != H5_ITER_DEC) + op_data->curr++; + else + op_data->curr--; + + /* Check for stopping in the middle of iterating */ + if(op_data->stop > 0) + if(--op_data->stop == 0) + return CORDER_ITER_STOP; + + return H5_ITER_CONT; +} /* end link_iterate_old_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: group_iterate_old_deprec_cb + * + * Purpose: Callback routine for iterating over links in group with + * H5Giterate() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +group_iterate_old_deprec_cb(hid_t group_id, const char *link_name, void *_op_data) +{ + return link_iterate_old_deprec_cb(group_id, link_name, NULL, _op_data); +} /* end group_iterate_old_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_check_deprec + * + * Purpose: Check iteration over [old] links in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_check_deprec(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info) +{ + unsigned v; /* Local index variable */ + hsize_t skip; /* # of links to skip in group */ + int gskip; /* # of links to skip in group, with H5Giterate */ + herr_t ret; /* Generic return value */ + + /* Iterate over links in group */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Skip over some links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Iterate over links in group, stopping in the middle */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Check for iteration routine indicating failure */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for iteration w/bad location ID */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + H5E_BEGIN_TRY { + ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end link_iterate_old_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_deprec + * + * Purpose: Create a "old-style" group and test iterating over links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + H5_iter_order_t order; /* Order within in the index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + link_iter_info_t iter_info; /* Iterator info */ + hbool_t *visited = NULL; /* Array of flags for visiting links */ + hsize_t skip; /* # of links to skip in group */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Allocate the "visited link" array */ + iter_info.max_visit = CORDER_NLINKS; + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + iter_info.visited = visited; + + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + /* Print appropriate test message */ + if(order == H5_ITER_INC) { + TESTING("iterating over links by name index in increasing order in old-style group using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + TESTING("iterating over links by name index in decreasing order in old-style group using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + TESTING("iterating over links by name index in native order in old-style group using deprecated routines") + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate1(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_deprec_cb, NULL) < 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (symbol table) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on old-style group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for iteration on creation order */ + /* (should fail) */ + skip = (hsize_t)0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in group */ + if(link_iterate_old_check_deprec(group_id, order, u, &iter_info) < 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + /* Free resources */ + if(visited) + HDfree(visited); + + return SUCCEED; + +error: + /* Free resources */ + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + if(visited) + HDfree(visited); + + return FAIL; +} /* end link_iterate_old_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -1642,7 +5666,7 @@ external_link_root(hid_t fapl, hbool_t new_format) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -1674,7 +5698,7 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been an external link"); @@ -1698,7 +5722,7 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been an external link"); @@ -5013,15 +9037,15 @@ error: static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group IDs */ - const char *file_name; /* Name of the file the external link points to */ - const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ - H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ - query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + const char *file_name; /* Name of the file the external link points to */ + const char *object_name; /* Name of the object the external link points to */ + H5O_info2_t oi; /* Object information */ + H5L_info2_t li; /* Link information */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) TESTING("query aspects of external link (w/new group format)") @@ -5040,7 +9064,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); @@ -5065,7 +9089,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); @@ -5084,7 +9108,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(HDstrcmp(object_name, "/dst")) TEST_ERROR /* Query information about object that external link points to */ - if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been a group"); @@ -5729,8 +9753,8 @@ external_link_closing(hid_t fapl, hbool_t new_format) filename3[NAME_BUF_SIZE], filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ buf[NAME_BUF_SIZE]; /* misc. buffer */ - H5L_info_t li; - H5O_info_t oi; + H5L_info2_t li; + H5O_info2_t oi; hobj_ref_t obj_ref; if(new_format) @@ -5786,10 +9810,10 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Dclose(did) < 0) TEST_ERROR /* Test that getting info works */ - if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Test move */ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, @@ -5876,7 +9900,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Add a few regular groups and a soft link in file2 using intermediate group creation */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR @@ -5890,13 +9914,13 @@ external_link_closing(hid_t fapl, hbool_t new_format) */ if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR /* Some simpler tests */ if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR /* Close file1, the only file that should still be open */ @@ -7168,19 +11192,19 @@ static herr_t UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { - haddr_t addr; + H5O_token_t token; hid_t target_obj = -1; herr_t ret_value = 0; - if(udata_size != sizeof(haddr_t)) { + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } /* end if */ - addr = *((const haddr_t *)udata); + token = *(const H5O_token_t *)udata; /* Open the object this link points to */ - target_obj = H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; goto done; @@ -7242,15 +11266,16 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) { - haddr_t addr; + H5O_token_t token; hid_t ret_value = -1; - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) return FAIL; - addr = *((const haddr_t *) udata); + token = *(const H5O_token_t *)udata; - ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */ + /* If this fails, our return value will be negative. */ + ret_value = H5Oopen_by_token(cur_group, token); return ret_value; } /* end UD_hard_traverse() */ @@ -7260,19 +11285,19 @@ static herr_t UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, size_t udata_size) { - haddr_t addr; + H5O_token_t token; hid_t target_obj = -1; herr_t ret_value = 0; - if(udata_size != sizeof(haddr_t)) { + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } /* end if */ - addr = *((const haddr_t *) udata); + token = *(const H5O_token_t *)udata; /* Open the object this link points to */ - target_obj = H5Oopen_by_addr(file, addr); + target_obj = H5Oopen_by_token(file, token); if(target_obj < 0) { ret_value = -1; goto done; @@ -7328,24 +11353,12 @@ done: return ret_value; } /* end UD_hard_delete() */ -const H5L_class_t UD_hard_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_hard_link", /* Link class name for debugging */ - UD_hard_create, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_hard_traverse, /* The actual traversal function */ - UD_hard_delete, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int ud_hard_links(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ char filename[NAME_BUF_SIZE]; @@ -7378,13 +11391,13 @@ ud_hard_links(hid_t fapl) if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Get address for the group to give to the hard link */ - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR /* Create a user-defined "hard link" to the group using the address we got - * from H5Lget_info */ - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + * from H5Lget_info2 */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -7415,7 +11428,7 @@ ud_hard_links(hid_t fapl) if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Check that H5Lget_objinfo works on the hard link */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { @@ -7488,26 +11501,12 @@ error: return FAIL; } /* end UD_rereg_traverse() */ -/* This link class has the same ID number as the UD hard links but - * has a very different traversal function */ -const H5L_class_t UD_rereg_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_reregistered_type", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_rereg_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int ud_link_reregister(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ @@ -7536,11 +11535,11 @@ ud_link_reregister(hid_t fapl) /* Point a UD defined hard link to a group in the same way as the previous test */ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ @@ -7560,8 +11559,8 @@ ud_link_reregister(hid_t fapl) /* Verify that we can't create any new links of this type */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY @@ -7643,7 +11642,7 @@ error: /*------------------------------------------------------------------------- - * Function: ud_callbacks + * Function: UD_cb_create * * Purpose: Check that all callbacks are called and are given the correct * information. @@ -7759,25 +11758,13 @@ error: return FAIL; } /* end UD_cb_query() */ -const H5L_class_t UD_cb_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CB_TYPE, /* Link type id number */ - NULL, /* NULL name (to make sure this doesn't break anything */ - UD_cb_create, /* Creation callback */ - UD_cb_move, /* Move/rename callback */ - UD_cb_move, /* Copy callback */ - UD_cb_traverse, /* The actual traversal function */ - UD_cb_delete, /* Deletion callback */ - UD_cb_query /* Query callback */ -}}; - static int ud_callbacks(hid_t fapl, hbool_t new_format) { hid_t fid = -1; /* File ID */ hid_t gid = -1; /* Group ID */ hid_t lcpl = -1; /* Link Creation PL */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; @@ -7822,7 +11809,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Query the link to test its query callback */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { H5_FAILED(); @@ -7854,7 +11841,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR /* Check its character encoding */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.cset != H5T_CSET_UTF8) TEST_ERROR /* Unregister the link class so the library forgets what its callbacks do */ @@ -7870,7 +11857,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) } H5E_END_TRY /* The query callback should NOT fail, but should be unable to give a linklen */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 0) TEST_ERROR if(li.type != UD_CB_TYPE) TEST_ERROR @@ -7924,18 +11911,6 @@ error: return FAIL; } /* end UD_plist_traverse() */ -const H5L_class_t UD_plist_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ - "UD_plist_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_plist_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int lapl_udata(hid_t fapl, hbool_t new_format) { @@ -8231,12 +12206,12 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - char query_buf[NAME_BUF_SIZE]; - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + H5L_info2_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") @@ -8301,7 +12276,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR /* The query callback will fail */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR } H5E_END_TRY /* Now use a class with different callback functions */ @@ -8314,7 +12289,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* The query callback will succeed when we only want to get the size of the buffer... */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 0) TEST_ERROR /* ...but fail when we try to write data to the buffer itself*/ H5E_BEGIN_TRY { @@ -8325,7 +12300,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR /* Now querying should succeed */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 8) TEST_ERROR if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR @@ -8491,9 +12466,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* H5Ldelete */ if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR - /* H5Lget_val and H5Lget_info */ + /* H5Lget_val and H5Lget_info2 */ if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR - if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR + if(H5Lget_info2(fid, "soft17", NULL, plist) < 0) TEST_ERROR /* H5Lcreate_external and H5Lcreate_ud */ if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR @@ -8592,12 +12567,12 @@ error: static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t tid = -1; /* Type ID */ - hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ - H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info2_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -8630,22 +12605,22 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Dclose(did) < 0) TEST_ERROR /* Make sure that link type is correct when objects are queried */ - if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR - if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_SOFT) TEST_ERROR - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != UD_PLIST_TYPE) TEST_ERROR /* Ensure that passing a NULL pointer doesn't cause an error */ - if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR @@ -8815,7 +12790,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data) +visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info2_t *linfo, void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -8857,26 +12832,26 @@ link_visit(hid_t fapl, hbool_t new_format) /* Visit all the links reachable from the root group (with file ID) */ udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -8921,34 +12896,34 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the links reachable from the root group (with file ID) */ udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from each internal group */ udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit_by_name(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -8976,7 +12951,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data) +visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info2_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -9018,26 +12993,26 @@ obj_visit(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -9082,34 +13057,34 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -9136,7 +13111,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data) +visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info2_t H5_ATTR_UNUSED *oinfo, void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9176,14 +13151,14 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) * returns H5_ITER_STOP */ nvisited = 0; - if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) + if((ret = H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR /* Same test with H5Ovisit_by_name */ nvisited = 0; - if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, + if((ret = H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -9977,11 +13952,11 @@ corder_create_compact(hid_t fapl) /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ for(u = 0; u < max_compact; u++) { - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ /* Retrieve information for link */ HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ if(linfo.corder_valid != TRUE) TEST_ERROR @@ -10105,11 +14080,11 @@ corder_create_dense(hid_t fapl) /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ for(u = 0; u < (max_compact + 1); u++) { - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ /* Retrieve information for link */ HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ if(linfo.corder_valid != TRUE) TEST_ERROR @@ -10503,19 +14478,19 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ char valname[NAME_BUF_SIZE]; /* Link value name */ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ /* Make link value for increasing/native order queries */ HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); /* Verify the link information for first link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in increasing creation order */ @@ -10537,12 +14512,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, if(use_index) { /* Verify the link information for first link, in native creation order (which is increasing) */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in native creation order (which is increasing) */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in native creation order (which is increasing) */ @@ -10560,12 +14535,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in decreasing creation order */ @@ -10583,12 +14558,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in increasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in increasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in increasing link name order */ @@ -10609,12 +14584,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in decreasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in decreasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in decreasing link name order */ @@ -10658,7 +14633,7 @@ link_info_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[NAME_BUF_SIZE]; /* Link value name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10702,7 +14677,7 @@ link_info_by_idx(hid_t fapl) /* Check for query on empty group */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10740,11 +14715,11 @@ link_info_by_idx(hid_t fapl) /* Check for out of bound offset queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10782,11 +14757,11 @@ link_info_by_idx(hid_t fapl) /* Check for out of bound offset queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10832,19 +14807,22 @@ error: static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = -1; /* File ID */ - hid_t group_id = -1, group_id2 = -1; /* Group IDs */ - unsigned hard_link; /* Create hard or soft link? */ - H5L_info_t linfo; /* Link info struct */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value name */ - char filename[NAME_BUF_SIZE];/* File name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ - char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ - char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ - unsigned u; /* Local index variable */ - ssize_t name_len; /* Length of name */ - herr_t ret; /* Generic return value */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5F_t *f = NULL; + unsigned hard_link; /* Create hard or soft link? */ + H5L_info2_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */ + void *vol_obj_file = NULL; /* Object of file_id */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ + unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ + int token_cmp; + herr_t ret; /* Generic return value */ /* Loop over creating hard or soft links */ for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { @@ -10857,6 +14835,12 @@ link_info_by_idx_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Need the file struct to address encoding */ + /* Retrieve VOL object */ + if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR + /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -10867,14 +14851,15 @@ link_info_by_idx_old(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10900,8 +14885,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in increasing order) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10915,8 +14901,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in native order - native is increasing) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10936,8 +14923,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in decreasing order) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10951,7 +14939,7 @@ link_info_by_idx_old(hid_t fapl) /* Check for creation order index queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -11003,7 +14991,7 @@ delete_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ @@ -11107,7 +15095,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != (u + 1)) TEST_ERROR } /* end if */ @@ -11163,7 +15151,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != (u + 1)) TEST_ERROR } /* end if */ @@ -11222,7 +15210,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for current link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != ((u * 2) + 1)) TEST_ERROR } /* end if */ @@ -11247,7 +15235,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != ((u * 2) + 3)) TEST_ERROR } /* end if */ @@ -11311,16 +15299,19 @@ error: static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = -1; /* File ID */ - hid_t group_id = -1, group_id2 = -1; /* Group IDs */ - H5L_info_t linfo; /* Link info struct */ - H5_iter_order_t order; /* Order within in the index */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE];/* File name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ - char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5F_t *f = NULL; + H5L_info2_t linfo; /* Link info struct */ + H5_iter_order_t order; /* Order within in the index */ + void *vol_obj_file = NULL; /* Object of file_id */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + int token_cmp; + herr_t ret; /* Generic return value */ /* Loop over operating in different orders */ for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { @@ -11334,6 +15325,12 @@ delete_by_idx_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Need the file struct to address encoding */ + /* Retrieve VOL object */ + if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR + /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11347,7 +15344,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11355,9 +15352,10 @@ delete_by_idx_old(hid_t fapl) /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -11384,12 +15382,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u + 1], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for first link in appropriate order */ @@ -11418,7 +15418,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11426,9 +15426,10 @@ delete_by_idx_old(hid_t fapl) /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -11443,12 +15444,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for current link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 1], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for current link in appropriate order */ @@ -11470,12 +15473,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 3], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for first link in appropriate order */ @@ -11525,22 +15530,24 @@ error: *------------------------------------------------------------------------- */ static int -link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, +link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info2_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ - if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0) return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { + int token_cmp; + /* Check for correct order of iteration */ /* (if we are operating in increasing or decreasing order) */ if(op_data->order != H5_ITER_NATIVE) @@ -11556,7 +15563,9 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, return H5_ITER_ERROR; if(info->cset != my_info.cset) return H5_ITER_ERROR; - if(H5F_addr_ne(info->u.address, my_info.u.address)) + if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0) + return H5_ITER_ERROR; + if(token_cmp) return H5_ITER_ERROR; } /* end if */ @@ -11618,7 +15627,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, - const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) + const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { return H5_ITER_ERROR; } /* end link_iterate_fail_cb() */ @@ -11651,7 +15660,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -11681,7 +15690,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -11743,7 +15752,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR + if((ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -11763,7 +15772,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11881,7 +15890,7 @@ link_iterate(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR + if(H5Literate2(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -11901,7 +15910,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on compact group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11926,7 +15935,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on dense group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11979,21 +15988,23 @@ error: *------------------------------------------------------------------------- */ static int -link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data) +link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info2_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ - if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0) return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { + int token_cmp; + /* Compare link info structs */ if(info->type != my_info.type) return H5_ITER_ERROR; @@ -12003,7 +16014,9 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf return H5_ITER_ERROR; if(info->cset != my_info.cset) return H5_ITER_ERROR; - if(H5F_addr_ne(info->u.address, my_info.u.address)) + if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0) + return H5_ITER_ERROR; + if(token_cmp) return H5_ITER_ERROR; } /* end if */ @@ -12079,7 +16092,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -12109,7 +16122,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -12171,7 +16184,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR + if((ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -12191,14 +16204,14 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for iteration w/bad location ID */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12268,7 +16281,7 @@ link_iterate_old(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR + if(H5Literate2(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { @@ -12288,7 +16301,7 @@ link_iterate_old(hid_t fapl) /* Check for out of bound iteration on old-style group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12296,7 +16309,7 @@ link_iterate_old(hid_t fapl) /* (should fail) */ skip = (hsize_t)0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12343,15 +16356,16 @@ error: */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ hid_t group_id = -1; /* ID of group to test */ - H5O_info_t oi; /* Buffer for querying object's info */ - haddr_t mnt_root_addr; /* Address of root group in file to mount */ + H5O_info2_t oi; /* Buffer for querying object's info */ + H5O_token_t mnt_root_token; /* Token (address) of root group in file to mount */ hid_t obj_id; /* ID of object opened */ unsigned mnt_idx; /* Index to mount group on */ unsigned u, v; /* Local index variables */ + int token_cmp; /* Work through main & soft link groups */ for(v = 0; v < 2; v++) { @@ -12367,16 +16381,18 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { - if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else if(order == H5_ITER_DEC) { unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { /* XXX: What to do about native order? */ @@ -12390,8 +16406,9 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Verify opening correct object by index when file mounting is present */ /* Get the address of the root group in the file to mount */ - if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - mnt_root_addr = oi.addr; + if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) + TEST_ERROR + HDmemcpy(&mnt_root_token, &oi.token, sizeof(mnt_root_token)); /* Mount a file over a group in main group */ mnt_idx = 2; @@ -12402,11 +16419,13 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the root of the mounted file and not in the previous file */ - if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR - if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &mnt_root_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[mnt_idx], &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR /* Close object */ if(H5Oclose(obj_id) < 0) TEST_ERROR @@ -12445,11 +16464,11 @@ open_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ - haddr_t *objno = NULL; /* Addresses of the objects created */ + H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -12459,8 +16478,8 @@ open_by_idx(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object token array */ + if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR /* Create file to mount */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); @@ -12546,8 +16565,8 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12555,7 +16574,7 @@ open_by_idx(hid_t fapl) /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + } /* Verify state of group (compact) */ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR @@ -12580,8 +16599,8 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12645,6 +16664,100 @@ error: /*------------------------------------------------------------------------- + * Function: open_by_idx_check_old + * + * Purpose: Check opening by index in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +open_by_idx_check_old(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) +{ + char mntname[NAME_BUF_SIZE]; /* Link value */ + hid_t group_id = -1; /* ID of group to test */ + H5O_info2_t oi; /* Buffer for querying object's info */ + H5O_token_t mnt_root_token; /* Token of root group in file to mount */ + hid_t obj_id; /* ID of object opened */ + unsigned mnt_idx; /* Index to mount group on */ + unsigned u, v; /* Local index variables */ + int cmp_value; /* Token comparison value */ + + /* Work through main & soft link groups */ + for(v = 0; v < 2; v++) { + /* Choose appropriate group to open links within */ + if(0 == v) + group_id = main_group_id; + else + group_id = soft_group_id; + + /* Open each object in main group by index and check that it's the correct one */ + for(u = 0; u < max_links; u++) { + /* Open the object */ + if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get the object's information */ + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5Otoken_cmp(group_id, &oi.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + + if(H5Otoken_cmp(group_id, &oi.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + } /* end if */ + else { + /* XXX: What to do about native order? */ + } /* end else */ + + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR + } /* end for */ + } /* end for */ + + /* Verify opening correct object by index when file mounting is present */ + + /* Get the address of the root group in the file to mount */ + if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + mnt_root_token = oi.token; + + /* Mount a file over a group in main group */ + mnt_idx = 2; + HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); + if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open the object that the file is mounted on */ + if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get the object's information */ + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + /* Check that the object is the root of the mounted file and not in the previous file */ + if(H5Otoken_cmp(group_id, &oi.token, &mnt_root_token, &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(H5Otoken_cmp(group_id, &oi.token, &objno[mnt_idx], &cmp_value) < 0) TEST_ERROR + if(0 == cmp_value) TEST_ERROR + + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR + + /* Unmount the file */ + if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end open_by_idx_check_old() */ + +/*------------------------------------------------------------------------- * Function: open_by_idx_old * * Purpose: Create an old-style group and test opening @@ -12662,11 +16775,11 @@ open_by_idx_old(hid_t fapl) hid_t group_id = -1; /* Group ID */ hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -12716,8 +16829,8 @@ open_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12743,7 +16856,7 @@ open_by_idx_old(hid_t fapl) if(ret >= 0) TEST_ERROR /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + if(open_by_idx_check_old(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -12784,12 +16897,13 @@ error: */ static int object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, - H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ hid_t group_id = -1; /* ID of group to test */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ unsigned u, v; /* Local index variables */ + int token_cmp; /* Work through main & soft link groups */ for(v = 0; v < 2; v++) { @@ -12805,25 +16919,28 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Query the object's information, by name */ - if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR /* Query the object's information, by index */ - if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR } /* end if */ else if(order == H5_ITER_DEC) { unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != dec_u) TEST_ERROR } /* end if */ else { /* XXX: What to do about native order? */ @@ -12863,12 +16980,12 @@ object_info(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ - haddr_t *objno = NULL; /* Addresses of the objects created */ + H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -12878,8 +16995,8 @@ object_info(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object token array */ + if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR /* Create dataspace for attributes */ if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR @@ -12950,7 +17067,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12966,8 +17083,8 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -12994,7 +17111,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13014,8 +17131,8 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -13042,7 +17159,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13088,6 +17205,77 @@ error: /*------------------------------------------------------------------------- + * Function: object_info_check_old + * + * Purpose: Check querying object info in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +object_info_check_old(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, + H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) +{ + char objname[NAME_BUF_SIZE]; /* Object name */ + hid_t group_id = -1; /* ID of group to test */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ + unsigned u, v; /* Local index variables */ + + /* Work through main & soft link groups */ + for(v = 0; v < 2; v++) { + /* Choose appropriate group to open links within */ + if(0 == v) + group_id = main_group_id; + else + group_id = soft_group_id; + + /* Open each object in group by name and check that it's the correct one */ + for(u = 0; u < max_links; u++) { + int cmp_value; /* Token comparison value */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Query the object's information, by name */ + if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR + + /* Query the object's information, by index */ + if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR + } + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != dec_u) TEST_ERROR + } + else { + /* XXX: What to do about native order? */ + } + + } /* end for */ + } /* end for */ + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end object_info_check_old() */ + +/*------------------------------------------------------------------------- * Function: object_info_old * * Purpose: Create an old-style group test querying object info. @@ -13104,12 +17292,12 @@ object_info_old(hid_t fapl) hid_t soft_group_id = -1; /* Group ID for soft links */ hid_t space_id = -1; /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -13143,7 +17331,7 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13159,8 +17347,8 @@ object_info_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -13187,18 +17375,18 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for creation order index query */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + if(object_info_check_old(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -13867,7 +18055,8 @@ timestamps(hid_t fapl) hid_t group_id2 = -1; /* Group ID */ hid_t gcpl_id = -1; /* Group creation property list ID */ hid_t gcpl_id2 = -1; /* Group creation property list ID */ - H5O_info_t oinfo, oinfo2; /* Object info for groups created */ + H5O_info2_t oinfo, oinfo2; /* Object info for groups created */ + H5O_native_info_t ninfo, ninfo2; /* Native info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -13916,10 +18105,15 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + /* Generic info */ + if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR + if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR + /* Native file format info */ + if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ + /* Generic info */ if(oinfo.atime != 0) TEST_ERROR if(oinfo.mtime != 0) TEST_ERROR if(oinfo.ctime != 0) TEST_ERROR @@ -13928,10 +18122,11 @@ timestamps(hid_t fapl) if(oinfo.mtime == oinfo2.mtime) TEST_ERROR if(oinfo.ctime == oinfo2.ctime) TEST_ERROR if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + /* Native file format info */ + if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR + if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR /* Close the property lists */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR @@ -13962,10 +18157,14 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR + if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR + /* Native file format info */ + if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ + /* Generic info */ if(oinfo.atime != 0) TEST_ERROR if(oinfo.mtime != 0) TEST_ERROR if(oinfo.ctime != 0) TEST_ERROR @@ -13974,10 +18173,11 @@ timestamps(hid_t fapl) if(oinfo.mtime == oinfo2.mtime) TEST_ERROR if(oinfo.ctime == oinfo2.ctime) TEST_ERROR if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + /* Native file format info */ + if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR + if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR /* Close the property lists */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR @@ -14065,6 +18265,9 @@ main(void) /* General tests... (on both old & new format groups */ nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += cklinks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; @@ -14072,13 +18275,18 @@ main(void) /* Test new H5L link creation routine */ nerrors += test_lcpl(my_fapl, new_format); +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += test_lcpl_deprec(my_fapl, new_format); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += test_move(my_fapl, new_format); nerrors += test_copy(my_fapl, new_format); nerrors += test_move_preserves(my_fapl, new_format); #ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += test_move_preserves_deprec(my_fapl, new_format); nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + /* tests for external link */ /* Test external file cache first, so it sees the default efc setting on the fapl */ @@ -14106,6 +18314,9 @@ main(void) } /* end else */ nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; @@ -14113,11 +18324,17 @@ main(void) nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_endian(new_format) < 0 ? 1 : 0; nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; @@ -14156,14 +18373,29 @@ main(void) * above has already been tested for UD links. */ if(new_format == TRUE) { - nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_hard_links_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_link_reregister_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_callbacks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += lapl_nlinks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += linkinfo_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Misc. extra tests, useful for both new & old format files */ nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; @@ -14187,12 +18419,27 @@ main(void) * correct. */ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += corder_create_compact_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += corder_create_dense_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += corder_transition(fapl2) < 0 ? 1 : 0; nerrors += corder_delete(fapl2) < 0 ? 1 : 0; nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_info_by_idx_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += delete_by_idx_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += link_iterate(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_iterate_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; nerrors += object_info(fapl2) < 0 ? 1 : 0; nerrors += group_info(fapl2) < 0 ? 1 : 0; @@ -14200,8 +18447,17 @@ main(void) /* Test new API calls on old-style groups */ nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_info_by_idx_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += delete_by_idx_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_iterate_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; nerrors += object_info_old(fapl) < 0 ? 1 : 0; nerrors += group_info_old(fapl) < 0 ? 1 : 0; diff --git a/test/mount.c b/test/mount.c index 72973ad..3abe084 100644 --- a/test/mount.c +++ b/test/mount.c @@ -400,8 +400,9 @@ static int test_hide(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; char filename1[1024], filename2[1024]; + hbool_t same_obj; TESTING("name hiding under mount point"); h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1)); @@ -412,7 +413,7 @@ test_hide(hid_t fapl) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Build the virtual file */ @@ -427,19 +428,32 @@ test_hide(hid_t fapl) H5_FAILED(); HDputs(" Name is still accessible under mount point."); TEST_ERROR - } /* end if */ + } /* * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { + + same_obj = TRUE; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0) + FAIL_STACK_ERROR + if(token_cmp) + same_obj = FALSE; + } + else + same_obj = FALSE; + + if(!same_obj) { H5_FAILED(); HDputs(" Hard link failed for hidden object."); TEST_ERROR - } /* end if */ + } /* Unmount and close objects */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -480,8 +494,9 @@ static int test_assoc(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; char filename1[1024], filename2[1024]; + hbool_t same_obj; TESTING("mount point open"); h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); @@ -493,7 +508,7 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Create the virtual file */ @@ -504,11 +519,23 @@ test_assoc(hid_t fapl) * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { - H5_FAILED(); + same_obj = TRUE; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0) + FAIL_STACK_ERROR + if(token_cmp) + same_obj = FALSE; + } + else + same_obj = FALSE; + + if(!same_obj) { + H5_FAILED(); HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -676,7 +703,7 @@ static int test_preopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("preopening objects under the mount point"); @@ -694,7 +721,7 @@ test_preopen(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -738,7 +765,7 @@ test_postopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("open object access after unmount"); @@ -758,10 +785,10 @@ test_postopen(hid_t fapl) if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Try accessing it from the file */ - if(H5Oget_info_by_name2(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Gclose(grp) < 0) FAIL_STACK_ERROR @@ -803,7 +830,7 @@ static int test_unlink(hid_t fapl) { hid_t file1 = -1, file2 = -1, mnt = -1, root = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; herr_t status; @@ -831,12 +858,12 @@ test_unlink(hid_t fapl) * before the H5Fmount() and thus refers to the mount point itself rather * than the group mounted there. */ - if(H5Oget_info_by_name2(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -851,9 +878,9 @@ test_unlink(hid_t fapl) * We should still be able to get to "/file2" of file2 by starting at * `root' which is still open, but not by name. */ - if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -861,7 +888,7 @@ test_unlink(hid_t fapl) TEST_ERROR } /* end if */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -932,7 +959,7 @@ static int test_mvmpt(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("mount point renaming"); @@ -949,7 +976,7 @@ test_mvmpt(hid_t fapl) if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access something under the new name */ - if(H5Oget_info_by_name2(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR @@ -1094,7 +1121,7 @@ static int test_uniformity(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle uniformity"); @@ -1108,18 +1135,18 @@ test_uniformity(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access some things from the file1 handle */ - if(H5Oget_info_by_name2(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access the same things from the file2 handle */ - if(H5Oget_info_by_name2(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -1158,7 +1185,7 @@ static int test_close(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle close"); @@ -1176,7 +1203,7 @@ test_close(hid_t fapl) * still accessible through the file2 handle. */ if(H5Fclose(file1) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); HDputs(" File1 contents are not accessible!"); TEST_ERROR @@ -1197,7 +1224,7 @@ test_close(hid_t fapl) * Close file2. It is not actually closed because it's a child of file1. */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Fclose(file1) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ @@ -2432,7 +2459,7 @@ test_fcdegree_strong(hid_t fapl) hid_t fid1 = -1, fid2 = -1; /* File IDs */ hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */ hid_t fapl_id = -1; /* FAPL IDs */ - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; /* Name of files to mount */ herr_t ret; /* Generic return value */ @@ -2501,9 +2528,9 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Check that objects are still open */ - if(H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Close file #2 (should close open objects also) */ @@ -2512,12 +2539,12 @@ test_fcdegree_strong(hid_t fapl) /* Check that objects are closed */ H5E_BEGIN_TRY { - ret = H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/mtime.c b/test/mtime.c index 06f576b..81a20db 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -60,9 +60,10 @@ main(void) hsize_t size[1] = {2}; time_t now; struct tm *tm; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; signed char buf1[32], buf2[32]; char filename[1024]; + int token_cmp; h5_reset(); fapl = h5_fileaccess(); @@ -88,14 +89,15 @@ main(void) */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; - if(H5Oget_info_by_name2(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; + if(H5Oget_info_by_name3(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Oget_info2(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR; + if(H5Oget_info3(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR; + if(H5Otoken_cmp(file, &oi1.token, &oi2.token, &token_cmp) < 0)TEST_ERROR; if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; - /* Compare addresses & times from the two ways of calling H5Oget_info() */ - if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) { + /* Compare object tokens & times from the two ways of calling H5Oget_info() */ + if(token_cmp || oi1.ctime != oi2.ctime) { H5_FAILED(); HDputs(" Calling H5Oget_info() with the dataset ID returned"); HDputs(" different values than calling it with a file and dataset"); @@ -132,7 +134,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name2(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi1.ctime != MTIME1) { H5_FAILED(); @@ -162,7 +164,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name2(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi2.ctime != MTIME2) { H5_FAILED(); diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 985b576..ef76fe6 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -126,6 +126,11 @@ static const H5VL_class_t null_vol_g = { NULL, /* specific */ NULL /* optional */ }, + { /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ + }, NULL /* optional */ }; diff --git a/test/objcopy.c b/test/objcopy.c index cabdbfd..5174700 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -168,7 +168,7 @@ unsigned num_attributes_g; /* Number of attributes created */ static struct { size_t nalloc; /* number of slots allocated */ size_t nobjs; /* number of objects */ - haddr_t *obj; /* Addresses of objects seen */ + H5O_token_t *obj; /* Tokens of objects seen */ } idtab_g; /* Local function prototypes */ @@ -191,9 +191,9 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2); /*------------------------------------------------------------------------- - * Function: addr_insert + * Function: token_insert * - * Purpose: Add an address to the table. + * Purpose: Add a token to the table. * * Return: void * @@ -203,7 +203,7 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2); *------------------------------------------------------------------------- */ static void -addr_insert(H5O_info_t *oi) +token_insert(H5O_info2_t *oi) { size_t n; @@ -215,19 +215,19 @@ addr_insert(H5O_info_t *oi) /* Extend the table */ if(idtab_g.nobjs >= idtab_g.nalloc) { idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); - idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); + idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); } /* end if */ /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = oi->addr; -} /* end addr_insert() */ + idtab_g.obj[n] = oi->token; +} /* end token_insert() */ /*------------------------------------------------------------------------- - * Function: addr_lookup + * Function: token_lookup * - * Purpose: Check if address has already been encountered + * Purpose: Check if a token has already been encountered * * Return: Success: TRUE/FALSE * Failure: (can't fail) @@ -238,24 +238,28 @@ addr_insert(H5O_info_t *oi) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hbool_t -addr_lookup(H5O_info_t *oi) +token_lookup(hid_t loc_id, H5O_info2_t *oi) { - size_t n; + size_t n; + int token_cmp; if(oi->rc < 2) return FALSE; /*only one link possible*/ - for(n = 0; n < idtab_g.nobjs; n++) - if(H5F_addr_eq(idtab_g.obj[n], oi->addr)) + for(n = 0; n < idtab_g.nobjs; n++) { + if(H5Otoken_cmp(loc_id, &idtab_g.obj[n], &oi->token, &token_cmp) < 0) + return FALSE; + if(!token_cmp) return TRUE; + } return FALSE; -} /* end addr_lookup() */ +} /* end token_lookup() */ /*------------------------------------------------------------------------- - * Function: addr_reset + * Function: token_reset * - * Purpose: Reset the address tracking data structures + * Purpose: Reset the token tracking data structures * * Return: void * @@ -265,13 +269,13 @@ addr_lookup(H5O_info_t *oi) *------------------------------------------------------------------------- */ static void -addr_reset(void) +token_reset(void) { if(idtab_g.obj) HDfree(idtab_g.obj); idtab_g.obj = NULL; idtab_g.nalloc = idtab_g.nobjs = 0; -} /* end addr_reset() */ +} /* end token_reset() */ /*------------------------------------------------------------------------- @@ -852,7 +856,7 @@ static int compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) { hid_t aid = -1, aid2 = -1; /* Attribute IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info */ + H5O_info2_t oinfo1, oinfo2; /* Object info */ unsigned cpy_flags; /* Object copy flags */ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */ @@ -863,10 +867,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) cpy_flags = 0; /* Check the number of attributes on source dataset */ - if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR /* Check the number of attributes on destination dataset */ - if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) { /* Check that the destination has no attributes */ @@ -1055,11 +1059,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1116,11 +1122,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1273,7 +1281,7 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) /* Check that the space used is the same */ /* (Don't check if the dataset is filtered (i.e. compressed, etc.) and - * the datatype is VLEN, since the addresses for the vlen + * the datatype is VLEN, since the tokens for the vlen * data in each dataset will (probably) be different and the storage * size will thus vary) */ @@ -1394,8 +1402,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(ginfo2.nlinks > 0) { char objname[NAME_BUF_SIZE]; /* Name of object in group */ char objname2[NAME_BUF_SIZE]; /* Name of object in group */ - H5L_info_t linfo; /* Link information */ - H5L_info_t linfo2; /* Link information */ + H5L_info2_t linfo; /* Link information */ + H5L_info2_t linfo2; /* Link information */ /* Loop over contents of groups */ for(idx = 0; idx < ginfo.nlinks; idx++) { @@ -1405,18 +1413,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(HDstrcmp(objname, objname2)) TEST_ERROR /* Get link info */ - if(H5Lget_info(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != linfo2.type) TEST_ERROR /* Extra checks for "real" objects */ if(linfo.type == H5L_TYPE_HARD) { - hid_t oid, oid2; /* IDs of objects within group */ - H5O_info_t oinfo, oinfo2; /* Object info */ + hid_t oid, oid2; /* IDs of objects within group */ + H5O_info2_t oinfo, oinfo2; /* Data model object info */ + H5O_native_info_t ninfo, ninfo2; /* Native file format object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + /* Get data model object info */ + if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get native object info */ + if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1427,17 +1441,17 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) * of messages hasn't increased. */ if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) { - if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs) + if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs) ; else - if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR + if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) TEST_ERROR } /* Check for object already having been compared */ - if(addr_lookup(&oinfo)) + if(token_lookup(gid, &oinfo)) continue; else - addr_insert(&oinfo); + token_insert(&oinfo); /* Open objects */ if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1580,8 +1594,8 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1605,7 +1619,7 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1673,8 +1687,8 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1698,7 +1712,7 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1766,8 +1780,8 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1797,7 +1811,7 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1861,10 +1875,11 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t aid = -1; /* Attribute ID */ hid_t sid = -1; /* Dataspace ID */ hsize_t dims[2] = {3, 4}; /* Dataspace dimensions */ - H5O_info_t oinfo, oinfo2; /* Object info */ + H5O_info2_t oinfo, oinfo2; /* Object info */ H5G_info_t ginfo; /* Group info */ - char src_filename[NAME_BUF_SIZE]; - char dst_filename[NAME_BUF_SIZE]; + hbool_t same_type; + char src_filename[NAME_BUF_SIZE]; + char dst_filename[NAME_BUF_SIZE]; TESTING("H5Ocopy(): named datatype with self-referential attribute"); @@ -1872,8 +1887,8 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1912,7 +1927,7 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1939,10 +1954,20 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* verify that the attribute's datatype is committed */ if(H5Tcommitted(tid) != TRUE) TEST_ERROR - /* verify that the addresses of the datatypes are the same */ - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.fileno != oinfo2.fileno || oinfo.addr != oinfo2.addr) + /* verify that the tokens of the datatypes are the same */ + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + + same_type = TRUE; + if(oinfo.fileno == oinfo2.fileno) { + int token_cmp; + if(H5Otoken_cmp(tid2, &oinfo.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) same_type = FALSE; + } + else + same_type = FALSE; + + if(!same_type) FAIL_PUTS_ERROR("destination attribute does not use the same committed datatype") /* Verify that there are only 2 links int he destination root group */ @@ -2015,8 +2040,8 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2053,7 +2078,7 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2144,8 +2169,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname); h5_fixname(FILENAME[5], fapl_dst, dst_fname, sizeof dst_fname); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ fid_src = H5Fcreate(src_fname, H5F_ACC_TRUNC, fcpl_src, fapl_src); @@ -2202,7 +2227,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) fid_dst = H5Fcreate(dst_fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_dst); if (fid_dst < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -2306,8 +2331,8 @@ test_copy_dataset_simple_samefile(hid_t fcpl, hid_t fapl) /* Initialize the filenames */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR @@ -2413,8 +2438,8 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2451,7 +2476,7 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2537,8 +2562,8 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2582,7 +2607,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2669,8 +2694,8 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2867,7 +2892,7 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3072,8 +3097,8 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3265,7 +3290,7 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3482,8 +3507,8 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3640,7 +3665,7 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3795,8 +3820,8 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3942,7 +3967,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4129,8 +4154,8 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4180,7 +4205,7 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4276,8 +4301,8 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4323,7 +4348,7 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4408,8 +4433,8 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4450,7 +4475,7 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4530,8 +4555,8 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4571,7 +4596,7 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4652,8 +4677,8 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4708,7 +4733,7 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4791,8 +4816,8 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4847,7 +4872,7 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4936,8 +4961,8 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4991,7 +5016,7 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5078,8 +5103,8 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5137,7 +5162,7 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5224,8 +5249,8 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5258,7 +5283,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5362,8 +5387,8 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5417,7 +5442,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5545,8 +5570,8 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5586,7 +5611,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5677,8 +5702,8 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5712,7 +5737,7 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5970,8 +5995,8 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -6026,7 +6051,7 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) FAIL_STACK_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -6152,8 +6177,8 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6195,7 +6220,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -6285,8 +6310,8 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6310,7 +6335,7 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6389,8 +6414,8 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6438,7 +6463,7 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6520,8 +6545,8 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6570,7 +6595,7 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6653,8 +6678,8 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6712,7 +6737,7 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6784,8 +6809,8 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6823,7 +6848,7 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6901,8 +6926,8 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6952,7 +6977,7 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -7018,7 +7043,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ hid_t plid = -1; /* Object copy plist ID */ hsize_t dim2d[2]; hsize_t dim1d[1]; - H5L_info_t linfo; + H5L_info2_t linfo; int buf[DIM_SIZE_1][DIM_SIZE_2]; int i, j; unsigned expand_soft; @@ -7040,8 +7065,8 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7135,7 +7160,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -7152,7 +7177,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ * re-add it as a soft link so compare_groups() works */ if(expand_soft) { /* Check link type */ - if(H5Lget_info(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != H5L_TYPE_HARD) FAIL_PUTS_ERROR("Soft link was not expanded to a hard link") @@ -7175,7 +7200,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ * and re-add it as an external link so compare_groups() works */ if(expand_ext) { /* Check link type */ - if(H5Lget_info(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != H5L_TYPE_HARD) FAIL_PUTS_ERROR("External link was not expanded to a hard link") @@ -7295,8 +7320,8 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7341,7 +7366,7 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7425,8 +7450,8 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7474,7 +7499,7 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7558,8 +7583,8 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7596,7 +7621,7 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7667,8 +7692,8 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7705,7 +7730,7 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST (should fail - intermediate groups not there) */ @@ -7789,8 +7814,8 @@ test_copy_same_file_named_datatype(hid_t fcpl_src, hid_t fapl) /* Initialize the filenames */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR @@ -7868,8 +7893,8 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* Initialize the destination filename */ h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Setup */ if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR @@ -7883,7 +7908,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(test_open) { @@ -7975,8 +8000,8 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8025,7 +8050,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8129,8 +8154,8 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8172,7 +8197,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8284,8 +8309,8 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8337,7 +8362,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8445,8 +8470,8 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8496,7 +8521,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8615,8 +8640,8 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8659,7 +8684,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8785,8 +8810,8 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8830,7 +8855,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8951,8 +8976,8 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9159,8 +9184,8 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9326,8 +9351,8 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9364,7 +9389,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9472,8 +9497,8 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9517,7 +9542,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9625,8 +9650,8 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9670,7 +9695,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9776,8 +9801,8 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename); h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -9945,8 +9970,8 @@ test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename); h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -10107,8 +10132,8 @@ test_copy_attr_crt_order(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -10225,11 +10250,12 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src1_filename[NAME_BUF_SIZE]; char src2_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) { TESTING("H5Ocopy(): merging committed datatypes with reopen") @@ -10246,8 +10272,8 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[3], src_fapl, src2_filename, sizeof src2_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source files */ if((fid_src1 = H5Fcreate(src1_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -10323,7 +10349,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy SRC1 to DST */ @@ -10338,31 +10364,34 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open SRC1 committed dtype, get address */ + /* Open SRC1 committed dtype, get token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open SRC1 dset dtype, check address */ + /* Open SRC1 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open SRC2 committed dtype, check address */ + /* Open SRC2 committed dtype, check token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open SRC2 dset dtype, check address */ + /* Open SRC2 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10376,7 +10405,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* recreate destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy SRC1 to DST */ @@ -10391,19 +10420,20 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open SRC1 dset dtype, get address */ + /* Open SRC1 dset dtype, get token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open SRC2 dset dtype, check address */ + /* Open SRC2 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10463,9 +10493,10 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes to the source file with reopen") @@ -10479,8 +10510,8 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Initialize the filename */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR @@ -10553,7 +10584,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* * First copy each group to the destination group 3 (each with their own * group), and verify the committed datatypes are merged as expected. All - * datatypes copied should reference (share an address with) the + * datatypes copied should reference (share a token with) the * corresponding source datatype. */ /* Create destination group */ @@ -10572,61 +10603,68 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } /* end if */ - /* Open group 1 source committed dtype, get address */ + /* Open group 1 source committed dtype, get token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 1 source dset dtype, check address */ + /* Open group 1 source dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 1 committed dtype, check address */ + /* Open group 1 committed dtype, check token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 1 dset dtype, check address */ + /* Open group 1 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 source committed dtype, get address and make sure it is + /* Open group 2 source committed dtype, get token and make sure it is * different from group 1 source committed dtype */ if((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 2 source dset dtype, check address */ + /* Open group 2 source dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 committed dtype, check address */ + /* Open group 2 committed dtype, check token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 2 dset dtype, check address */ + /* Open group 2 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10650,37 +10688,40 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR } /* end if */ - /* Open group 1 source dset dtype, get address */ + /* Open group 1 source dset dtype, get token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 1 dset dtype, check address */ + /* Open group 1 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 source dset dtype, get address and make sure it is + /* Open group 2 source dset dtype, get token and make sure it is * different from group 1 source dset dtype */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 dset dtype, check address */ + /* Open group 2 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10736,10 +10777,11 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen") @@ -10754,8 +10796,8 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -10844,17 +10886,18 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10882,31 +10925,33 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset 2 dtype, check address */ + /* Open dset 2 dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10967,10 +11012,11 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with attributes and reopen") @@ -10985,8 +11031,8 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -11078,19 +11124,20 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open attribute dtype, get address */ + /* Open attribute dtype, get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11198,10 +11245,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d int i; /* Local index variable */ hsize_t dim1d[1]; /* dimension sizes */ int buf[DIM_SIZE_1]; /* Buffer for data */ - haddr_t exp_addr_int, exp_addr_short; /* Expected object addresses */ - H5O_info_t oinfo; /* Object info */ + H5O_token_t exp_token_int, exp_token_short; /* Expected object tokenes */ + H5O_info2_t oinfo; /* Object info */ char src_filename[NAME_BUF_SIZE]; /* Source file name */ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): hier. of committed datatypes and merging with reopen") @@ -11216,8 +11264,8 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11338,16 +11386,16 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d */ if(H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* get address of committed datatype at root group */ + /* get token of committed datatype at root group */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr_int = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token_int, &oinfo.token, sizeof(exp_token_int)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype at /g0 */ + /* get token of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr_short = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token_short, &oinfo.token, sizeof(exp_token_short)); if(H5Tclose(tid) < 0) TEST_ERROR /* verify the datatype of first dataset is not committed */ @@ -11357,19 +11405,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11378,10 +11428,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d */ if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* get address of committed datatype at /g0 */ + /* get token of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* verify the datatype of first dataset is not committed */ @@ -11391,19 +11442,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11414,19 +11467,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET2, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET3, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* Open attribute with anon ndt (short), get address */ + /* Open attribute with anon ndt (short), get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR - /* Open attribute with anon ndt (int), get address */ + /* Open attribute with anon ndt (int), get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11437,19 +11492,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11522,10 +11579,11 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds hid_t aid = -1; /* Attribute ID */ hid_t ocpypl_id = -1; /* Object copy plist ID */ hsize_t dim1d[1]; /* dimension sizes */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object addresses */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; /* Source file name */ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging various committed datatypes with reopen") @@ -11536,8 +11594,8 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11649,53 +11707,57 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds /* * Verification */ - /* get address of committed datatype: /src_root/src_ndt_double */ + /* get token of committed datatype: /src_root/src_ndt_double */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_double */ + /* get token of committed datatype: /dst_ndt_double */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_float */ + /* get token of committed datatype: /src_root/src_ndt_float */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_float */ + /* get token of committed datatype: /dst_ndt_float */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_int */ + /* get token of committed datatype: /src_root/src_ndt_int */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_int */ + /* get token of committed datatype: /dst_ndt_int */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_short */ + /* get token of committed datatype: /src_root/src_ndt_short */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* open attribute; get its dtype; get dtype's address: /src_root/src_ndt_double/dst_attr */ + /* open attribute; get its dtype; get dtype's token: /src_root/src_ndt_double/dst_attr */ if((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11748,10 +11810,11 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ hid_t ocpypl_id = -1; /* Object copy plist ID */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen") @@ -11762,8 +11825,8 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11823,16 +11886,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/dst_ndt_int", get its address */ + /* open committed dtype "/dst_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/uncopied/src_ndt_int" */ + /* check token of "/uncopied/src_ndt_int" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11856,16 +11920,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/uncopied/src_ndt_int", get its address */ + /* open committed dtype "/uncopied/src_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/src_ndt_int" */ + /* check token of "/src_ndt_int" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11894,16 +11959,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/uncopied/src_ndt_int", get its address */ + /* Open committed dtype "/uncopied/src_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/src_ndt_int2" */ + /* check token of "/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11928,16 +11994,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/dst_dt_int", get its address */ + /* Open committed dtype "/dst_dt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/uncopied/src_ndt_int2" */ + /* check token of "/uncopied/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11988,10 +12055,11 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes of datasets with suggestions and reopen") @@ -12006,8 +12074,8 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -12084,17 +12152,18 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/dst_ndt_int", get its address */ + /* Open committed dtype "/dst_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ + /* check token of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12119,19 +12188,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype address */ + /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/src_ndt_dset" */ + /* check token of datatype for the copied dataset: "/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12161,19 +12231,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open the copied dataset: /uncopied/src_ndt_dset", get its address */ + /* open the copied dataset: /uncopied/src_ndt_dset", get its token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/src_ndt_dset2" */ + /* check token of datatype for the copied dataset: "/src_ndt_dset2" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12199,19 +12270,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open the copied dataset: "/src_ndt_dset", get its datatype address */ + /* open the copied dataset: "/src_ndt_dset", get its datatype token */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ + /* check token of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12279,8 +12351,8 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -12544,7 +12616,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/dst_grp/dst_dt_int", get its address */ + /* open committed dtype "/dst_grp/dst_dt_int", get its token */ if((exp_tid = H5Topen2(fid_dst, "/" DST_GRP "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR /* open datatype of dataset */ @@ -12637,7 +12709,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((aid = H5Aopen_by_name(fid_dst, DST_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((exp_tid = H5Aget_type(aid)) < 0) TEST_ERROR - /* Open datatype of dataset, check address */ + /* Open datatype of dataset, check token */ if((did = H5Dopen2(fid_dst, "A_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR @@ -12674,7 +12746,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open committed dtype "/dst_ndt_short" */ if((exp_tid = H5Topen2(fid_dst, "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - /* open datatype of dataset, check address */ + /* open datatype of dataset, check token */ if((did = H5Dopen2(fid_dst, "B_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR @@ -12756,11 +12828,12 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; mcdt_search_cb_ud cb_udata; /* User data for callback */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): H5Pset_mcdt_search_cb and reopen") @@ -12775,8 +12848,8 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -12868,17 +12941,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12916,17 +12990,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open copied dataset and its dtype, check address */ + /* Open copied dataset and its dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12955,31 +13030,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13015,31 +13092,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13134,8 +13213,8 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13382,7 +13461,7 @@ error: */ static herr_t test_copy_iterate_cb(hid_t loc_id, const char *name, - const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) + const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { hid_t dst_loc_id = *((hid_t *)op_data); @@ -13411,8 +13490,8 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -13442,8 +13521,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl /* Iterate over links in the root group, copying each object */ if((gid = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, - &fid2) < 0) + if(H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, &fid2) < 0) TEST_ERROR /* Close */ @@ -13506,8 +13584,8 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13641,7 +13719,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13827,8 +13905,8 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13836,7 +13914,7 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Set dataspace dimensions */ @@ -14373,8 +14451,8 @@ main(void) */ } /* end for */ - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 4637f23..20c6138 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -72,9 +72,9 @@ unsigned num_attributes_g; /* Number of attributes created */ /* Table containing object id and object name */ /* (Used for detecting duplicate objects when comparing groups */ static struct { - size_t nalloc; /* number of slots allocated */ - size_t nobjs; /* number of objects */ - haddr_t *obj; /* Addresses of objects seen */ + size_t nalloc; /* number of slots allocated */ + size_t nobjs; /* number of objects */ + H5O_token_t *obj; /* tokens for objects seen */ } idtab_g; /* Local function prototypes */ @@ -87,9 +87,9 @@ static int compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags); /*------------------------------------------------------------------------- - * Function: addr_insert + * Function: token_insert * - * Purpose: Add an address to the table. + * Purpose: Add a token to the table. * * Return: void * @@ -99,31 +99,31 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) *------------------------------------------------------------------------- */ static void -addr_insert(H5O_info_t *oi) +token_insert(H5O_info2_t *oinfo) { size_t n; /* Don't add it if the link count is 1 because such an object can only * be encountered once. */ - if(oi->rc < 2) + if(oinfo->rc < 2) return; /* Extend the table */ if(idtab_g.nobjs >= idtab_g.nalloc) { - idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); - idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); - } /* end if */ + idtab_g.nalloc = MAX(256, 2 * idtab_g.nalloc); + idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); + } /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = oi->addr; -} /* end addr_insert() */ + idtab_g.obj[n] = oinfo->token; +} /* end token_insert() */ /*------------------------------------------------------------------------- - * Function: addr_lookup + * Function: token_lookup * - * Purpose: Check if address has already been encountered + * Purpose: Check if a token has already been encountered * * Return: Success: TRUE/FALSE * Failure: (can't fail) @@ -134,24 +134,29 @@ addr_insert(H5O_info_t *oi) *------------------------------------------------------------------------- */ static H5_ATTR_PURE hbool_t -addr_lookup(H5O_info_t *oi) +token_lookup(hid_t loc_id, H5O_info2_t *oinfo) { - size_t n; + size_t n; + int token_cmp; - if(oi->rc < 2) return FALSE; /*only one link possible*/ + if(oinfo->rc < 2) + return FALSE; /*only one link possible*/ - for(n = 0; n < idtab_g.nobjs; n++) - if(H5F_addr_eq(idtab_g.obj[n], oi->addr)) + for(n = 0; n < idtab_g.nobjs; n++) { + if(H5Otoken_cmp(loc_id, &(idtab_g.obj[n]), &oinfo->token, &token_cmp) < 0) + return FALSE; + if(0 == token_cmp) return TRUE; + } return FALSE; -} /* end addr_lookup() */ +} /* end token_lookup() */ /*------------------------------------------------------------------------- - * Function: addr_reset + * Function: token_reset * - * Purpose: Reset the address tracking data structures + * Purpose: Reset the token tracking data structures * * Return: void * @@ -161,13 +166,13 @@ addr_lookup(H5O_info_t *oi) *------------------------------------------------------------------------- */ static void -addr_reset(void) +token_reset(void) { if(idtab_g.obj) HDfree(idtab_g.obj); idtab_g.obj = NULL; idtab_g.nalloc = idtab_g.nobjs = 0; -} /* end addr_reset() */ +} /* end token_reset() */ /*------------------------------------------------------------------------- @@ -625,7 +630,7 @@ static int compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) { hid_t aid = -1, aid2 = -1; /* Attribute IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info */ + H5O_info2_t oinfo1, oinfo2; /* Object info */ unsigned cpy_flags; /* Object copy flags */ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */ @@ -636,10 +641,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) cpy_flags = 0; /* Check the number of attributes on source dataset */ - if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR /* Check the number of attributes on destination dataset */ - if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) { /* Check that the destination has no attributes */ @@ -808,11 +813,11 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* Check for object or region reference */ if(H5Tequal(tid, H5T_STD_REF) > 0) { - const H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ + H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ /* Loop over elements in buffers */ - ref_buf1 = (const H5R_ref_t *)buf1; - ref_buf2 = (const H5R_ref_t *)buf2; + ref_buf1 = (H5R_ref_t *)buf1; + ref_buf2 = (H5R_ref_t *)buf2; for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) { hid_t obj1_id, obj2_id; /* IDs for objects referenced */ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */ @@ -828,11 +833,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(0 == token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1110,8 +1117,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(ginfo2.nlinks > 0) { char objname[NAME_BUF_SIZE]; /* Name of object in group */ char objname2[NAME_BUF_SIZE]; /* Name of object in group */ - H5L_info_t linfo; /* Link information */ - H5L_info_t linfo2; /* Link information */ + H5L_info2_t linfo; /* Link information */ + H5L_info2_t linfo2; /* Link information */ /* Loop over contents of groups */ for(idx = 0; idx < ginfo.nlinks; idx++) { @@ -1121,18 +1128,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(HDstrcmp(objname, objname2)) TEST_ERROR /* Get link info */ - if(H5Lget_info(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != linfo2.type) TEST_ERROR /* Extra checks for "real" objects */ if(linfo.type == H5L_TYPE_HARD) { - hid_t oid, oid2; /* IDs of objects within group */ - H5O_info_t oinfo, oinfo2; /* Object info */ + hid_t oid, oid2; /* IDs of objects within group */ + H5O_info2_t oinfo, oinfo2; /* Data model object info */ + H5O_native_info_t ninfo, ninfo2; /* Native file format object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + /* Get data model object info */ + if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get native object info */ + if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1143,17 +1156,18 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) * of messages hasn't increased. */ if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) { - if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs) + if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs) ; else - if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR + if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) + TEST_ERROR } /* Check for object already having been compared */ - if(addr_lookup(&oinfo)) + if(token_lookup(gid, &oinfo)) continue; else - addr_insert(&oinfo); + token_insert(&oinfo); /* Open objects */ if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1269,8 +1283,8 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1404,7 +1418,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1636,8 +1650,8 @@ main(void) FALSE, "H5Ocopy(): expand object reference"); } /* end for */ - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/ohdr.c b/test/ohdr.c index 53d2f59..120935c 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -322,7 +322,7 @@ test_ohdr_swmr(hbool_t new_format) hsize_t dims[1]; /* Dimension sizes */ size_t u; /* Iterator */ int n; /* Data variable */ - H5O_info_t obj_info; /* Information for the object */ + H5O_native_info_t ninfo; /* Information for the object */ if(new_format) { TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format"); @@ -392,16 +392,16 @@ test_ohdr_swmr(hbool_t new_format) FAIL_STACK_ERROR /* Get the object information */ - if(H5Oget_info2(did, &obj_info, H5O_INFO_HDR) < 0) + if(H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR) < 0) FAIL_STACK_ERROR if(new_format) - if(obj_info.hdr.version != OBJ_VERSION_LATEST) + if(ninfo.hdr.version != OBJ_VERSION_LATEST) FAIL_STACK_ERROR /* The size of object header should be greater than the speculative read size of H5O_SPEC_READ_SIZE */ /* This will exercise the coding for the re-read of the object header for SWMR access */ - if(obj_info.hdr.space.total < H5O_SPEC_READ_SIZE) + if(ninfo.hdr.space.total < H5O_SPEC_READ_SIZE) TEST_ERROR; /* Close the dataset */ @@ -757,10 +757,10 @@ error: */ static int count_attributes(hid_t dset_id) -{ - H5O_info_t info; - - if(H5Oget_info2(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0) +{ + H5O_info2_t info; + + if(H5Oget_info3(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0) return -1; else return (int)info.num_attrs; /* should never exceed int bounds */ @@ -774,10 +774,13 @@ count_attributes(hid_t dset_id) static herr_t _oh_getsize(hid_t did, hsize_t *size_out) { - H5O_info_t info; - if(FAIL == H5Oget_info2(did, &info, H5O_INFO_HDR)) + H5O_native_info_t ninfo; + + if(FAIL == H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR)) return FAIL; - *size_out = info.hdr.space.total; + + *size_out = ninfo.hdr.space.total; + return SUCCEED; } /* _oh_getsize */ diff --git a/test/stab.c b/test/stab.c index 80c8b06..215d748 100644 --- a/test/stab.c +++ b/test/stab.c @@ -70,8 +70,10 @@ const char *FILENAME[] = { #define GCPL_ON_ROOT_MAX_COMPACT 4 #define GCPL_ON_ROOT_MIN_DENSE 2 +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Definitions for 'old_api' test */ #define OLD_API_GROUP "/old_api" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Definitions for 'corrupt_stab_msg' test */ #define CORRUPT_STAB_FILE "corrupt_stab_msg.h5" @@ -328,7 +330,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) unsigned est_num_entries; /* Estimated # of entries in group */ unsigned est_name_len; /* Estimated length of entry name */ unsigned nmsgs; /* Number of messages in group's header */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ @@ -419,11 +421,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != FALSE) TEST_ERROR /* Check that the object header is only one chunk and the space has been allocated correctly */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR - if(oinfo.hdr.space.total != 151) TEST_ERROR - if(oinfo.hdr.space.free != 0) TEST_ERROR - if(oinfo.hdr.nmesgs != 6) TEST_ERROR - if(oinfo.hdr.nchunks != 1) TEST_ERROR + if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(ninfo.hdr.space.total != 151) TEST_ERROR + if(ninfo.hdr.space.free != 0) TEST_ERROR + if(ninfo.hdr.nmesgs != 6) TEST_ERROR + if(ninfo.hdr.nchunks != 1) TEST_ERROR /* Create one more "bottom" group, which should push top group into using a symbol table */ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); @@ -441,11 +443,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Check that the object header is still one chunk and the space has been allocated correctly */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR - if(oinfo.hdr.space.total != 151) TEST_ERROR - if(oinfo.hdr.space.free != 92) TEST_ERROR - if(oinfo.hdr.nmesgs != 3) TEST_ERROR - if(oinfo.hdr.nchunks != 1) TEST_ERROR + if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(ninfo.hdr.space.total != 151) TEST_ERROR + if(ninfo.hdr.space.free != 92) TEST_ERROR + if(ninfo.hdr.nmesgs != 3) TEST_ERROR + if(ninfo.hdr.nchunks != 1) TEST_ERROR /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { diff --git a/test/tattr.c b/test/tattr.c index b89ec3f..bcd8698 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -20,6 +20,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5VLnative_private.h" /* * This file needs to access private information from the H5O package. @@ -427,7 +428,7 @@ test_attr_basic_read(hid_t fapl) hid_t dataset; /* Dataset ID */ hid_t group; /* Group ID */ hid_t attr; /* Attribute ID */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ int i, j; /* Local index variables */ @@ -445,9 +446,9 @@ test_attr_basic_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 2, "H5Oget_info3"); /* Open first attribute for the dataset */ attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT); @@ -474,9 +475,9 @@ test_attr_basic_read(hid_t fapl) CHECK(group, FAIL, "H5Gopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(group, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(group, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open the attribute for the group */ attr = H5Aopen(group, ATTR2_NAME, H5P_DEFAULT); @@ -811,7 +812,7 @@ test_attr_compound_read(hid_t fapl) hid_t field; /* Attribute field datatype */ struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int i, j; /* Local index variables */ herr_t ret; /* Generic return value */ @@ -827,9 +828,9 @@ test_attr_compound_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1016,7 +1017,7 @@ test_attr_scalar_read(hid_t fapl) hid_t attr; /* Attribute ID */ H5S_class_t stype; /* Dataspace class */ float rdata = 0.0F; /* Buffer for reading 1st attribute */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1031,9 +1032,9 @@ test_attr_scalar_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open an attribute for the dataset */ attr = H5Aopen(dataset, ATTR5_NAME, H5P_DEFAULT); @@ -1218,7 +1219,7 @@ test_attr_mult_read(hid_t fapl) int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int i, j, k; /* Local index values */ herr_t ret; /* Generic return value */ @@ -1234,9 +1235,9 @@ test_attr_mult_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1468,7 +1469,7 @@ test_attr_iterate(hid_t fapl) hid_t dataset; /* Dataset ID */ hid_t sid; /* Dataspace ID */ int count; /* operator data for the iterator */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1491,9 +1492,9 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info3"); /* Iterate over attributes on dataset */ count = 0; @@ -1509,9 +1510,9 @@ test_attr_iterate(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Iterate over attributes on dataset */ count = 0; @@ -1541,7 +1542,7 @@ test_attr_delete(hid_t fapl) hid_t attr; /* Attribute ID */ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1556,27 +1557,27 @@ test_attr_delete(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Try to delete bogus attribute */ ret = H5Adelete(dataset, "Bogus"); VERIFY(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Delete middle (2nd) attribute */ ret = H5Adelete(dataset, ATTR2_NAME); CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 2, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1611,9 +1612,9 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open last (formally 3rd) attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1634,9 +1635,9 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info3"); /* Close dataset */ ret = H5Dclose(dataset); @@ -1664,7 +1665,7 @@ test_attr_dtype_shared(hid_t fapl) hid_t attr_id; /* Attribute ID */ int data = 8; /* Data to write */ int rdata = 0; /* Read read in */ - H5O_info_t oinfo; /* Object's information */ + H5O_info2_t oinfo; /* Object's information */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ herr_t ret; /* Generic return value */ @@ -1698,9 +1699,9 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3"); /* Create dataspace for dataset */ space_id = H5Screate(H5S_SCALAR); @@ -1711,18 +1712,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(dset_id, FAIL, "H5Dcreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3"); /* Create attribute on dataset */ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Close attribute */ ret = H5Aclose(attr_id); @@ -1733,18 +1734,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3"); /* Create attribute on dataset */ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Write data into the attribute */ ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data); @@ -1797,18 +1798,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Unlink the dataset */ ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3"); /* Unlink the named datatype */ ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT); @@ -2440,7 +2441,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) unsigned u; /* Local index variable */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ @@ -2523,9 +2524,9 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -2634,7 +2635,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) htri_t is_dense; /* Are attributes stored densely? */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned u; /* Local index variable */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); unsigned use_corder; /* Track creation order or not */ @@ -2726,9 +2727,9 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Arename_by_name"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -2826,7 +2827,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) size_t mesg_count; /* # of shared messages */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned u; /* Local index variable */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ @@ -2904,9 +2905,9 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -10863,9 +10864,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) hid_t gid; /* Group ID */ hid_t oid; /* Object ID */ hsize_t dims = 256; /* Attribute dimensions */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ H5A_info_t ainfo; /* Attribute info */ haddr_t root_addr; /* Root group address */ + haddr_t link_addr; /* Link (to root group) address */ herr_t ret; /* Generic return status */ /* Output message about test being performed */ @@ -10881,9 +10883,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Get root group address */ - ret = H5Oget_info2(fid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - root_addr = oinfo.addr; + ret = H5VLnative_token_to_addr(fid, oinfo.token, &root_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); /* * Create link to root group @@ -10906,10 +10909,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + if(link_addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr); /* Close file */ ret = H5Fclose(fid); @@ -10951,10 +10956,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + if(link_addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr); ret = H5Aget_info_by_name(gid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); if(ainfo.data_size != dims) diff --git a/test/tfile.c b/test/tfile.c index 7da8b85..4c23488 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5177,7 +5177,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, { hid_t file, group; /* Handles */ hid_t fapl; /* File access property list */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ herr_t ret; /* Return value */ /* @@ -5195,9 +5195,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group has the correct object header version */ - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); /* * Reopen the file and make sure the root group still has the correct version @@ -5211,9 +5211,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, file = H5Fopen("tfile5.h5", H5F_ACC_RDWR, fapl); CHECK(file, FAIL, "H5Fopen"); - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); /* * Create a group named "G1" in the file, and make sure it has the correct @@ -5222,9 +5222,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info"); + ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR); + CHECK(ret, FAIL, "H5Oget_native)info"); + VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info"); ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); @@ -5236,9 +5236,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1/G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name"); + ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR); + CHECK(ret, FAIL, "H5Oget_native_info"); + VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info"); ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); @@ -5246,9 +5246,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group still has the correct object header version */ - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -6034,7 +6034,7 @@ test_libver_bounds_obj(hid_t fapl) hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ H5G_info_t ginfo; /* Group info */ herr_t ret; /* Return value */ @@ -6058,11 +6058,11 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version is 2 because shared message is enabled */ - VERIFY(oinfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -6077,11 +6077,11 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version is as indicated by low_bound */ - VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -6132,11 +6132,11 @@ test_libver_bounds_obj(hid_t fapl) VERIFY(ginfo.storage_type, H5G_STORAGE_TYPE_SYMBOL_TABLE, "H5Gget_info"); /* Get object header information */ - ret = H5Oget_info_by_name2(gid, GRP_NAME, &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(gid, GRP_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version as indicated by low_bound */ - VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds"); /* Close the group */ ret = H5Gclose(gid); diff --git a/test/th5o.c b/test/th5o.c index 354245f..ab4a8de 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -20,6 +20,9 @@ *************************************************************/ #include "testhdf5.h" +#include "H5Fprivate.h" +#include "H5VLprivate.h" +#include "H5VLnative_private.h" #define TEST_FILENAME "th5o_file" @@ -231,6 +234,7 @@ test_h5o_close(void) } +#ifndef H5_NO_DEPRECATED_SYMBOLS /**************************************************************** ** ** test_h5o_open_by_addr(): Test H5Oopen_by_addr function. @@ -239,17 +243,17 @@ test_h5o_close(void) static void test_h5o_open_by_addr(void) { - hid_t fid; /* HDF5 File ID */ - hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info_t li; /* Buffer for H5Lget_info */ - haddr_t grp_addr; /* Addresses for objects */ - haddr_t dset_addr; - haddr_t dtype_addr; - hsize_t dims[RANK]; - H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - H5G_info_t ginfo; /* Group info struct */ - H5T_class_t type_class; /* Class of the datatype */ - herr_t ret; /* Value returned from API calls */ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info2_t li; /* Buffer for H5Lget_info */ + haddr_t grp_addr; /* Addresses for objects */ + haddr_t dset_addr; + haddr_t dtype_addr; + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -285,15 +289,20 @@ test_h5o_open_by_addr(void) CHECK(ret, FAIL, "H5Sclose"); /* Get address for each object */ - ret = H5Lget_info(fid, "group", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - grp_addr = li.u.address; - ret = H5Lget_info(fid, "group/datatype", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - dtype_addr = li.u.address; - ret = H5Lget_info(fid, "dataset", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - dset_addr = li.u.address; + ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &grp_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + + ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &dtype_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + + ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &dset_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); /* Now make sure that H5Oopen_by_addr can open all three types of objects */ grp = H5Oopen_by_addr(fid, grp_addr); @@ -366,7 +375,122 @@ test_h5o_open_by_addr(void) }H5E_END_TRY VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + +/**************************************************************** +** +** test_h5o_open_by_token(): Test H5Oopen_by_token function. +** +****************************************************************/ +static void +test_h5o_open_by_token(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info2_t li; /* Buffer for H5Lget_info */ + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + + /* Make sure that H5Oopen_by_token can open all three types of objects */ + ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + grp = H5Oopen_by_token(fid, li.u.token); + CHECK(grp, FAIL, "H5Oopen_by_token"); + + ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dtype = H5Oopen_by_token(fid, li.u.token); + CHECK(dtype, FAIL, "H5Oopen_by_token"); + + ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + /* Check that we can use the group ID as a valid location */ + dset = H5Oopen_by_token(grp, li.u.token); + CHECK(dset, FAIL, "H5Oopen_by_token"); + + /* Make sure that each is the right kind of ID */ + id_type = H5Iget_type(grp); + VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID"); + id_type = H5Iget_type(dtype); + VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID"); + id_type = H5Iget_type(dset); + VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); + + /* Do something more complex with each of the IDs to make sure they "work" */ + ret = H5Gget_info(grp, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ + + type_class = H5Tget_class(dtype); + VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); + + dspace = H5Dget_space(dset); + CHECK(dspace, FAIL, "H5Dget_space"); + + /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Try giving some bogus values to H5O_open_by_token */ + /* Try opening an object using H5O_TOKEN_UNDEF (should fail) */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_token"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Also, trying to open an object without a valid location (should fail) */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_token(fid, li.u.token); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_token"); +} /* test_h5o_open_by_token() */ /**************************************************************** ** @@ -378,7 +502,7 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ @@ -410,15 +534,15 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Sclose"); /* Get ref counts for each object. They should all be 1, since each object has a hard link. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Increment each object's reference count. */ ret = H5Oincr_refcount(grp); @@ -429,15 +553,15 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Oincr_refcount"); /* Get ref counts for each object. They should all be 2 now. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); /* Decrement the reference counts and check that they decrease back to 1. */ ret = H5Odecr_refcount(grp); @@ -447,15 +571,15 @@ test_h5o_refcount(void) ret = H5Odecr_refcount(dset); CHECK(ret, FAIL, "H5Odecr_refcount"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Increment the reference counts and then close the file to make sure the increment is permanant */ ret = H5Oincr_refcount(grp); @@ -485,15 +609,15 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); /* Decrement the reference counts and close the file */ ret = H5Odecr_refcount(grp); @@ -523,15 +647,15 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Close the IDs */ ret = H5Gclose(grp); @@ -1254,7 +1378,7 @@ test_h5o_getinfo_same_file(void) { hid_t fid1, fid2; /* HDF5 File ID */ hid_t gid1, gid2; /* Group IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info2_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ @@ -1272,24 +1396,24 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); + ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Reset object info */ HDmemset(&oinfo1, 0, sizeof(oinfo1)); HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Close everything */ ret = H5Gclose(gid1); @@ -1317,24 +1441,24 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); + ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Reset object info */ HDmemset(&oinfo1, 0, sizeof(oinfo1)); HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Close everything */ ret = H5Gclose(gid1); @@ -1352,6 +1476,143 @@ test_h5o_getinfo_same_file(void) /**************************************************************** ** +** test_h5o_open_by_addr_deprec(): Test H5Oopen_by_addr function. +** +****************************************************************/ +static void +test_h5o_open_by_addr_deprec(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info1_t li; /* Buffer for H5Lget_info1 */ + haddr_t grp_addr; /* Addresses for objects */ + haddr_t dset_addr; + haddr_t dtype_addr; + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + + /* Get address for each object */ + ret = H5Lget_info1(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + grp_addr = li.u.address; + ret = H5Lget_info1(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dtype_addr = li.u.address; + ret = H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dset_addr = li.u.address; + + /* Now make sure that H5Oopen_by_addr can open all three types of objects */ + grp = H5Oopen_by_addr(fid, grp_addr); + CHECK(grp, FAIL, "H5Oopen_by_addr"); + dtype = H5Oopen_by_addr(fid, dtype_addr); + CHECK(dtype, FAIL, "H5Oopen_by_addr"); + /* Check that we can use the group ID as a valid location */ + dset = H5Oopen_by_addr(grp, dset_addr); + CHECK(dset, FAIL, "H5Oopen_by_addr"); + + /* Make sure that each is the right kind of ID */ + id_type = H5Iget_type(grp); + VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID"); + id_type = H5Iget_type(dtype); + VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID"); + id_type = H5Iget_type(dset); + VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); + + /* Do something more complex with each of the IDs to make sure they "work" */ + ret = H5Gget_info(grp, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ + + type_class = H5Tget_class(dtype); + VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); + + dspace = H5Dget_space(dset); + CHECK(dspace, FAIL, "H5Dget_space"); + + /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Try giving some bogus values to H5O_open_by_addr. */ + /* Try to open an object with a bad address */ + grp_addr += 20; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + /* For instance, an objectno smaller than the end of the file's superblock should + * trigger an error */ + grp_addr = 10; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + /* Likewise, an objectno larger than the size of the file should fail */ + grp_addr = 0; + grp_addr = 1000000000; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Also, trying to open an object without a valid location should fail */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_addr(fid, dtype_addr); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_addr"); +} /* test_h5o_open_by_addr_deprec() */ + + +/**************************************************************** +** ** visit_obj_cb(): ** This is the callback function invoked by H5Ovisit1() in ** test_h5o_getinfo_visit(): @@ -1360,10 +1621,10 @@ test_h5o_getinfo_same_file(void) ** ****************************************************************/ static int -visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1, +visit_obj_cb(hid_t group_id, const char *name, const H5O_info1_t *oinfo1, void H5_ATTR_UNUSED *_op_data) { - H5O_info_t oinfo2; /* Object info structs */ + H5O_info1_t oinfo2; /* Object info structs */ /* Verify the object info for "group1", "group2" and the root group */ if(!(HDstrcmp(name, "group1"))) { @@ -1399,7 +1660,7 @@ test_h5o_getinfo_visit(void) hid_t gid1 = -1, gid2 = -1; /* Group IDs */ hid_t sid = -1; /* Dataspace ID */ hid_t aid = -1; /* Attribute ID */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info1_t oinfo1, oinfo2; /* Object info structs */ char attrname[25]; /* Attribute name */ int j; /* Local index variable */ herr_t ret; /* Value returned from API calls */ @@ -1438,9 +1699,9 @@ test_h5o_getinfo_visit(void) /* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */ ret = H5Oget_info1(gid1, &oinfo1); - CHECK(ret, FAIL, "H5Oget_info"); + CHECK(ret, FAIL, "H5Oget_info1"); ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); + CHECK(ret, FAIL, "H5Oget_info2"); /* Verify the object info for "group1" is correct */ VERIFY(oinfo1.fileno, oinfo2.fileno, "obj info from H5Oget_info1/2"); @@ -1452,9 +1713,9 @@ test_h5o_getinfo_visit(void) /* Query the object info for "group2" via H5Oget_info1 and H5Oget_info2 */ ret = H5Oget_info_by_name1(fid, "group2", &oinfo1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR|H5O_INFO_META_SIZE, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify the object info for "group2" is correct */ VERIFY(oinfo1.hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Oget_info1/2"); @@ -1491,18 +1752,22 @@ test_h5o(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Objects\n")); - test_h5o_open(); /* Test generic open function */ - test_h5o_open_by_addr(); /* Test opening objects by address */ - test_h5o_close(); /* Test generic close function */ - test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - test_h5o_plist(); /* Test object creation properties */ - test_h5o_link(); /* Test object link routine */ - test_h5o_comment(); /* Test routines for comment */ - test_h5o_comment_by_name(); /* Test routines for comment by name */ - test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ + test_h5o_open(); /* Test generic open function */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ -#endif + test_h5o_open_by_addr(); /* Test opening objects by address */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + test_h5o_open_by_token(); /* Test opening objects by token */ + test_h5o_close(); /* Test generic close function */ + test_h5o_refcount(); /* Test incrementing and decrementing reference count */ + test_h5o_plist(); /* Test object creation properties */ + test_h5o_link(); /* Test object link routine */ + test_h5o_comment(); /* Test routines for comment */ + test_h5o_comment_by_name(); /* Test routines for comment by name */ + test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + test_h5o_open_by_addr_deprec(); /* Test opening objects by address with H5Lget_info1 */ + test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_h5o() */ diff --git a/test/titerate.c b/test/titerate.c index 669a094..9d60915 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -68,9 +68,9 @@ static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_clie /* Local functions */ int iter_strcmp(const void *s1, const void *s2); int iter_strcmp2(const void *s1, const void *s2); -static herr_t liter_cb(hid_t group, const char *name, const H5L_info_t *info, +static herr_t liter_cb(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); -static herr_t liter_cb2(hid_t group, const char *name, const H5L_info_t *info, +static herr_t liter_cb2(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo, void *op_data); @@ -91,7 +91,7 @@ H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2) ** ****************************************************************/ static herr_t -liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, +liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { iter_info *info = (iter_info *)op_data; @@ -153,8 +153,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test iterating over empty group */ info.command = RET_ZERO; idx = 0; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); - VERIFY(ret, SUCCEED, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + VERIFY(ret, SUCCEED, "H5Literate2"); datatype = H5Tcopy(H5T_NATIVE_INT); CHECK(datatype, FAIL, "H5Tcopy"); @@ -220,12 +220,12 @@ test_iter_group(hid_t fapl, hbool_t new_format) VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); for(i = 0; i< (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end for */ @@ -246,13 +246,13 @@ test_iter_group(hid_t fapl, hbool_t new_format) VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info"); for(i = 0; i< (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); } /* end for */ H5E_BEGIN_TRY { @@ -264,28 +264,28 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = RET_ZERO; idx = (hsize_t)-1; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping exactly as many entries as in the group */ idx = NDATASETS + 2; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping more entries than are in the group */ idx = NDATASETS + 3; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test all objects in group, when callback always returns 0 */ info.command = RET_ZERO; idx = 0; - if((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) + if((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ @@ -293,15 +293,15 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = RET_TWO; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 2, "H5Literate"); + VERIFY(ret, 2, "H5Literate2"); /* Increment the number of times "2" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, (hsize_t)i, "H5Literate"); + VERIFY(idx, (hsize_t)i, "H5Literate2"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -309,7 +309,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); } /* end while */ - VERIFY(ret, -1, "H5Literate"); + VERIFY(ret, -1, "H5Literate2"); if(i != (NDATASETS + 2)) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -319,15 +319,15 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = new_format ? RET_CHANGE2 : RET_CHANGE; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 1, "H5Literate"); + VERIFY(ret, 1, "H5Literate2"); /* Increment the number of times "1" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, (hsize_t)(i + 10), "H5Literate"); + VERIFY(idx, (hsize_t)(i + 10), "H5Literate2"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -335,7 +335,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); } /* end while */ - VERIFY(ret, -1, "H5Literate"); + VERIFY(ret, -1, "H5Literate2"); if(i != 42 || idx != 52) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -550,11 +550,11 @@ H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2) ** ****************************************************************/ static herr_t -liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, +liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *opdata) { const iter_info *test_info = (const iter_info *)opdata; - H5O_info_t oinfo; + H5O_info2_t oinfo; herr_t ret; /* Generic return value */ if(HDstrcmp(name, test_info->name)) { @@ -565,8 +565,8 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_ /* * Get type of the object and check it. */ - ret = H5Oget_info_by_name2(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); if(test_info->type != oinfo.type) { TestErrPrintf("test_info->type = %d, oinfo.type = %d\n", test_info->type, (int)oinfo.type); @@ -683,14 +683,14 @@ test_iter_group_large(hid_t fapl) /* Iterate through the file to see members of the root group */ curr_name = &names[0]; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); - CHECK(ret, FAIL, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); + CHECK(ret, FAIL, "H5Literate2"); for(i = 1; i < 100; i++) { hsize_t idx = (hsize_t)i; curr_name = &names[i]; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); - CHECK(ret, FAIL, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); + CHECK(ret, FAIL, "H5Literate2"); } /* end for */ /* Close file */ @@ -793,7 +793,7 @@ static void test_grp_memb_funcs(hid_t fapl) VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); for(i = 0; i < (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Test with NULL for name, to query length */ name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL, (size_t)NAMELEN, H5P_DEFAULT); @@ -809,8 +809,8 @@ static void test_grp_memb_funcs(hid_t fapl) obj_names[i] = HDstrdup(dataset_name); CHECK_PTR(obj_names[i], "strdup"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); if(!HDstrcmp(dataset_name, "grp")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); @@ -890,21 +890,21 @@ static void test_links(hid_t fapl) /* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */ for(i = 0; i < ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ - H5L_info_t linfo; /* Link info */ + H5O_info2_t oinfo; /* Object info */ + H5L_info2_t linfo; /* Link info */ /* Get link name */ name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(name_len, FAIL, "H5Lget_name_by_idx"); /* Get link type */ - ret = H5Lget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info_by_idx"); + ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info_by_idx2"); /* Get object type */ if(linfo.type == H5L_TYPE_HARD) { - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); } /* end if */ if(!HDstrcmp(obj_name, "g1.1")) @@ -1015,6 +1015,87 @@ static void test_corrupted_attnamelen(void) } /* test_corrupted_attnamelen() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS +/**************************************************************** +** +** test_links_deprec(): Test soft and hard link iteration +** +****************************************************************/ +static void test_links_deprec(hid_t fapl) +{ + hid_t file; /* File ID */ + char obj_name[NAMELEN]; /* Names of the object in group */ + ssize_t name_len; /* Length of object's name */ + hid_t gid, gid1; + H5G_info_t ginfo; /* Buffer for querying object's info */ + hsize_t i; + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality Using Deprecated Routines\n")); + + /* Create the test file with the datasets */ + file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(file, FAIL, "H5Fcreate"); + + /* create groups */ + gid = H5Gcreate2(file, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gcreate2"); + + gid1 = H5Gcreate2(file, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gcreate2"); + + /* create soft and hard links to the group "/g1". */ + ret = H5Lcreate_soft("something", gid, "softlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); + + ret = H5Lcreate_hard(gid, "/g1", H5L_SAME_LOC, "hardlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_hard"); + + ret = H5Gget_info(gid, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 3, "H5Gget_info"); + + /* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */ + for(i = 0; i < ginfo.nlinks; i++) { + H5O_info2_t oinfo; /* Object info */ + H5L_info2_t linfo; /* Link info */ + + /* Get link name */ + name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT); + CHECK(name_len, FAIL, "H5Lget_name_by_idx"); + + /* Get link type */ + ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info_by_idx1"); + + /* Get object type */ + if(linfo.type == H5L_TYPE_HARD) { + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx"); + } /* end if */ + + if(!HDstrcmp(obj_name, "g1.1")) + VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); + else if(!HDstrcmp(obj_name, "hardlink")) + VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); + else if(!HDstrcmp(obj_name, "softlink")) + VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); + else + CHECK(0, 0, "unknown object name"); + } /* end for */ + + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_links_deprec() */ +#endif + /**************************************************************** ** ** test_iterate(): Main iteration testing routine. @@ -1049,6 +1130,9 @@ test_iterate(void) test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */ test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */ test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + test_links_deprec(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ +#endif } /* end for */ /* Test the fix for issue HDFFV-10588 */ diff --git a/test/tmisc.c b/test/tmisc.c index d637802..7b7f5ba 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -309,6 +309,7 @@ typedef struct /* Definitions for misc. test #30 */ #define MISC30_FILE "tmisc30.h5" +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Definitions for misc. test #31 */ #define MISC31_FILE "tmisc31.h5" #define MISC31_DSETNAME "dset" @@ -317,6 +318,7 @@ typedef struct #define MISC31_GROUPNAME "group" #define MISC31_PROPNAME "misc31_prop" #define MISC31_DTYPENAME "dtype" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Definitions for misc. test #33 */ /* Note that this test file is generated by "gen_bad_offset.c" */ @@ -649,7 +651,7 @@ static void test_misc4(void) { hid_t file1, file2, group1, group2, group3; - H5O_info_t oinfo1, oinfo2, oinfo3; + H5O_info2_t oinfo1, oinfo2, oinfo3; herr_t ret; /* Output message about test being performed */ @@ -674,12 +676,12 @@ test_misc4(void) CHECK(group3, FAIL, "H5Gcreate2"); /* Get the stat information for each group */ - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); /* Verify that the fileno values are the same for groups from file1 */ VERIFY(oinfo1.fileno, oinfo2.fileno, "H5Oget_info_by_name"); @@ -2911,7 +2913,11 @@ test_misc18(void) hid_t sid; /* 'Space ID */ hid_t did1, did2; /* Dataset IDs */ hid_t aid; /* Attribute ID */ - H5O_info_t oinfo; /* Information about object */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5O_info1_t old_oinfo; /* (deprecated) information about object */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5O_info2_t oinfo; /* Data model information about object */ + H5O_native_info_t ninfo; /* Native file format information about object */ char attr_name[32]; /* Attribute name buffer */ unsigned u; /* Local index variable */ herr_t ret; /* Generic return value */ @@ -2929,26 +2935,48 @@ test_misc18(void) CHECK(did1, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name"); /* Create second dataset */ did2 = H5Dcreate2(fid, MISC18_DSET2_NAME, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(did2, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name"); /* Loop creating attributes on each dataset, flushing them to the file each time */ for(u = 0; u < 10; u++) { @@ -2975,22 +3003,44 @@ test_misc18(void) } /* end for */ /* Get object information for dataset #1 now */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name"); /* Get object information for dataset #2 now */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_mative_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name"); /* Close second dataset */ ret = H5Dclose(did2); @@ -3915,7 +3965,7 @@ test_misc23(void) hid_t file_id=0, group_id=0, type_id=0, space_id=0, tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT; char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */ - H5O_info_t oinfo; + H5O_info2_t oinfo; htri_t tri_status; ssize_t namelen; herr_t status; @@ -3998,9 +4048,9 @@ test_misc23(void) tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT); CHECK(tmp_id, FAIL, "H5Gopen2"); - status = H5Oget_info2(tmp_id, &oinfo, H5O_INFO_BASIC); - CHECK(status, FAIL, "H5Oget_info"); - VERIFY(oinfo.rc, 1, "H5Oget_info"); + status = H5Oget_info3(tmp_id, &oinfo, H5O_INFO_BASIC); + CHECK(status, FAIL, "H5Oget_info3"); + VERIFY(oinfo.rc, 1, "H5Oget_info3"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); @@ -5274,18 +5324,18 @@ test_misc29(void) static int -test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *op_data) { - H5O_info_t object_info; + H5O_info2_t object_info; - return H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT); + return H5Oget_info_by_name3(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT); } static int test_misc30_get_info(hid_t loc_id) { - return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); + return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } @@ -5364,6 +5414,7 @@ test_misc30(void) static void test_misc31(void) { +#ifndef H5_NO_DEPRECATED_SYMBOLS hid_t file_id; /* File id */ hid_t space_id; /* Dataspace id */ hid_t dset_id; /* Dataset id */ @@ -5371,6 +5422,7 @@ test_misc31(void) hid_t group_id; /* Group id */ hid_t dtype_id; /* Datatype id */ herr_t ret; /* Generic return value */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Output message about test being performed */ MESSAGE(5, ("Deprecated routines initialize after H5close()\n")); @@ -5533,7 +5585,7 @@ test_misc33(void) { hid_t fid = -1; /* File ID */ const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */ - H5O_info_t oinfo; /* Structure for object metadata information */ + H5O_info2_t oinfo; /* Structure for object metadata information */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -5545,21 +5597,21 @@ test_misc33(void) /* Case (1) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (2) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (3) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Close the file */ ret = H5Fclose(fid); @@ -5728,6 +5780,8 @@ cleanup_misc(void) HDremove(MISC28_FILE); HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); +#ifndef H5_NO_DEPRECATED_SYMBOLS HDremove(MISC31_FILE); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index dec049e..441b7aa 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -568,7 +568,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */ + H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ @@ -1380,7 +1380,7 @@ test_reference_obj_deleted(void) ** ****************************************************************/ static herr_t -test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void *op_data) { int *count = (int *)op_data; /* Pointer to name counter */ @@ -1430,7 +1430,7 @@ test_reference_group(void) H5R_ref_t rref; /* Reference to read */ H5G_info_t ginfo; /* Group info struct */ char objname[NAME_SIZE]; /* Buffer to store name */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ ssize_t size; /* Name length */ herr_t ret; @@ -1508,7 +1508,7 @@ test_reference_group(void) CHECK(gid, H5I_INVALID_HID, "H5Ropen_object"); /* Iterate through objects in dereferenced group */ - ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); + ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ @@ -1520,9 +1520,9 @@ test_reference_group(void) CHECK(size, (-1), "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); - VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); + VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3"); /* Unlink one of the objects in the dereferenced group */ ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 6322894..a830314 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -517,7 +517,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ hdset_reg_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */ + hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ @@ -1313,7 +1313,7 @@ test_reference_obj_deleted(void) ** ****************************************************************/ static herr_t -test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void *op_data) { int *count = (int *)op_data; /* Pointer to name counter */ @@ -1363,7 +1363,7 @@ test_reference_group(void) hobj_ref_t rref; /* Reference to read */ H5G_info_t ginfo; /* Group info struct */ char objname[NAME_SIZE]; /* Buffer to store name */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ ssize_t size; /* Name length */ herr_t ret; @@ -1438,7 +1438,7 @@ test_reference_group(void) CHECK(gid, FAIL, "H5Rdereference2"); /* Iterate through objects in dereferenced group */ - ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); + ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ @@ -1450,9 +1450,9 @@ test_reference_group(void) CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); - VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); + VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3"); /* Unlink one of the objects in the dereferenced group */ ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); diff --git a/test/trefer_shutdown.c b/test/trefer_shutdown.c new file mode 100644 index 0000000..89a44b3 --- /dev/null +++ b/test/trefer_shutdown.c @@ -0,0 +1,83 @@ +#include "h5test.h" + +int +main(int argc, char **argv) +{ + H5R_ref_t write_ref, read_ref; + hid_t fid; + hid_t did; + hid_t sid; + int i; + + if ((fid = H5Fcreate("HDFFV-10992.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + HDfprintf(stderr, "H5Fcreate failed\n"); + return 1; + } + + if ((sid = H5Screate(H5S_SCALAR)) < 0) { + HDfprintf(stderr, "H5Screate failed\n"); + return 1; + } + + /* Create a dataset of object references */ + if ((did = H5Dcreate2(fid, "dset", H5T_STD_REF, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + HDfprintf(stderr, "H5Dcreate failed\n"); + return 1; + } + + for (i = 0; i < 100; i++) { + /* Create reference to the root group */ + if (H5Rcreate_object(fid, "/dset", H5P_DEFAULT, &write_ref) < 0) { + HDfprintf(stderr, "H5Rcreate_object failed\n"); + return 1; + } + } + + /* Write reference to dataset */ + if (H5Dwrite(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &write_ref) < 0) { + HDfprintf(stderr, "H5Dwrite failed\n"); + return 1; + } + + for (i = 0; i < 500; i++) { + /* Read reference back into different reference buffer */ + if (H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &read_ref) < 0) { + HDfprintf(stderr, "H5Dread failed\n"); + return 1; + } + } + + /* + * "Forget" to call H5Rdestroy on reference objects. If H5Rdestroy + * is called at least once on either reference object, or both + * objects, the infinite loop goes away. If H5Rdestroy is never + * called, the infinite loop will appear. + */ +#if 0 + if (H5Rdestroy(&write_ref) < 0) { + HDfprintf(stderr, "H5Rdestroy on reference write buffer failed\n"); + return 1; + } + if (H5Rdestroy(&read_ref) < 0) { + HDfprintf(stderr, "H5Rdestroy on reference read buffer failed\n"); + return 1; + } +#endif + + if (H5Sclose(sid) < 0) { + HDfprintf(stderr, "H5Sclose failed\n"); + return 1; + } + + if (H5Dclose(did) < 0) { + HDfprintf(stderr, "H5Dclose failed\n"); + return 1; + } + + if (H5Fclose(fid) < 0) { + HDfprintf(stderr, "H5Fclose failed\n"); + return 1; + } + + return 0; +} diff --git a/test/tsohm.c b/test/tsohm.c index c126608..f39b5e5 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -743,7 +743,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_ */ static h5_stat_size_t getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, - hbool_t test_file_closing, H5O_info_t *oinfo) + hbool_t test_file_closing, H5O_native_info_t *ninfo) { hid_t fid = H5I_INVALID_HID; herr_t ret; @@ -758,8 +758,8 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, fid = size1_helper(fid, filename, fapl_id, test_file_closing); CHECK(fid, H5I_INVALID_HID, "size1_helper"); - ret = H5Oget_info_by_name2(fid, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, DSETNAME[0], ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); @@ -807,7 +807,7 @@ test_sohm_size1(void) h5_stat_size_t sohm_final_filesize2; h5_stat_size_t sohm_btree_final_filesize2; - H5O_info_t oinfo; + H5O_native_info_t ninfo; unsigned num_indexes = 1; unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; unsigned min_mesg_size = 50; @@ -866,10 +866,10 @@ test_sohm_size1(void) /* size of populated file, with different populating behaviors */ test_open_close = TRUE; - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo); test_open_close = FALSE; - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); - oh_sizes[oh_size_index++] = oinfo.hdr.space.total; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo); + oh_sizes[oh_size_index++] = ninfo.hdr.space.total; ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); @@ -974,7 +974,7 @@ test_sohm_size_consistency_open_create(void) unsigned use_btree; hsize_t oh_size_open; hsize_t oh_size_create; - H5O_info_t oinfo; + H5O_native_info_t oinfo; unsigned num_indexes = 1; unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; unsigned min_mesg_size = 50; @@ -1024,8 +1024,8 @@ test_sohm_size_consistency_open_create(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_native_info_by_name"); oh_size_open = oinfo.hdr.space.total; ret = H5Fclose(file); @@ -1039,8 +1039,8 @@ test_sohm_size_consistency_open_create(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_native_info_by_name"); oh_size_create = oinfo.hdr.space.total; ret = H5Fclose(file); diff --git a/test/tvlstr.c b/test/tvlstr.c index 731270c..b93d646 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -861,13 +861,12 @@ static void test_write_same_element(void) hid_t file1, dataset1; hid_t mspace, fspace, dtype; hsize_t fdim[] = {SPACE1_DIM1}; - char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; + const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; + const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; hsize_t marray[] = {NUMP}; hsize_t coord[SPACE1_RANK][NUMP]; herr_t ret; - char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; - file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); diff --git a/test/unlink.c b/test/unlink.c index 5199dcf..48dd79d 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -433,10 +433,11 @@ test_new_move(hid_t fapl) static int check_new_move(hid_t fapl) { - hid_t file; - H5O_info_t oi_hard1, oi_hard2; - char filename[1024]; - char linkval[1024]; + H5O_info2_t oi_hard1, oi_hard2; + hid_t file; + char filename[1024]; + char linkval[1024]; + int token_cmp; TESTING("check new move function"); @@ -446,15 +447,17 @@ check_new_move(hid_t fapl) FAIL_STACK_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check hard links */ if(H5O_TYPE_GROUP != oi_hard1.type || H5O_TYPE_GROUP != oi_hard2.type) FAIL_PUTS_ERROR(" Unexpected object type, should have been a group") - if(H5F_addr_ne(oi_hard1.addr, oi_hard2.addr)) + if(H5Otoken_cmp(file, &oi_hard1.token, &oi_hard2.token, &token_cmp) < 0) + FAIL_PUTS_ERROR(" H5Otoken_cmp failed") + if(token_cmp) FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.") /* Check soft links */ @@ -2156,7 +2159,7 @@ test_full_group_compact(hid_t fapl) { hid_t file_id = -1; hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info2_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2228,7 +2231,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2245,7 +2248,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2290,7 +2293,7 @@ test_full_group_dense(hid_t fapl) hid_t file_id = -1; hid_t gcpl = (-1); /* Group creation property list ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info2_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2374,7 +2377,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2391,7 +2394,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -317,7 +317,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, hid_t dset = -1; /* Virtual dataset */ H5D_space_status_t space_status; /* Dataset space status */ void *plist_buf = NULL; /* Serialized property list buffer */ - H5O_info_t oinfo; /* Object info struct */ + H5O_native_info_t ninfo; /* Object info struct */ htri_t tri_ret; HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS)); @@ -372,23 +372,23 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR /* Test H5Oget_info returns correct metadata size */ - if(H5Oget_info2(dset, &oinfo, H5O_INFO_META_SIZE) < 0) + if(H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0) TEST_ERROR - if(oinfo.meta_size.obj.index_size != (hsize_t)0) + if(ninfo.meta_size.obj.index_size != (hsize_t)0) TEST_ERROR if(config == TEST_API_REOPEN_FILE) { - if(oinfo.meta_size.obj.heap_size != exp_meta_size) { - HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + if(ninfo.meta_size.obj.heap_size != exp_meta_size) { + HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)ninfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR } } else - if((oinfo.meta_size.obj.heap_size != exp_meta_size) - && (oinfo.meta_size.obj.heap_size != (hsize_t)0)) + if((ninfo.meta_size.obj.heap_size != exp_meta_size) + && (ninfo.meta_size.obj.heap_size != (hsize_t)0)) TEST_ERROR - if(oinfo.meta_size.attr.index_size != (hsize_t)0) + if(ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR - if(oinfo.meta_size.attr.index_size != (hsize_t)0) + if(ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR /* Test H5Dget_space_status */ @@ -141,6 +141,11 @@ static const H5VL_class_t fake_vol_g = { NULL, /* specific */ NULL /* optional */ }, + { /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ + }, NULL /* optional */ }; @@ -228,7 +233,7 @@ test_vol_registration(void) TEST_ERROR; /* Try to unregister the native VOL connector (should fail) */ - if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME))) + if (H5I_INVALID_HID == (native_id = H5VLget_connector_id_by_name(H5VL_NATIVE_NAME))) TEST_ERROR; H5E_BEGIN_TRY { ret = H5VLunregister_connector(native_id); @@ -870,7 +875,7 @@ test_basic_object_operation(void) hid_t oid = H5I_INVALID_HID; char filename[1024]; - H5O_info_t object_info; + H5O_info2_t object_info; TESTING("Basic VOL object operations"); @@ -884,11 +889,11 @@ test_basic_object_operation(void) TEST_ERROR; /* H5Oget_info */ - if (H5Oget_info2(fid, &object_info, H5O_INFO_ALL) < 0) + if (H5Oget_info3(fid, &object_info, H5O_INFO_ALL) < 0) TEST_ERROR; /* H5Oget_info_by_name */ - if (H5Oget_info_by_name2(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) + if (H5Oget_info_by_name3(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) TEST_ERROR; /* H5Oexists_by_name */ diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 236a67e..e4f171b 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -233,7 +233,7 @@ test_getters(void) TEST_ERROR; /* Get the connector's ID */ - if((vol_id_out = H5VLget_connector_id(NULL_VOL_CONNECTOR_NAME)) < 0) + if((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); |