diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-13 15:44:56 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-13 15:44:56 (GMT) |
commit | 579284f422b6ed25b7a5f4a518c19740fff297c8 (patch) | |
tree | 564b2a7b4c13854a19ffaf465f94e6abd52d6340 /test | |
parent | 15d118faedd8e61e8ec2a715cf8fcea5b1afab35 (diff) | |
download | hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.zip hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.gz hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.bz2 |
[svn-r14144] Description:
Move H5Gget_objinfo() to deprecated symbols section and retarget
internal usage to H5Lget_info()/H5Oget_info().
Misc. other code cleanups...
Tested on:
FreeBSD/32 6.2 (duty)
FreeBSD/64 6.2 (liberty)
Linux/32 2.6 (kagiso)
Linux/64 2.6 (smirom)
AIX/32 5.3 (copper)
Solaris/32 2.10 (linew)
Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 18 | ||||
-rw-r--r-- | test/istore.c | 4 | ||||
-rw-r--r-- | test/links.c | 303 | ||||
-rw-r--r-- | test/mount.c | 83 | ||||
-rw-r--r-- | test/mtime.c | 156 | ||||
-rwxr-xr-x | test/objcopy.c | 94 | ||||
-rw-r--r-- | test/stab.c | 30 | ||||
-rw-r--r-- | test/tattr.c | 105 | ||||
-rw-r--r-- | test/testhdf5.h | 13 | ||||
-rw-r--r-- | test/tfile.c | 5 | ||||
-rw-r--r-- | test/th5o.c | 92 | ||||
-rw-r--r-- | test/titerate.c | 12 | ||||
-rw-r--r-- | test/tmisc.c | 181 | ||||
-rw-r--r-- | test/tsohm.c | 24 | ||||
-rw-r--r-- | test/unlink.c | 38 | ||||
-rw-r--r-- | test/vfd.c | 4 |
16 files changed, 539 insertions, 623 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index 75dde75..2783f2d 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -4362,7 +4362,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 */ - H5G_stat_t sb; /* Stat buffer for committed datatype */ + H5O_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 */ @@ -4396,9 +4396,9 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Gget_objinfo(file, compnd_type, TRUE, &sb) < 0) + if(H5Oget_info(file, compnd_type, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - old_dtype_oh_size = sb.ohdr.size; + old_dtype_oh_size = oi.hdr.space.total; /* Close datatype */ if(H5Tclose(tid2) < 0) @@ -4421,11 +4421,11 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Gget_objinfo(file, compnd_type, TRUE, &sb) < 0) + if(H5Oget_info(file, compnd_type, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ - if(old_dtype_oh_size != sb.ohdr.size) + if(old_dtype_oh_size != oi.hdr.space.total) TEST_ERROR /* Close datatype */ @@ -4457,9 +4457,9 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Gget_objinfo(file, compnd_type, TRUE, &sb) < 0) + if(H5Oget_info(file, compnd_type, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - new_dtype_oh_size = sb.ohdr.size; + new_dtype_oh_size = oi.hdr.space.total; /* Check that the new format is smaller than the old format */ if(old_dtype_oh_size <= new_dtype_oh_size) @@ -4486,11 +4486,11 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Gget_objinfo(file, compnd_type, TRUE, &sb) < 0) + if(H5Oget_info(file, compnd_type, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ - if(new_dtype_oh_size != sb.ohdr.size) + if(new_dtype_oh_size != oi.hdr.space.total) TEST_ERROR /* Close datatype */ diff --git a/test/istore.c b/test/istore.c index 8764643..657e150 100644 --- a/test/istore.c +++ b/test/istore.c @@ -47,11 +47,7 @@ const char *FILENAME[] = { #define TEST_DATATYPE H5T_NATIVE_UCHAR #define TEST_CHUNK_SIZE 50 -#ifdef H5_HAVE_LARGE_HSIZET #define TEST_SPARSE_SIZE 1000000 -#else /* H5_HAVE_LARGE_HSIZET */ -#define TEST_SPARSE_SIZE 1200 -#endif /* H5_HAVE_LARGE_HSIZET */ hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; hsize_t zero[H5O_LAYOUT_NDIMS]; diff --git a/test/links.c b/test/links.c index fb6fdb6..3ef66a0 100644 --- a/test/links.c +++ b/test/links.c @@ -126,32 +126,32 @@ mklinks(hid_t fapl, hbool_t new_format) /* Create a file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if ((scalar=H5Screate_simple (1, size, size)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((scalar = H5Screate_simple(1, size, size)) < 0) TEST_ERROR /* Create a group */ if((grp = H5Gcreate2(file, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose (grp) < 0) TEST_ERROR + if(H5Gclose(grp) < 0) TEST_ERROR /* Create a dataset */ - if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Dclose (d1) < 0) TEST_ERROR + if((d1 = H5Dcreate(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(d1) < 0) TEST_ERROR /* Create a hard link */ - if (H5Lcreate_hard (file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create a symbolic link */ - if (H5Lcreate_soft ("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create a symbolic link to something that doesn't exist */ - if (H5Lcreate_soft ("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create a recursive symbolic link */ - if (H5Lcreate_soft ("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close */ - if (H5Sclose (scalar) < 0) TEST_ERROR - if (H5Fclose (file) < 0) TEST_ERROR + if(H5Sclose(scalar) < 0) TEST_ERROR + if(H5Fclose(file) < 0) TEST_ERROR PASSED(); return 0; @@ -194,12 +194,12 @@ new_links(hid_t fapl, hbool_t new_format) /* Create two files */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if ((scalar=H5Screate_simple (1, size, size)) < 0) TEST_ERROR + if((scalar = H5Screate_simple (1, size, size)) < 0) TEST_ERROR /* Create two groups in each file */ if((grp1_a = H5Gcreate2(file_a, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -208,8 +208,8 @@ new_links(hid_t fapl, hbool_t new_format) if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create datasets */ - if((dset1=H5Dcreate(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR - if((dset2=H5Dcreate(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset1 = H5Dcreate(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset2 = H5Dcreate(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR /* Create links within a file. Both of source and destination use * H5L_SAME_LOC. Both hard and soft links should fail. */ @@ -232,30 +232,30 @@ new_links(hid_t fapl, hbool_t new_format) if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close dataspace and files */ - if (H5Sclose (scalar) < 0) TEST_ERROR - if (H5Dclose(dset1) < 0) TEST_ERROR - if (H5Dclose(dset2) < 0) TEST_ERROR - if (H5Gclose (grp1_a) < 0) TEST_ERROR - if (H5Gclose (grp2_a) < 0) TEST_ERROR - if (H5Gclose (grp1_b) < 0) TEST_ERROR - if (H5Gclose (grp2_b) < 0) TEST_ERROR - if (H5Fclose (file_a) < 0) TEST_ERROR - if (H5Fclose (file_b) < 0) TEST_ERROR + if(H5Sclose(scalar) < 0) TEST_ERROR + if(H5Dclose(dset1) < 0) TEST_ERROR + if(H5Dclose(dset2) < 0) TEST_ERROR + if(H5Gclose(grp1_a) < 0) TEST_ERROR + if(H5Gclose(grp2_a) < 0) TEST_ERROR + if(H5Gclose(grp1_b) < 0) TEST_ERROR + if(H5Gclose(grp2_b) < 0) TEST_ERROR + if(H5Fclose(file_a) < 0) TEST_ERROR + if(H5Fclose(file_b) < 0) TEST_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Sclose (scalar); - H5Dclose (dset1); - H5Dclose (dset2); - H5Gclose (grp1_a); - H5Gclose (grp2_a); - H5Gclose (grp1_b); - H5Gclose (grp2_b); - H5Fclose (file_a); - H5Fclose (file_b); + H5Sclose(scalar); + H5Dclose(dset1); + H5Dclose(dset2); + H5Gclose(grp1_a); + H5Gclose(grp2_a); + H5Gclose(grp1_b); + H5Gclose(grp2_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return -1; } @@ -282,7 +282,8 @@ static int cklinks(hid_t fapl, hbool_t new_format) { hid_t file; - H5G_stat_t sb1, sb2; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; char linkval[LINK_BUF_SIZE]; char filename[NAME_BUF_SIZE]; herr_t status; @@ -297,14 +298,14 @@ cklinks(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Hard link */ - if(H5Gget_objinfo(file, "d1", TRUE, &sb1) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file, "grp1/hard", TRUE, &sb2) < 0) FAIL_STACK_ERROR - if(H5G_DATASET != sb2.type) { + if(H5Oget_info(file, "d1", &oinfo1, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file, "grp1/hard", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -314,13 +315,13 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Symbolic link */ - if(H5Gget_objinfo(file, "grp1/soft", TRUE, &sb2) < 0) FAIL_STACK_ERROR - if(H5G_DATASET != sb2.type) { + if(H5Oget_info(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { H5_FAILED(); puts(" Soft link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -336,15 +337,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Dangling link */ H5E_BEGIN_TRY { - status = H5Gget_objinfo(file, "grp1/dangle", TRUE, &sb2); + status = H5Oget_info(file, "grp1/dangle", &oinfo2, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" H5Gget_objinfo() should have failed for a dangling link."); + puts(" H5Oget_info() should have failed for a dangling link."); TEST_ERROR } /* end if */ - if(H5Gget_objinfo(file, "grp1/dangle", FALSE, &sb2) < 0) FAIL_STACK_ERROR - if(H5G_LINK != sb2.type) { + if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -363,15 +364,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Recursive link */ H5E_BEGIN_TRY { - status = H5Gget_objinfo(file, "grp1/recursive", TRUE, &sb2); + status = H5Oget_info(file, "grp1/recursive", &oinfo2, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" H5Gget_objinfo() should have failed for a recursive link."); + puts(" H5Oget_info() should have failed for a recursive link."); TEST_ERROR } /* end if */ - if(H5Gget_objinfo(file, "grp1/recursive", FALSE, &sb2) < 0) FAIL_STACK_ERROR - if(H5G_LINK != sb2.type) { + if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -420,7 +421,7 @@ static int ck_new_links(hid_t fapl, hbool_t new_format) { hid_t file; - H5G_stat_t sb_dset, sb_hard1, sb_hard2; + H5O_info_t oi_dset, oi_hard1, oi_hard2; char filename[NAME_BUF_SIZE]; if(new_format) @@ -430,23 +431,23 @@ ck_new_links(hid_t fapl, hbool_t new_format) /* Open the file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Gget_objinfo(file, "/grp1/dataset2", TRUE, &sb_dset) < 0) + if(H5Oget_info(file, "/grp1/dataset2", &oi_dset, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gget_objinfo(file, "/grp1/hard1", TRUE, &sb_hard1) < 0) + if(H5Oget_info(file, "/grp1/hard1", &oi_hard1, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gget_objinfo(file, "/grp2/hard2", TRUE, &sb_hard2) < 0) + if(H5Oget_info(file, "/grp2/hard2", &oi_hard2, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ - if(H5G_DATASET!=sb_hard1.type || H5G_DATASET!=sb_hard2.type) { + if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } - if(HDmemcmp(&sb_dset.objno, &sb_hard1.objno, sizeof(sb_dset.objno)) || HDmemcmp(&sb_dset.objno, &sb_hard2.objno, sizeof(sb_dset.objno))) { + if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -455,10 +456,11 @@ ck_new_links(hid_t fapl, hbool_t new_format) /* Cleanup */ if(H5Fclose(file) < 0) TEST_ERROR + PASSED(); return 0; - error: +error: return -1; } @@ -1302,7 +1304,7 @@ 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; - H5G_stat_t statbuf; + H5O_info_t oinfo; H5L_info_t linfo; H5T_cset_t old_cset; int64_t old_corder; /* Creation order value of link */ @@ -1341,13 +1343,13 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Get the group's link's information */ if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) < 0) TEST_ERROR + if(H5Oget_info(file_id, "group", &oinfo, 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 = statbuf.mtime; + 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); @@ -1360,16 +1362,16 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* 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(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) < 0) TEST_ERROR - if(old_modification_time != statbuf.mtime) TEST_ERROR + if(H5Oget_info(file_id, "group", &oinfo, 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(H5Gget_objinfo(file_id, "group2", TRUE, &statbuf) < 0) TEST_ERROR - if(old_modification_time != statbuf.mtime) TEST_ERROR + if(H5Oget_info(file_id, "group2", &oinfo, 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(old_corder == linfo.corder) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1381,8 +1383,8 @@ 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(H5Gget_objinfo(file_id, "group_copied", TRUE, &statbuf) < 0) TEST_ERROR - if(old_modification_time != statbuf.mtime) TEST_ERROR + if(H5Oget_info(file_id, "group_copied", &oinfo, 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(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 2) TEST_ERROR @@ -1392,8 +1394,8 @@ 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(H5Gget_objinfo(file_id, "group_copied2", TRUE, &statbuf) < 0) TEST_ERROR - if(old_modification_time != statbuf.mtime) TEST_ERROR + if(H5Oget_info(file_id, "group_copied2", &oinfo, 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(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 3) TEST_ERROR @@ -1402,8 +1404,8 @@ 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(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) < 0) TEST_ERROR - if(old_modification_time != statbuf.mtime) TEST_ERROR + if(H5Oget_info(file_id, "group", &oinfo, 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(linfo.corder_valid != TRUE) TEST_ERROR if(old_corder != linfo.corder) TEST_ERROR @@ -1413,8 +1415,8 @@ 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(H5Gget_objinfo(file_id, "group_moved", TRUE, &statbuf) < 0) TEST_ERROR - if(old_modification_time != statbuf.mtime) TEST_ERROR + if(H5Oget_info(file_id, "group_moved", &oinfo, 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(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 4) TEST_ERROR @@ -1424,8 +1426,8 @@ 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(H5Gget_objinfo(file_id, "group_moved_again", TRUE, &statbuf) < 0) TEST_ERROR - if(old_modification_time != statbuf.mtime) TEST_ERROR + if(H5Oget_info(file_id, "group_moved_again", &oinfo, 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(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 5) TEST_ERROR @@ -1600,7 +1602,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 */ - H5G_stat_t sb; /* Object information */ + H5L_info_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ ssize_t name_len; /* Length of object name */ char filename1[NAME_BUF_SIZE]; @@ -1618,7 +1620,7 @@ external_link_root(hid_t fapl, hbool_t new_format) 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 + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -1627,20 +1629,20 @@ external_link_root(hid_t fapl, hbool_t new_format) 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 + 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 (H5Gget_objinfo(fid, "ext_link", FALSE, &sb) < 0) goto error; - if (H5G_UDLINK!=sb.type) { + if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); puts(" 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, sb.linklen, NULL, &file, &path) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { H5_FAILED(); puts(" External link file name incorrect"); @@ -2602,8 +2604,8 @@ external_link_query(hid_t fapl, hbool_t new_format) 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 */ - H5G_stat_t sb; /* Object information */ - H5L_info_t li; /* Link information */ + 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 */ @@ -2647,12 +2649,12 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + 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(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR - if (H5L_TYPE_EXTERNAL != li.type) { + if(H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); puts(" Unexpected link class - should have been an external link"); goto error; @@ -2665,12 +2667,12 @@ external_link_query(hid_t fapl, hbool_t new_format) 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(strcmp(file_name, filename2)) TEST_ERROR - if(strcmp(object_name, "/dst")) TEST_ERROR + if(HDstrcmp(file_name, filename2)) TEST_ERROR + if(HDstrcmp(object_name, "/dst")) TEST_ERROR /* Query information about object that external link points to */ - if (H5Gget_objinfo(fid, "src", TRUE, &sb) < 0) goto error; - if (H5G_GROUP != sb.type) { + if(H5Oget_info(fid, "src", &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_GROUP != oi.type) { H5_FAILED(); puts(" Unexpected object type - should have been a group"); goto error; @@ -2699,10 +2701,10 @@ external_link_query(hid_t fapl, hbool_t new_format) PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_query() */ @@ -3339,14 +3341,14 @@ external_link_closing(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]; + 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_info_t li; - H5G_stat_t sb; + H5L_info_t li; + H5O_info_t oi; hobj_ref_t obj_ref; if(new_format) @@ -3403,9 +3405,8 @@ external_link_closing(hid_t fapl, hbool_t new_format) /* 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(H5Gget_objinfo(fid1, "elink/elink/elink/type1", TRUE, &sb) < 0) TEST_ERROR - if(H5Gget_objinfo(fid1, "elink/elink/elink", TRUE, &sb) < 0) TEST_ERROR - if(H5Gget_objinfo(fid1, "elink/elink/elink", FALSE, &sb) < 0) TEST_ERROR + if(H5Oget_info(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info(fid1, "elink/elink/elink", &oi, H5P_DEFAULT) < 0) TEST_ERROR /* Test move */ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, @@ -3492,7 +3493,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(H5Gget_objinfo(fid1, "elink/elink2/group2/group3/group4", TRUE, &sb) < 0) TEST_ERROR + if(H5Oget_info(fid1, "elink/elink2/group2/group3/group4", &oi, 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 @@ -4322,9 +4323,8 @@ 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 */ - H5G_stat_t sb; /* Object information */ - H5L_info_t li; /* Link information */ + hid_t lcpl = (-1); /* Link Creation PL */ + H5L_info_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]; @@ -4422,8 +4422,6 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Lget_info(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 - if(H5Gget_objinfo(fid, UD_CB_LINK_NAME, FALSE, &sb) < 0) FAIL_STACK_ERROR - if(sb.type != H5G_UDLINK) TEST_ERROR /* Unregister the UD hard links */ if(H5Lunregister(UD_HARD_TYPE) < 0) FAIL_STACK_ERROR @@ -4442,8 +4440,8 @@ error: } H5E_END_TRY; return -1; } /* end ud_callbacks() */ - + /*------------------------------------------------------------------------- * Function: lapl_udata * @@ -5176,9 +5174,9 @@ linkinfo(hid_t fapl, hbool_t new_format) char filename[NAME_BUF_SIZE]; if(new_format) - TESTING("link type field in H5Gget_objinfo (w/new group format)") + TESTING("link type field in H5Lget_info (w/new group format)") else - TESTING("link type field in H5Gget_objinfo") + TESTING("link type field in H5Lget_info") /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -6401,18 +6399,14 @@ link_info_by_idx_old(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - H5G_stat_t sb; /* Buffer for querying object's info */ + H5O_info_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(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - objno[u] = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(group_id2, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR + objno[u] = oi.addr; /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -6895,7 +6889,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5G_stat_t sb; /* Buffer for querying object's info */ + H5O_info_t oi; /* Buffer for querying object's info */ /* Make name for link */ sprintf(objname, "filler %02u", u); @@ -6904,12 +6898,8 @@ delete_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(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - objno[u] = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(group_id2, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR + objno[u] = oi.addr; /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -6972,7 +6962,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5G_stat_t sb; /* Buffer for querying object's info */ + H5O_info_t oi; /* Buffer for querying object's info */ /* Make name for link */ sprintf(objname, "filler %02u", u); @@ -6981,12 +6971,8 @@ delete_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(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - objno[u] = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(group_id2, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR + objno[u] = oi.addr; /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -7960,8 +7946,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, { char mntname[NAME_BUF_SIZE]; /* Link value */ hid_t group_id; /* ID of group to test */ - H5G_stat_t sb; /* Buffer for querying object's info */ - haddr_t obj_addr; /* Address of object in file */ + H5O_info_t oi; /* Buffer for querying object's info */ haddr_t mnt_root_addr; /* Address of root group in file to mount */ hid_t obj_id; /* ID of object opened */ unsigned mnt_idx; /* Index to mount group on */ @@ -7986,21 +7971,16 @@ 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(H5Gget_objinfo(obj_id, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - obj_addr = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - obj_addr = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(obj_id, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { - if(H5F_addr_ne(obj_addr, objno[u])) TEST_ERROR + if(H5F_addr_ne(oi.addr, objno[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(obj_addr, objno[dec_u])) TEST_ERROR + if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR } /* end if */ else { /* XXX: What to do about native order? */ @@ -8017,12 +7997,8 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, */ /* Get the address of the root group in the file to mount */ - if(H5Gget_objinfo(mount_file_id, "/", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - mnt_root_addr = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - mnt_root_addr = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(mount_file_id, "/", &oi, H5P_DEFAULT) < 0) TEST_ERROR + mnt_root_addr = oi.addr; /* Mount a file over a group in main group */ mnt_idx = 2; @@ -8033,16 +8009,11 @@ 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(H5Gget_objinfo(obj_id, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - obj_addr = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - obj_addr = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(obj_id, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the root of the mounted file and not in the previous file */ - if(H5F_addr_ne(obj_addr, mnt_root_addr)) TEST_ERROR - if(H5F_addr_eq(obj_addr, objno[mnt_idx])) TEST_ERROR + if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR + if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR /* Close object */ if(H5Oclose(obj_id) < 0) TEST_ERROR @@ -8086,7 +8057,7 @@ open_by_idx(hid_t fapl) hbool_t 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" */ - H5G_stat_t sb; /* Buffer for querying object's info */ + H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[NAME_BUF_SIZE]; /* Link value */ @@ -8189,12 +8160,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(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - objno[u] = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(group_id2, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR + objno[u] = oi.addr; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -8228,12 +8195,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(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - objno[u] = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(group_id2, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR + objno[u] = oi.addr; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -8319,7 +8282,7 @@ 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 */ - H5G_stat_t sb; /* Buffer for querying object's info */ + H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[NAME_BUF_SIZE]; /* Link value */ @@ -8374,12 +8337,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(H5Gget_objinfo(group_id2, ".", FALSE, &sb) < 0) TEST_ERROR -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - objno[u] = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); -#else - objno[u] = (haddr_t)sb.objno[0]; -#endif + if(H5Oget_info(group_id2, ".", &oi, H5P_DEFAULT) < 0) TEST_ERROR + objno[u] = oi.addr; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR diff --git a/test/mount.c b/test/mount.c index 028f92b..f68589d 100644 --- a/test/mount.c +++ b/test/mount.c @@ -254,7 +254,7 @@ static int test_hide(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5G_stat_t sb1, sb2; + H5O_info_t oi1, oi2; char filename1[1024], filename2[1024]; TESTING("name hiding under mount point"); @@ -266,7 +266,7 @@ test_hide(hid_t fapl) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Gget_objinfo(file1, "/mnt1/file1", TRUE, &sb1) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "/mnt1/file1", &oi1, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Build the virtual file */ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -285,8 +285,8 @@ test_hide(hid_t fapl) * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Gget_objinfo(file1, "/file1", TRUE, &sb2) < 0) FAIL_STACK_ERROR - if(HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { + if(H5Oget_info(file1, "/file1", &oi2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); puts(" Hard link failed for hidden object."); TEST_ERROR @@ -331,7 +331,7 @@ static int test_assoc(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5G_stat_t sb1, sb2; + H5O_info_t oi1, oi2; char filename1[1024], filename2[1024]; TESTING("mount point open"); @@ -344,7 +344,7 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Gget_objinfo(file2, "/", TRUE, &sb1) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file2, "/", &oi1, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create the virtual file */ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -353,8 +353,8 @@ test_assoc(hid_t fapl) * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Gget_objinfo(file1, "/mnt1", TRUE, &sb2) < 0) FAIL_STACK_ERROR - if(HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { + if(H5Oget_info(file1, "/mnt1", &oi2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); puts(" Association failed."); TEST_ERROR @@ -523,6 +523,7 @@ static int test_preopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; + H5O_info_t oinfo; char filename1[1024], filename2[1024]; TESTING("preopening objects under the mount point"); @@ -540,7 +541,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(H5Gget_objinfo(grp, ".", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(grp, ".", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -584,6 +585,7 @@ test_postopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; + H5O_info_t oinfo; char filename1[1024], filename2[1024]; TESTING("open object access after unmount"); @@ -603,10 +605,10 @@ test_postopen(hid_t fapl) if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Gget_objinfo(grp, ".", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(grp, ".", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Try accessing it from the file */ - if(H5Gget_objinfo(file2, "/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file2, "/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Gclose(grp) < 0) FAIL_STACK_ERROR @@ -648,8 +650,9 @@ static int test_unlink(hid_t fapl) { hid_t file1 = -1, file2 = -1, mnt = -1, root = -1; - herr_t status; + H5O_info_t oinfo; char filename1[1024], filename2[1024]; + herr_t status; TESTING("mount point unlinking"); h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); @@ -675,12 +678,12 @@ test_unlink(hid_t fapl) * before the H5Fmount() and thus refers to the mount point itself rather * than the group mounted there. */ - if(H5Gget_objinfo(file1, "/mnt_unlink/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(mnt, "/mnt_unlink/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(root, "/mnt_unlink/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(root, "file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(mnt, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(root, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(root, "file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Gget_objinfo(mnt, "file2", TRUE, NULL); + status = H5Oget_info(mnt, "file2", &oinfo, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -695,9 +698,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(H5Gget_objinfo(root, "file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(root, "file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Gget_objinfo(mnt, "file2", TRUE, NULL); + status = H5Oget_info(mnt, "file2", &oinfo, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -705,7 +708,7 @@ test_unlink(hid_t fapl) TEST_ERROR } /* end if */ H5E_BEGIN_TRY { - status = H5Gget_objinfo(file2, "/mnt_unlink/file2", TRUE, NULL); + status = H5Oget_info(file2, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -776,6 +779,7 @@ static int test_mvmpt(hid_t fapl) { hid_t file1 = -1, file2 = -1; + H5O_info_t oinfo; char filename1[1024], filename2[1024]; TESTING("mount point renaming"); @@ -792,7 +796,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(H5Gget_objinfo(file1, "/mnt_move_b/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "/mnt_move_b/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR @@ -921,6 +925,7 @@ static int test_uniformity(hid_t fapl) { hid_t file1 = -1, file2 = -1; + H5O_info_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle uniformity"); @@ -934,18 +939,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(H5Gget_objinfo(file1, "/", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file1, "/mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file1, "mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file1, "/mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file1, "mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "/", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "/mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "/mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access the same things from the file2 handle */ - if(H5Gget_objinfo(file2, "/", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file2, "/mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file2, "mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file2, "/mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file2, "mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file2, "/", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file2, "/mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file2, "mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file2, "/mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file2, "mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -984,6 +989,7 @@ static int test_close(hid_t fapl) { hid_t file1 = -1, file2 = -1; + H5O_info_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle close"); @@ -1001,7 +1007,7 @@ test_close(hid_t fapl) * still accessible through the file2 handle. */ if(H5Fclose(file1) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file2, "/mnt1", TRUE, NULL) < 0) { + if(H5Oget_info(file2, "/mnt1", &oinfo, H5P_DEFAULT) < 0) { H5_FAILED(); puts(" File1 contents are not accessible!"); TEST_ERROR @@ -1022,7 +1028,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(H5Gget_objinfo(file1, "/mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file1, "/mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Fclose(file1) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ @@ -2255,9 +2261,10 @@ 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 */ - herr_t ret; /* Generic return value */ + H5O_info_t oinfo; char filename1[1024], filename2[1024]; /* Name of files to mount */ + herr_t ret; /* Generic return value */ TESTING("'strong' file close degree"); @@ -2323,9 +2330,9 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Check that objects are still open */ - if (H5Gget_objinfo(gidA, ".", TRUE, NULL) < 0) + if(H5Oget_info(gidA, ".", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR - if (H5Gget_objinfo(gidAM, ".", TRUE, NULL) < 0) + if(H5Oget_info(gidAM, ".", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR /* Close file #2 (should close open objects also) */ @@ -2334,12 +2341,12 @@ test_fcdegree_strong(hid_t fapl) /* Check that objects are closed */ H5E_BEGIN_TRY { - ret = H5Gget_objinfo(gidA, ".", TRUE, NULL); + ret = H5Oget_info(gidA, ".", &oinfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Gget_objinfo(gidAM, ".", TRUE, NULL); + ret = H5Oget_info(gidAM, ".", &oinfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/mtime.c b/test/mtime.c index 0d66e12..d49dd5a 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -63,7 +63,7 @@ main(void) hsize_t size[1] = {2}; time_t now; struct tm *tm; - H5G_stat_t sb1, sb2; + H5O_info_t oi1, oi2; signed char buf1[32], buf2[32]; char filename[1024]; @@ -74,51 +74,51 @@ main(void) /* Create the file, create a dataset, then close the file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; - if ((space=H5Screate_simple(1, size, NULL))<0) TEST_ERROR; - if ((dset=H5Dcreate(file, "dset", H5T_NATIVE_SCHAR, space, H5P_DEFAULT))<0) + if((space = H5Screate_simple(1, size, NULL)) < 0) TEST_ERROR; + if((dset = H5Dcreate(file, "dset", H5T_NATIVE_SCHAR, space, H5P_DEFAULT)) < 0) TEST_ERROR; - now = time(NULL); - if (H5Dclose(dset)<0) TEST_ERROR; - if (H5Sclose(space)<0) TEST_ERROR; - if (H5Fclose(file)<0) TEST_ERROR; + now = HDtime(NULL); + if(H5Dclose(dset) < 0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; + if(H5Fclose(file) < 0) TEST_ERROR; /* - * Open the file and get the modification time. We'll test the new - * H5Gget_objinfo() arguments too: being able to stat something without - * knowing its name. - */ + * Open the file and get the modification time. We'll test the + * H5Oget_info() arguments too: being able to stat something without + * knowing its name. + */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR; - if (H5Gget_objinfo(file, "dset", TRUE, &sb1)<0) TEST_ERROR; - if ((dset=H5Dopen(file, "dset"))<0) TEST_ERROR; - if (H5Gget_objinfo(dset, ".", TRUE, &sb2)<0) TEST_ERROR; - if (H5Dclose(dset)<0) TEST_ERROR; - if (H5Fclose(file)<0) TEST_ERROR; - - /* Compare times from the two ways of calling H5Gget_objinfo() */ - if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)) || sb1.mtime!=sb2.mtime) { + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; + if(H5Oget_info(file, "dset", &oi1, H5P_DEFAULT) < 0) TEST_ERROR; + if((dset = H5Dopen(file, "dset")) < 0) TEST_ERROR; + if(H5Oget_info(dset, ".", &oi2, H5P_DEFAULT) < 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.mtime != oi2.mtime) { H5_FAILED(); - puts(" Calling H5Gget_objinfo() with the dataset ID returned"); + puts(" Calling H5Oget_info() with the dataset ID returned"); puts(" different values than calling it with a file and dataset"); puts(" name."); goto error; } /* Compare times -- they must be within 60 seconds of one another */ - if (0==sb1.mtime) { + if(0 == oi1.mtime) { SKIPPED(); puts(" The modification time could not be decoded on this OS."); puts(" Modification times will be mantained in the file but"); puts(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; - } else if (fabs(HDdifftime(now, sb1.mtime))>60.0) { + } else if(HDfabs(HDdifftime(now, oi1.mtime)) > 60.0) { H5_FAILED(); - tm = localtime(&(sb1.mtime)); - strftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); - tm = localtime(&now); - strftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm); + tm = HDlocaltime(&(oi1.mtime)); + HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); + tm = HDlocaltime(&now); + HDstrftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm); printf(" got: %s\n ans: %s\n", buf1, buf2); goto error; } @@ -131,32 +131,33 @@ main(void) TESTING("accessing old modification time messages"); { - char testfile[512]=""; - char *srcdir = HDgetenv("srcdir"); - if (srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE1) + 1) < sizeof(testfile))){ - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, TESTFILE1); - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0){ - if(H5Gget_objinfo(file, "/Dataset1", TRUE, &sb1)<0) - TEST_ERROR; - if(sb1.mtime!=MTIME1) { + char testfile[512]=""; + char *srcdir = HDgetenv("srcdir"); + + if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE1) + 1) < sizeof(testfile))){ + HDstrcpy(testfile, srcdir); + HDstrcat(testfile, "/"); + } + HDstrcat(testfile, TESTFILE1); + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if(file >= 0){ + if(H5Oget_info(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0) + TEST_ERROR; + if(oi1.mtime != MTIME1) { + H5_FAILED(); + /* If this fails, examine H5Omtime.c. Modification time is very + * system dependant (e.g., on Windows DST must be hardcoded). */ + puts(" Old modification time incorrect"); + goto error; + } + if(H5Fclose(file) < 0) TEST_ERROR; + } + else { H5_FAILED(); - /* If this fails, examine H5Omtime.c. Modification time is very - * system dependant (e.g., on Windows DST must be hardcoded). */ - puts(" Old modification time incorrect"); + printf("***cannot open the pre-created old modification test file (%s)\n", + testfile); goto error; - } - if (H5Fclose(file)<0) TEST_ERROR; - } - else { - H5_FAILED(); - printf("***cannot open the pre-created old modification test file (%s)\n", - testfile); - goto error; - } /* end else */ + } /* end else */ } PASSED(); @@ -166,30 +167,31 @@ main(void) TESTING("accessing new modification time messages"); { - char testfile[512]=""; - char *srcdir = HDgetenv("srcdir"); - if (srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE2) + 1) < sizeof(testfile))){ - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, TESTFILE2); - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0){ - if(H5Gget_objinfo(file, "/Dataset1", TRUE, &sb2)<0) - TEST_ERROR; - if(sb2.mtime!=MTIME2) { - H5_FAILED(); - puts(" Modification time incorrect."); - goto error; + char testfile[512]=""; + char *srcdir = HDgetenv("srcdir"); + + if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE2) + 1) < sizeof(testfile))){ + HDstrcpy(testfile, srcdir); + HDstrcat(testfile, "/"); } - if (H5Fclose(file)<0) TEST_ERROR; - } - else { - H5_FAILED(); - printf("***cannot open the pre-created old modification test file (%s)\n", - testfile); - goto error; - } /* end else */ + HDstrcat(testfile, TESTFILE2); + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if(file >= 0){ + if(H5Oget_info(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0) + TEST_ERROR; + if(oi2.mtime != MTIME2) { + H5_FAILED(); + puts(" Modification time incorrect."); + goto error; + } + if(H5Fclose(file) < 0) TEST_ERROR; + } + else { + H5_FAILED(); + printf("***cannot open the pre-created old modification test file (%s)\n", + testfile); + goto error; + } /* end else */ } PASSED(); @@ -199,9 +201,7 @@ main(void) return 0; /* Something broke */ - error: +error: return 1; } - - diff --git a/test/objcopy.c b/test/objcopy.c index 331add3..88ee026 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -147,13 +147,13 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) *------------------------------------------------------------------------- */ static void -addr_insert(H5G_stat_t *sb) +addr_insert(H5O_info_t *oi) { size_t n; /* Don't add it if the link count is 1 because such an object can only * be encountered once. */ - if(sb->nlink < 2) + if(oi->rc < 2) return; /* Extend the table */ @@ -164,11 +164,7 @@ addr_insert(H5G_stat_t *sb) /* Insert the entry */ n = idtab_g.nobjs++; -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - idtab_g.obj[n] = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); -#else - idtab_g.obj[n] = (haddr_t)sb->objno[0]; -#endif + idtab_g.obj[n] = oi->addr; } /* end addr_insert() */ @@ -187,21 +183,16 @@ addr_insert(H5G_stat_t *sb) *------------------------------------------------------------------------- */ static hbool_t -addr_lookup(H5G_stat_t *sb) +addr_lookup(H5O_info_t *oi) { - haddr_t obj_addr; /* Object's address in the file */ size_t n; - if(sb->nlink<2) return FALSE; /*only one link possible*/ + if(oi->rc < 2) return FALSE; /*only one link possible*/ -#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - obj_addr = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); -#else - obj_addr = (haddr_t)sb->objno[0]; -#endif for(n = 0; n < idtab_g.nobjs; n++) - if(idtab_g.obj[n] == obj_addr) + if(H5F_addr_eq(idtab_g.obj[n], oi->addr)) return TRUE; + return FALSE; } /* end addr_lookup() */ @@ -897,11 +888,12 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if((obj2_id = H5Rdereference(parent2, H5R_OBJECT, ref_buf2)) < 0) TEST_ERROR /* break the infinite loop when the ref_object points to itself */ - if (obj_owner > 0) { - H5G_stat_t stat1, stat2; - if (H5Gget_objinfo(obj_owner, ".", 0, &stat1) < 0) TEST_ERROR - if (H5Gget_objinfo(obj1_id, ".", 0, &stat2) < 0) TEST_ERROR - if ( (stat1.objno[0] == stat2.objno[0]) && (stat1.objno[1] == stat2.objno[1]) ) { + if(obj_owner > 0) { + H5O_info_t oinfo1, oinfo2; + + if(H5Oget_info(obj_owner, ".", &oinfo1, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info(obj1_id, ".", &oinfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -953,12 +945,12 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if((obj2_id = H5Rdereference(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR /* break the infinite loop when the ref_object points to itself */ - if (obj_owner > 0) { - H5G_stat_t stat1, stat2; - if (H5Gget_objinfo(obj_owner, ".", 0, &stat1) < 0) TEST_ERROR - if (H5Gget_objinfo(obj1_id, ".", 0, &stat2) < 0) TEST_ERROR + if(obj_owner > 0) { + H5O_info_t oinfo1, oinfo2; - if ( (stat1.objno[0] == stat2.objno[0]) && (stat1.objno[1] == stat2.objno[1]) ) { + if(H5Oget_info(obj_owner, ".", &oinfo1, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info(obj1_id, ".", &oinfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1270,10 +1262,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) char objname2[NAME_BUF_SIZE]; /* Name of object in group */ H5G_obj_t objtype; /* Type of object in group */ H5G_obj_t objtype2; /* Type of object in group */ - H5G_stat_t objstat; /* Object info */ - H5G_stat_t objstat2; /* Object info */ - H5L_info_t linfo; /* Link information */ - H5L_info_t linfo2; /* Link information */ + H5L_info_t linfo; /* Link information */ + H5L_info_t linfo2; /* Link information */ hid_t oid, oid2; /* IDs of objects within group */ /* Loop over contents of groups */ @@ -1288,12 +1278,22 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if((objtype2 = H5Gget_objtype_by_idx(gid2, idx)) < 0) TEST_ERROR if(objtype != objtype2) TEST_ERROR - /* Compare some pieces of the H5G_stat_t */ - if(H5Gget_objinfo(gid, objname, FALSE, &objstat) < 0) TEST_ERROR - if(H5Gget_objinfo(gid2, objname2, FALSE, &objstat2) < 0) TEST_ERROR - if(objstat.type != objstat2.type) TEST_ERROR - if(objstat.type != H5G_LINK && objstat.type != H5G_UDLINK) { - if(objstat.nlink != objstat2.nlink) 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(linfo.type != linfo2.type) TEST_ERROR + + /* Extra checks for "real" objects */ + if(linfo.type == H5L_TYPE_HARD) { + H5O_info_t oinfo; /* Object info */ + H5O_info_t oinfo2; /* Object info */ + + /* Compare some pieces of the object info */ + if(H5Oget_info(gid, objname, &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info(gid2, objname2, &oinfo2, H5P_DEFAULT) < 0) TEST_ERROR + + if(oinfo.type != oinfo2.type) TEST_ERROR + if(oinfo.rc != oinfo2.rc) TEST_ERROR /* If NULL messages are preserved, the number of messages * should be the same in the destination. @@ -1301,22 +1301,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(objstat.ohdr.nmesgs != objstat2.ohdr.nmesgs) + if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs) ; else - if(objstat.ohdr.nmesgs < objstat2.ohdr.nmesgs) TEST_ERROR + if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR } - } /* end if */ - /* 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 - - /* Check for object already having been compared */ - if(addr_lookup(&objstat)) - continue; - else - addr_insert(&objstat); + /* Check for object already having been compared */ + if(addr_lookup(&oinfo)) + continue; + else + addr_insert(&oinfo); + } /* end if */ /* Compare objects within group */ switch(objtype) { @@ -1385,7 +1381,7 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(H5Lget_val(gid2, objname2, linkval2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR /* Compare link udata */ - if(HDmemcmp(linkval, linkval2, objstat.linklen)) TEST_ERROR + if(HDmemcmp(linkval, linkval2, linfo.u.val_size)) TEST_ERROR } break; diff --git a/test/stab.c b/test/stab.c index e3cfa57..368e00e 100644 --- a/test/stab.c +++ b/test/stab.c @@ -325,7 +325,7 @@ lifecycle(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 */ - H5G_stat_t obj_stat; /* Object info */ + H5O_info_t oinfo; /* 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 */ @@ -416,15 +416,11 @@ lifecycle(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(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR -#ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.ohdr.size != 151) TEST_ERROR -#else /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.ohdr.size != 131) TEST_ERROR -#endif /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.ohdr.free != 0) TEST_ERROR - if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR - if(obj_stat.ohdr.nchunks != 1) TEST_ERROR + if(H5Oget_info(gid, ".", &oinfo, H5P_DEFAULT) < 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 /* Create one more "bottom" group, which should push top group into using a symbol table */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); @@ -442,15 +438,11 @@ lifecycle(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(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR -#ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.ohdr.size != 151) TEST_ERROR -#else /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.ohdr.size != 131) TEST_ERROR -#endif /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.ohdr.free != 92) TEST_ERROR - if(obj_stat.ohdr.nmesgs != 3) TEST_ERROR - if(obj_stat.ohdr.nchunks != 1) TEST_ERROR + if(H5Oget_info(gid, ".", &oinfo, H5P_DEFAULT) < 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 /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { diff --git a/test/tattr.c b/test/tattr.c index d987994..96f6051 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1595,9 +1595,9 @@ test_attr_dtype_shared(hid_t fapl) hid_t space_id; /* Dataspace ID for dataset & attribute */ hid_t type_id; /* Datatype ID for named datatype */ hid_t attr_id; /* Attribute ID */ - int data=8; /* Data to write */ - int rdata=0; /* Read read in */ - H5G_stat_t statbuf; /* Object's information */ + int data = 8; /* Data to write */ + int rdata = 0; /* Read read in */ + H5O_info_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 */ @@ -1606,153 +1606,154 @@ test_attr_dtype_shared(hid_t fapl) MESSAGE(5, ("Testing Shared Datatypes with Attributes\n")); /* Create a file */ - file_id=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file_id, FAIL, "H5Fopen"); /* Close file */ - ret=H5Fclose(file_id); + ret = H5Fclose(file_id); CHECK(ret, FAIL, "H5Fclose"); /* Get size of file */ - empty_filesize=h5_get_file_size(FILENAME); - if(empty_filesize<0) - TestErrPrintf("Line %d: file size wrong!\n",__LINE__); + empty_filesize = h5_get_file_size(FILENAME); + if(empty_filesize < 0) + TestErrPrintf("Line %d: file size wrong!\n", __LINE__); /* Re-open file */ - file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl); + file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(file_id, FAIL, "H5Fopen"); /* Create a datatype to commit and use */ - type_id=H5Tcopy(H5T_NATIVE_INT); + type_id = H5Tcopy(H5T_NATIVE_INT); CHECK(type_id, FAIL, "H5Tcopy"); /* Commit datatype to file */ - ret=H5Tcommit(file_id,TYPE1_NAME,type_id); + ret = H5Tcommit(file_id, TYPE1_NAME, type_id); CHECK(ret, FAIL, "H5Tcommit"); /* Check reference count on named datatype */ - ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 1, "H5Tcommit"); + ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "H5Tcommit"); /* Create dataspace for dataset */ - space_id=H5Screate(H5S_SCALAR); + space_id = H5Screate(H5S_SCALAR); CHECK(space_id, FAIL, "H5Screate"); /* Create dataset */ - dset_id=H5Dcreate(file_id,DSET1_NAME,type_id,space_id,H5P_DEFAULT); + dset_id = H5Dcreate(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT); CHECK(dset_id, FAIL, "H5Dcreate"); /* Check reference count on named datatype */ - ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 2, "H5Dcreate"); + ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "H5Dcreate"); /* Create attribute on dataset */ - attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT); + attr_id = H5Acreate(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate"); /* Check reference count on named datatype */ - ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 3, "H5Acreate"); + ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 3, "H5Acreate"); /* Close attribute */ - ret=H5Aclose(attr_id); + ret = H5Aclose(attr_id); CHECK(ret, FAIL, "H5Aclose"); /* Delete attribute */ - ret=H5Adelete(dset_id,ATTR1_NAME); + ret = H5Adelete(dset_id, ATTR1_NAME); CHECK(ret, FAIL, "H5Adelete"); /* Check reference count on named datatype */ - ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 2, "H5Adelete"); + ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "H5Adelete"); /* Create attribute on dataset */ - attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT); + attr_id = H5Acreate(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate"); /* Check reference count on named datatype */ - ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 3, "H5Acreate"); + ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 3, "H5Acreate"); /* Write data into the attribute */ - ret=H5Awrite(attr_id,H5T_NATIVE_INT,&data); + ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data); CHECK(ret, FAIL, "H5Awrite"); /* Close attribute */ - ret=H5Aclose(attr_id); + ret = H5Aclose(attr_id); CHECK(ret, FAIL, "H5Aclose"); /* Close dataset */ - ret=H5Dclose(dset_id); + ret = H5Dclose(dset_id); CHECK(ret, FAIL, "H5Dclose"); /* Close dataspace */ - ret=H5Sclose(space_id); + ret = H5Sclose(space_id); CHECK(ret, FAIL, "H5Sclose"); /* Close datatype */ - ret=H5Tclose(type_id); + ret = H5Tclose(type_id); CHECK(ret, FAIL, "H5Tclose"); /* Close file */ - ret=H5Fclose(file_id); + ret = H5Fclose(file_id); CHECK(ret, FAIL, "H5Fclose"); + /* Re-open file */ - file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl); + file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(file_id, FAIL, "H5Fopen"); /* Open dataset */ - dset_id=H5Dopen(file_id,DSET1_NAME); + dset_id = H5Dopen(file_id, DSET1_NAME); CHECK(dset_id, FAIL, "H5Dopen"); /* Open attribute */ - attr_id=H5Aopen_name(dset_id,ATTR1_NAME); + attr_id = H5Aopen_name(dset_id, ATTR1_NAME); CHECK(attr_id, FAIL, "H5Aopen_name"); /* Read data from the attribute */ - ret=H5Aread(attr_id,H5T_NATIVE_INT,&rdata); + ret = H5Aread(attr_id, H5T_NATIVE_INT, &rdata); CHECK(ret, FAIL, "H5Aread"); VERIFY(data, rdata, "H5Aread"); /* Close attribute */ - ret=H5Aclose(attr_id); + ret = H5Aclose(attr_id); CHECK(ret, FAIL, "H5Aclose"); /* Close dataset */ - ret=H5Dclose(dset_id); + ret = H5Dclose(dset_id); CHECK(ret, FAIL, "H5Dclose"); /* Check reference count on named datatype */ - ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 3, "H5Gget_objinfo"); + ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 3, "H5Oget_info"); /* Unlink the dataset */ ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ - ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.nlink, 1, "H5Gget_objinfo"); + ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "H5Ldelete"); /* Unlink the named datatype */ ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ - ret=H5Fclose(file_id); + ret = H5Fclose(file_id); CHECK(ret, FAIL, "H5Fclose"); /* Check size of file */ - filesize=h5_get_file_size(FILENAME); + filesize = h5_get_file_size(FILENAME); VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dtype_shared() */ diff --git a/test/testhdf5.h b/test/testhdf5.h index 8817725..45ad476 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -69,15 +69,16 @@ } /* Used to make certain a return value _is_ a value */ -#define VERIFY(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ +#define VERIFY(_x, _val, where) do { \ + long __x = (long)_x, __val = (long)_val; \ + if(GetTestVerbosity() >= VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ + "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ } \ - if ((x) != (val)) { \ + if((__x) != (__val)) { \ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ - "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ + "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ } \ } while(0) diff --git a/test/tfile.c b/test/tfile.c index dc971e7..12f09b8 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1246,11 +1246,8 @@ test_file_freespace(void) /* Check that there is the right amount of free space in the file */ free_space = H5Fget_freespace(file); CHECK(free_space, FAIL, "H5Fget_freespace"); -#ifdef H5_HAVE_LARGE_HSIZET VERIFY(free_space, 2376, "H5Fget_freespace"); -#else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(free_space, 588, "H5Fget_freespace"); /* XXX: fix me */ -#endif /* H5_HAVE_LARGE_HSIZET */ + /* Delete datasets in file */ for(u = 0; u < 10; u++) { sprintf(name, "Dataset %u", u); diff --git a/test/th5o.c b/test/th5o.c index ff434d6..291c73c 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -378,7 +378,7 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5G_stat_t sb; /* Statbuffer for H5Gget_objinfo */ + H5O_info_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ @@ -410,15 +410,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 = H5Gget_objinfo(fid, "group", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "datatype", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "dataset", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); + ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "datatype", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "dataset", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); /* Increment each object's reference count. */ ret = H5Oincr_refcount(grp); @@ -429,15 +429,15 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Oincr_refcount"); /* Get ref counts for each object. They should all be 2 now. */ - ret = H5Gget_objinfo(fid, "group", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 2, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "datatype", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 2, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "dataset", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 2, "reference count in H5Gget_objinfo"); + ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "datatype", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "dataset", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info"); /* Decrement the reference counts and check that they decrease back to 1. */ ret = H5Odecr_refcount(grp); @@ -447,15 +447,15 @@ test_h5o_refcount(void) ret = H5Odecr_refcount(dset); CHECK(ret, FAIL, "H5Odecr_refcount"); - ret = H5Gget_objinfo(fid, "group", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "datatype", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "dataset", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); + ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "datatype", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "dataset", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); /* Increment the reference counts and then close the file to make sure the increment is permanant */ ret = H5Oincr_refcount(grp); @@ -485,15 +485,15 @@ test_h5o_refcount(void) dset = H5Dopen(fid, "dataset"); CHECK(dset, FAIL, "H5Dopen"); - ret = H5Gget_objinfo(fid, "group", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 2, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "datatype", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 2, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "dataset", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 2, "reference count in H5Gget_objinfo"); + ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "datatype", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "dataset", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info"); /* Decrement the reference counts and close the file */ ret = H5Odecr_refcount(grp); @@ -523,15 +523,15 @@ test_h5o_refcount(void) dset = H5Dopen(fid, "dataset"); CHECK(dset, FAIL, "H5Dopen"); - ret = H5Gget_objinfo(fid, "group", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "datatype", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); - ret = H5Gget_objinfo(fid, "dataset", FALSE, &sb); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink, 1, "reference count in H5Gget_objinfo"); + ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "datatype", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); + ret = H5Oget_info(fid, "dataset", &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info"); /* Close the IDs */ ret = H5Gclose(grp); diff --git a/test/titerate.c b/test/titerate.c index 99f099c..bbb57b3 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -54,7 +54,7 @@ typedef enum { /* Custom group iteration callback data */ typedef struct { char name[NAMELEN]; /* The name of the object */ - int type; /* The type of the object */ + H5O_type_t type; /* The type of the object */ iter_enum command; /* The type of return value */ } iter_info; @@ -547,7 +547,7 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t UNUSED *link_info, void *opdata) { const iter_info *test_info = (const iter_info *)opdata; - H5G_stat_t statbuf; + H5O_info_t oinfo; herr_t ret; /* Generic return value */ if(HDstrcmp(name, test_info->name)) { @@ -558,11 +558,11 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t UNUSED *link_info, /* * Get type of the object and check it. */ - ret = H5Gget_objinfo(loc_id, name, FALSE, &statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); + ret = H5Oget_info(loc_id, name, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); - if(test_info->type != statbuf.type) { - TestErrPrintf("test_info->type = %d, statbuf.type = %d\n", test_info->type, statbuf.type); + if(test_info->type != oinfo.type) { + TestErrPrintf("test_info->type = %d, oinfo.type = %d\n", test_info->type, (int)oinfo.type); return(H5_ITER_ERROR); } /* end if */ diff --git a/test/tmisc.c b/test/tmisc.c index 0fe0434..f9abada 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -233,13 +233,8 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset #define MISC20_SPACE_RANK 2 /* Make sure the product of the following 2 does not get too close to */ /* 64 bits, risking an overflow. */ -#ifdef H5_HAVE_LARGE_HSIZET #define MISC20_SPACE_DIM0 (8*1024*1024*(uint64_t)1024) #define MISC20_SPACE_DIM1 ((256*1024*(uint64_t)1024)+1) -#else /* H5_HAVE_LARGE_HSIZET */ -#define MISC20_SPACE_DIM0 (128*(uint64_t)1024) -#define MISC20_SPACE_DIM1 ((4*(uint64_t)1024)+1) -#endif /* H5_HAVE_LARGE_HSIZET */ #define MISC20_SPACE2_DIM0 8 #define MISC20_SPACE2_DIM1 4 @@ -610,7 +605,7 @@ test_misc3(void) /**************************************************************** ** -** test_misc4(): Test the that 'fileno' field in H5G_stat_t is +** test_misc4(): Test the that 'fileno' field in H5O_info_t is ** valid. ** ****************************************************************/ @@ -618,11 +613,11 @@ static void test_misc4(void) { hid_t file1, file2, group1, group2, group3; - H5G_stat_t stat1, stat2, stat3; + H5O_info_t oinfo1, oinfo2, oinfo3; herr_t ret; /* Output message about test being performed */ - MESSAGE(5, ("Testing fileno working in H5G_stat_t\n")); + MESSAGE(5, ("Testing fileno working in H5O_info_t\n")); file1 = H5Fcreate(MISC4_FILE_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); @@ -643,21 +638,21 @@ test_misc4(void) CHECK(group3, FAIL, "H5Gcreate2"); /* Get the stat information for each group */ - ret = H5Gget_objinfo(file1,MISC4_GROUP_1,0,&stat1); - CHECK(ret, FAIL, "H5Gget_objinfo"); - ret = H5Gget_objinfo(file1,MISC4_GROUP_2,0,&stat2); - CHECK(ret, FAIL, "H5Gget_objinfo"); - ret = H5Gget_objinfo(file2,MISC4_GROUP_1,0,&stat3); - CHECK(ret, FAIL, "H5Gget_objinfo"); + ret = H5Oget_info(file1, MISC4_GROUP_1, &oinfo1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info(file1, MISC4_GROUP_2, &oinfo2, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info(file2, MISC4_GROUP_1, &oinfo3, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); /* Verify that the fileno values are the same for groups from file1 */ - VERIFY(stat1.fileno[0],stat2.fileno[0],"H5Gget_objinfo"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "H5Oget_info"); /* Verify that the fileno values are not the same between file1 & file2 */ - if(stat1.fileno[0]==stat3.fileno[0]) - TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); - if(stat2.fileno[0]==stat3.fileno[0]) - TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); + if(oinfo1.fileno == oinfo3.fileno) + TestErrPrintf("Error on line %d: oinfo1.fileno != oinfo3.fileno\n", __LINE__); + if(oinfo2.fileno == oinfo3.fileno) + TestErrPrintf("Error on line %d: oinfo2.fileno != oinfo3.fileno\n", __LINE__); /* Close the objects */ ret = H5Gclose(group1); @@ -2832,7 +2827,7 @@ test_misc17(void) /**************************************************************** ** -** test_misc18(): Test new object header information in H5G_stat_t +** test_misc18(): Test new object header information in H5O_info_t ** struct. ** ****************************************************************/ @@ -2843,7 +2838,7 @@ test_misc18(void) hid_t sid; /* 'Space ID */ hid_t did1, did2; /* Dataset IDs */ hid_t aid; /* Attribute ID */ - H5G_stat_t statbuf; /* Information about object */ + H5O_info_t oinfo; /* Information about object */ char attr_name[32]; /* Attribute name buffer */ unsigned u; /* Local index variable */ herr_t ret; /* Generic return value */ @@ -2861,34 +2856,26 @@ test_misc18(void) CHECK(did1, FAIL, "H5Dcreate"); /* Get object information */ - ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo"); -#ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.ohdr.free, 152, "H5Gget_objinfo"); -#else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.ohdr.free, 160, "H5Gget_objinfo"); -#endif /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.linklen, 0, "H5Gget_objinfo"); + ret = H5Oget_info(fid, MISC18_DSET1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info"); + VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info"); + VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info"); + VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); /* Create second dataset */ did2 = H5Dcreate(fid, MISC18_DSET2_NAME, H5T_STD_U32LE, sid, H5P_DEFAULT); CHECK(did2, FAIL, "H5Screate_simple"); /* Get object information */ - ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo"); -#ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.ohdr.free, 152, "H5Gget_objinfo"); -#else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.ohdr.free, 160, "H5Gget_objinfo"); -#endif /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.linklen, 0, "H5Gget_objinfo"); + ret = H5Oget_info(fid, MISC18_DSET2_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info"); + VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info"); + VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info"); + VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); /* Loop creating attributes on each dataset, flushing them to the file each time */ for(u=0; u<10; u++) { @@ -2897,14 +2884,14 @@ test_misc18(void) /* Create & close attribute on first dataset */ aid = H5Acreate(did1, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Gget_objinfo"); + CHECK(aid, FAIL, "H5Acreate"); ret = H5Aclose(aid); CHECK(ret, FAIL, "HAclose"); /* Create & close attribute on second dataset */ aid = H5Acreate(did2, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Gget_objinfo"); + CHECK(aid, FAIL, "H5Acreate"); ret = H5Aclose(aid); CHECK(ret, FAIL, "HAclose"); @@ -2915,36 +2902,22 @@ test_misc18(void) } /* end for */ /* Get object information for dataset #1 now */ - ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); -#ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.ohdr.nmesgs, 24, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.free, 16, "H5Gget_objinfo"); -#else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.ohdr.nmesgs, 26, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.free, 24, "H5Gget_objinfo"); -#endif /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.linklen, 0, "H5Gget_objinfo"); + ret = H5Oget_info(fid, MISC18_DSET1_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info"); + VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info"); + VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info"); + VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info"); + VERIFY(oinfo.num_attrs, 10, "H5Oget_info"); /* Get object information for dataset #2 now */ - ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf); - CHECK(ret, FAIL, "H5Gget_objinfo"); -#ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.ohdr.nmesgs, 24, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.free, 16, "H5Gget_objinfo"); -#else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.ohdr.nmesgs, 26, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.ohdr.free, 24, "H5Gget_objinfo"); -#endif /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.linklen, 0, "H5Gget_objinfo"); + ret = H5Oget_info(fid, MISC18_DSET2_NAME, &oinfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info"); + VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info"); + VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info"); + VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info"); + VERIFY(oinfo.num_attrs, 10, "H5Oget_info"); /* Close second dataset */ ret = H5Dclose(did2); @@ -3426,10 +3399,8 @@ test_misc20(void) CHECK(dcpl, FAIL, "H5Pcreate"); /* Try to use chunked storage for this dataset */ -#ifdef H5_HAVE_LARGE_HSIZET - ret = H5Pset_chunk(dcpl,rank,big_dims); + ret = H5Pset_chunk(dcpl, rank, big_dims); VERIFY(ret, FAIL, "H5Pset_chunk"); -#endif /* H5_HAVE_LARGE_HSIZET */ /* Verify that the storage for the dataset is the correct size and hasn't * been truncated. @@ -3440,11 +3411,11 @@ test_misc20(void) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataspace with _really_ big dimensions */ - sid = H5Screate_simple(rank,big_dims,NULL); + sid = H5Screate_simple(rank, big_dims, NULL); CHECK(sid, FAIL, "H5Screate_simple"); /* Make certain that the dataset's storage doesn't get allocated :-) */ - ret = H5Pset_alloc_time(dcpl,H5D_ALLOC_TIME_LATE); + ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); CHECK(ret, FAIL, "H5Pset_alloc_time"); /* Create dataset with big dataspace */ @@ -3452,15 +3423,15 @@ test_misc20(void) CHECK(did, FAIL, "H5Dcreate"); /* Close datasset */ - ret=H5Dclose(did); + ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); /* Close dataspace */ - ret=H5Sclose(sid); + ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); /* Create dataspace with small dimensions */ - sid = H5Screate_simple(rank,small_dims,NULL); + sid = H5Screate_simple(rank, small_dims, NULL); CHECK(sid, FAIL, "H5Screate_simple"); /* Create dataset with big dataspace */ @@ -3468,15 +3439,15 @@ test_misc20(void) CHECK(did, FAIL, "H5Dcreate"); /* Close datasset */ - ret=H5Dclose(did); + ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); /* Close dataspace */ - ret=H5Sclose(sid); + ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); /* Close dataset creation property list */ - ret=H5Pclose(dcpl); + ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); /* Close file */ @@ -3494,15 +3465,15 @@ test_misc20(void) /* Get the layout version */ ret = H5D_layout_version_test(did,&version); CHECK(ret, FAIL, "H5D_layout_version_test"); - VERIFY(version,3,"H5D_layout_version_test"); + VERIFY(version, 3, "H5D_layout_version_test"); /* Get the layout contiguous storage size */ ret = H5D_layout_contig_size_test(did,&contig_size); CHECK(ret, FAIL, "H5D_layout_contig_size_test"); - VERIFY(contig_size, MISC20_SPACE_DIM0*MISC20_SPACE_DIM1*H5Tget_size(H5T_NATIVE_INT), "H5D_layout_contig_size_test"); + VERIFY(contig_size, (MISC20_SPACE_DIM0 * MISC20_SPACE_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5D_layout_contig_size_test"); /* Close datasset */ - ret=H5Dclose(did); + ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); /* Open dataset with small dimensions */ @@ -3512,15 +3483,15 @@ test_misc20(void) /* Get the layout version */ ret = H5D_layout_version_test(did,&version); CHECK(ret, FAIL, "H5D_layout_version_test"); - VERIFY(version,3,"H5D_layout_version_test"); + VERIFY(version, 3, "H5D_layout_version_test"); /* Get the layout contiguous storage size */ ret = H5D_layout_contig_size_test(did,&contig_size); CHECK(ret, FAIL, "H5D_layout_contig_size_test"); - VERIFY(contig_size, MISC20_SPACE2_DIM0*MISC20_SPACE2_DIM1*H5Tget_size(H5T_NATIVE_INT), "H5D_layout_contig_size_test"); + VERIFY(contig_size, (MISC20_SPACE2_DIM0 * MISC20_SPACE2_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5D_layout_contig_size_test"); /* Close datasset */ - ret=H5Dclose(did); + ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); /* Close file */ @@ -3530,7 +3501,7 @@ test_misc20(void) /* Verify that the storage size is computed correctly for older versions of layout info */ /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC20_FILE_OLD) + 1) < sizeof(testfile))) { + if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC20_FILE_OLD) + 1) < sizeof(testfile))) { HDstrcpy(testfile, srcdir); HDstrcat(testfile, "/"); } @@ -3539,30 +3510,26 @@ test_misc20(void) /* * Open the old file and the dataset and get old settings. */ - fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Open dataset with small dimensions */ did = H5Dopen(fid, MISC20_DSET_NAME); -#ifdef H5_HAVE_LARGE_HSIZET CHECK(did, FAIL, "H5Dopen"); /* Get the layout version */ ret = H5D_layout_version_test(did,&version); CHECK(ret, FAIL, "H5D_layout_version_test"); - VERIFY(version,2,"H5D_layout_version_test"); + VERIFY(version, 2, "H5D_layout_version_test"); /* Get the layout contiguous storage size */ ret = H5D_layout_contig_size_test(did,&contig_size); CHECK(ret, FAIL, "H5D_layout_contig_size_test"); - VERIFY(contig_size, MISC20_SPACE_DIM0*MISC20_SPACE_DIM1*H5Tget_size(H5T_STD_I32LE), "H5D_layout_contig_size_test"); + VERIFY(contig_size, (MISC20_SPACE_DIM0 * MISC20_SPACE_DIM1 * H5Tget_size(H5T_STD_I32LE)), "H5D_layout_contig_size_test"); /* Close datasset */ - ret=H5Dclose(did); + ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); -#else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(did, FAIL, "H5Dopen"); -#endif /* H5_HAVE_LARGE_HSIZET */ /* Close file */ ret = H5Fclose(fid); @@ -3797,12 +3764,12 @@ test_misc22(void) static void test_misc23(void) { - herr_t status; hsize_t dims[] = {10}; 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 */ - H5G_stat_t sb; + H5O_info_t oinfo; + herr_t status; /* Output message about test being performed */ MESSAGE(5, ("Testing intermediate group creation\n")); @@ -3869,7 +3836,7 @@ test_misc23(void) CHECK(tmp_id, FAIL, "H5Gcreate2"); /* Query that the name of the new group is correct */ - status = H5Iget_name( tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE ); + status = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); CHECK(status, FAIL, "H5Iget_name"); VERIFY_STR(objname, "/A/B01/grp", "H5Iget_name"); @@ -3880,9 +3847,9 @@ test_misc23(void) tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT); CHECK(tmp_id, FAIL, "H5Gopen2"); - status = H5Gget_objinfo(tmp_id, ".", FALSE, &sb); - CHECK(status, FAIL, "H5Gget_objinfo"); - VERIFY(sb.nlink,1,"H5Gget_objinfo"); + status = H5Oget_info(tmp_id, ".", &oinfo, H5P_DEFAULT); + CHECK(status, FAIL, "H5Oget_info"); + VERIFY(oinfo.rc, 1, "H5Oget_info"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); @@ -4841,7 +4808,7 @@ test_misc(void) test_misc1(); /* Test unlinking a dataset & immediately re-using name */ test_misc2(); /* Test storing a VL-derived datatype in two different files */ test_misc3(); /* Test reading from chunked dataset with non-zero fill value */ - test_misc4(); /* Test retrieving the fileno for various objects with H5Gget_objinfo() */ + test_misc4(); /* Test retrieving the fileno for various objects with H5Oget_info() */ test_misc5(); /* Test several level deep nested compound & VL datatypes */ test_misc6(); /* Test object header continuation code */ test_misc7(); /* Test for sensible datatypes stored on disk */ @@ -4855,7 +4822,7 @@ test_misc(void) test_misc15(); /* Test that checking a file's access property list more than once works */ test_misc16(); /* Test array of fixed-length string */ test_misc17(); /* Test array of ASCII character */ - test_misc18(); /* Test new object header information in H5G_stat_t struct */ + test_misc18(); /* Test new object header information in H5O_info_t struct */ test_misc19(); /* Test incrementing & decrementing ref count on IDs */ test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */ #if defined H5_HAVE_FILTER_SZIP diff --git a/test/tsohm.c b/test/tsohm.c index 16acf71..f5b5235 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -735,7 +735,7 @@ static void test_sohm_size1(void) h5_stat_size_t norm_final_filesize2; h5_stat_size_t sohm_final_filesize2; h5_stat_size_t sohm_btree_final_filesize2; - H5G_stat_t statbuf; + H5O_info_t oinfo; unsigned num_indexes = 1; unsigned index_flags = H5O_MESG_DTYPE_FLAG; unsigned min_mesg_size = 50; @@ -776,11 +776,11 @@ static void test_sohm_size1(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Gget_objinfo(file, DSETNAME[0], 0, &statbuf); - CHECK_I(ret, "H5Gget_objinfo"); + ret = H5Oget_info(file, DSETNAME[0], &oinfo, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_info"); ret = H5Fclose(file); CHECK_I(ret, "H5Fclose"); - norm_oh_size = statbuf.ohdr.size; + norm_oh_size = oinfo.hdr.space.total; /* Get the new file size */ norm_final_filesize = h5_get_file_size(FILENAME); @@ -832,11 +832,11 @@ static void test_sohm_size1(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Gget_objinfo(file, DSETNAME[0], 0, &statbuf); - CHECK_I(ret, "H5Gget_objinfo"); + ret = H5Oget_info(file, DSETNAME[0], &oinfo, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_info"); ret = H5Fclose(file); CHECK_I(ret, "H5Fclose"); - sohm_oh_size = statbuf.ohdr.size; + sohm_oh_size = oinfo.hdr.space.total; /* Get the new file size */ sohm_final_filesize = h5_get_file_size(FILENAME); @@ -887,11 +887,11 @@ static void test_sohm_size1(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Gget_objinfo(file, DSETNAME[0], 0, &statbuf); - CHECK_I(ret, "H5Gget_objinfo"); + ret = H5Oget_info(file, DSETNAME[0], &oinfo, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_info"); ret = H5Fclose(file); CHECK_I(ret, "H5Fclose"); - sohm_btree_oh_size = statbuf.ohdr.size; + sohm_btree_oh_size = oinfo.hdr.space.total; /* Get the new file size */ sohm_btree_final_filesize = h5_get_file_size(FILENAME); @@ -924,10 +924,10 @@ static void test_sohm_size1(void) * continuation message and a NULL message. if(sohm_oh_size >= norm_oh_size) - VERIFY(sohm_oh_size, 1, "H5Gget_objinfo"); + VERIFY(sohm_oh_size, 1, "H5Oget_info"); */ if(sohm_oh_size != sohm_btree_oh_size) - VERIFY(sohm_btree_oh_size, 1, "H5Gget_objinfo"); + VERIFY(sohm_btree_oh_size, 1, "H5Oget_info"); /* Both sohm files should be bigger than a normal file when empty. * It's hard to say whether a B-tree with no nodes allocated should be diff --git a/test/unlink.c b/test/unlink.c index a3a4213..9ac7532 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -439,7 +439,7 @@ static int check_new_move(hid_t fapl) { hid_t file; - H5G_stat_t sb_hard1, sb_hard2; + H5O_info_t oi_hard1, oi_hard2; char filename[1024]; char linkval[1024]; @@ -447,20 +447,24 @@ check_new_move(hid_t fapl) /* Open file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR /* Get hard link info */ - if(H5Gget_objinfo(file, "/group2/group_new_name", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file, "/group1/hard", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR + if(H5Oget_info(file, "/group2/group_new_name", &oi_hard1, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + if(H5Oget_info(file, "/group1/hard", &oi_hard2, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* Check hard links */ - if(H5G_GROUP != sb_hard1.type || H5G_GROUP != sb_hard2.type) + 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(HDmemcmp(&sb_hard1.objno, &sb_hard2.objno, sizeof(sb_hard1.objno))) + if(H5F_addr_ne(oi_hard1.addr, oi_hard2.addr)) FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.") /* Check soft links */ - if(H5Lget_val(file, "group2/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_val(file, "group2/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR if(HDstrcmp(linkval, "/group1/group_move")) FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value") @@ -2128,7 +2132,7 @@ test_full_group_compact(hid_t fapl) { hid_t file_id = -1; hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5G_stat_t sb; /* Stat buffer for object */ + H5O_info_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 */ @@ -2200,8 +2204,8 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR - if(sb.nlink != 2) TEST_ERROR + if(H5Oget_info(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(oi.rc != 2) TEST_ERROR } /* end for */ /* Close the file */ @@ -2217,8 +2221,8 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR - if(sb.nlink != 1) TEST_ERROR + if(H5Oget_info(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(oi.rc != 1) TEST_ERROR } /* end for */ /* Close the file */ @@ -2262,7 +2266,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 */ - H5G_stat_t sb; /* Stat buffer for object */ + H5O_info_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 */ @@ -2346,8 +2350,8 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR - if(sb.nlink != 2) TEST_ERROR + if(H5Oget_info(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(oi.rc != 2) TEST_ERROR } /* end for */ /* Close the file */ @@ -2363,8 +2367,8 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Gget_objinfo(file_id, objname, TRUE, &sb) < 0) FAIL_STACK_ERROR - if(sb.nlink != 1) TEST_ERROR + if(H5Oget_info(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(oi.rc != 1) TEST_ERROR } /* end for */ /* Close the file */ @@ -1017,10 +1017,8 @@ test_multi(void) /* Before any data is written, the raw data file is empty. So * the file size is only the size of b-tree + HADDR_MAX/4. */ -#ifdef H5_HAVE_LARGE_HSIZET if(file_size < HADDR_MAX/4 || file_size > HADDR_MAX/2) TEST_ERROR; -#endif /* H5_HAVE_LARGE_HSIZET */ if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0) TEST_ERROR; @@ -1055,10 +1053,8 @@ test_multi(void) * beginning of raw data file is set at HADDR_MAX/2. It's supposed * to be (HADDR_MAX/2 + 128*128*4) */ -#ifdef H5_HAVE_LARGE_HSIZET if(file_size < HADDR_MAX/2 || file_size > HADDR_MAX) TEST_ERROR; -#endif /* H5_HAVE_LARGE_HSIZET */ if(H5Sclose(space)<0) TEST_ERROR; |