diff options
79 files changed, 8321 insertions, 8112 deletions
diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 3a94664..a90c24b 100644 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -327,8 +327,10 @@ h5ltset_attribute_c(hid_t_f *loc_id, ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_INT, (const int *)buf); else if ((size_t)*sizeof_val == sizeof(long)) ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LONG, (const long *)buf); +#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG else if ((size_t)*sizeof_val == sizeof(long long)) ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LLONG, (const long long *)buf); +#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else goto done; } else if ( HDstrncmp(dtype,"R",1) == 0 ) { @@ -420,8 +422,10 @@ h5ltget_attribute_c(hid_t_f *loc_id, ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_INT,buf); else if ((size_t)*sizeof_val == sizeof(long)) ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LONG,buf); +#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG else if ((size_t)*sizeof_val == sizeof(long long)) ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LLONG,buf); +#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else goto done; } else if ( HDstrncmp(dtype,"R",1) == 0 ) { diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index 266f74a..a31c751 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -380,7 +380,6 @@ CONTAINS INTEGER :: errcode ! error code INTEGER(size_t) :: namelen ! name length - INTEGER(hsize_t) :: i ! general purpose integer INTERFACE INTEGER FUNCTION h5tbread_table_c(loc_id,& diff --git a/hl/fortran/test/tstds.F90 b/hl/fortran/test/tstds.F90 index cbf6c38..f5df4ef 100644 --- a/hl/fortran/test/tstds.F90 +++ b/hl/fortran/test/tstds.F90 @@ -12,25 +12,59 @@ ! * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * ! * access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -PROGRAM test_ds + +MODULE TSTDS + +CONTAINS + +!------------------------------------------------------------------------- +! test_begin +!------------------------------------------------------------------------- + +SUBROUTINE test_begin(string) + CHARACTER(LEN=*), INTENT(IN) :: string + WRITE(*, fmt = '(A)', advance = 'no') ADJUSTL(string) +END SUBROUTINE test_begin + +!------------------------------------------------------------------------- +! passed/failed +!------------------------------------------------------------------------- +SUBROUTINE write_test_status( test_result) + +! Writes the results of the tests IMPLICIT NONE - INTEGER :: err + INTEGER, INTENT(IN) :: test_result ! negative, failed + ! 0 , passed - CALL test_testds(err) +! Controls the output style for reporting test results - IF(err.LT.0)THEN - WRITE(*,'(5X,A)') "DIMENSION SCALES TEST *FAILED*" + CHARACTER(LEN=8) :: error_string + CHARACTER(LEN=8), PARAMETER :: success = ' PASSED ' + CHARACTER(LEN=8), PARAMETER :: failure = '*FAILED*' + + error_string = failure + IF (test_result .EQ. 0) THEN + error_string = success ENDIF + + WRITE(*, fmt = '(T34, A)') error_string -END PROGRAM test_ds +END SUBROUTINE write_test_status + +END MODULE TSTDS + +MODULE TSTDS_TESTS + +CONTAINS SUBROUTINE test_testds(err) USE HDF5 USE H5LT USE H5DS + USE TSTDS ! module for testing dataset support routines IMPLICIT NONE @@ -44,7 +78,6 @@ SUBROUTINE test_testds(err) CHARACTER(LEN=6), PARAMETER :: DSET_NAME = "Mydata" CHARACTER(LEN=5), PARAMETER :: DS_1_NAME = "Yaxis" - CHARACTER(LEN=5), PARAMETER :: DS_1_NAME_A = "Yaxiz" CHARACTER(LEN=5), PARAMETER :: DS_2_NAME = "Xaxis" @@ -316,38 +349,21 @@ SUBROUTINE test_testds(err) END SUBROUTINE test_testds -!------------------------------------------------------------------------- -! test_begin -!------------------------------------------------------------------------- - -SUBROUTINE test_begin(string) - CHARACTER(LEN=*), INTENT(IN) :: string - WRITE(*, fmt = '(A)', advance = 'no') ADJUSTL(string) -END SUBROUTINE test_begin +END MODULE TSTDS_TESTS -!------------------------------------------------------------------------- -! passed/failed -!------------------------------------------------------------------------- -SUBROUTINE write_test_status( test_result) - -! Writes the results of the tests +PROGRAM test_ds + USE TSTDS_TESTS ! module for testing dataset routines + IMPLICIT NONE - INTEGER, INTENT(IN) :: test_result ! negative, failed - ! 0 , passed - -! Controls the output style for reporting test results + INTEGER :: err - CHARACTER(LEN=8) :: error_string - CHARACTER(LEN=8), PARAMETER :: success = ' PASSED ' - CHARACTER(LEN=8), PARAMETER :: failure = '*FAILED*' + CALL test_testds(err) - error_string = failure - IF (test_result .EQ. 0) THEN - error_string = success + IF(err.LT.0)THEN + WRITE(*,'(5X,A)') "DIMENSION SCALES TEST *FAILED*" ENDIF - - WRITE(*, fmt = '(T34, A)') error_string -END SUBROUTINE write_test_status +END PROGRAM test_ds + diff --git a/hl/fortran/test/tstimage.F90 b/hl/fortran/test/tstimage.F90 index 0bff6b2..7e90664 100644 --- a/hl/fortran/test/tstimage.F90 +++ b/hl/fortran/test/tstimage.F90 @@ -17,12 +17,34 @@ ! This file contains the FORTRAN90 tests for H5LT ! -program image_test +MODULE TSTIMAGE -call make_image1() +CONTAINS -end program image_test +!------------------------------------------------------------------------- +! test_begin +!------------------------------------------------------------------------- + +subroutine test_begin(string) +character(len=*), intent(in) :: string +write(*, fmt = '(14a)', advance = 'no') string +write(*, fmt = '(40x,a)', advance = 'no') ' ' +end subroutine test_begin + +!------------------------------------------------------------------------- +! passed +!------------------------------------------------------------------------- + +subroutine passed() +write(*, fmt = '(6a)') 'PASSED' +end subroutine passed + +END MODULE TSTIMAGE + + +MODULE TSTIMAGE_TESTS +CONTAINS !------------------------------------------------------------------------- ! make_image1 @@ -32,6 +54,7 @@ subroutine make_image1() use h5im ! module of H5IM use hdf5 ! module of HDF5 library +USE TSTIMAGE ! module for testing image support routines implicit none @@ -320,20 +343,17 @@ call h5close_f(errcode) ! end subroutine make_image1 -!------------------------------------------------------------------------- -! test_begin -!------------------------------------------------------------------------- +END MODULE TSTIMAGE_TESTS -subroutine test_begin(string) -character(len=*), intent(in) :: string -write(*, fmt = '(14a)', advance = 'no') string -write(*, fmt = '(40x,a)', advance = 'no') ' ' -end subroutine test_begin -!------------------------------------------------------------------------- -! passed -!------------------------------------------------------------------------- +program image_test + +USE TSTIMAGE_TESTS ! module for testing dataset routines + +IMPLICIT NONE + +call make_image1() + +end program image_test + -subroutine passed() -write(*, fmt = '(6a)') 'PASSED' -end subroutine passed diff --git a/hl/fortran/test/tstlite.F90 b/hl/fortran/test/tstlite.F90 index 3937c3c..9d47c59 100644 --- a/hl/fortran/test/tstlite.F90 +++ b/hl/fortran/test/tstlite.F90 @@ -18,19 +18,33 @@ ! #include <H5config_f.inc> -PROGRAM lite_test - - CALL test_dataset1D() - CALL test_dataset2D() - CALL test_dataset3D() - CALL test_datasetND(4) - CALL test_datasetND(5) - CALL test_datasetND(6) - CALL test_datasetND(7) - CALL test_datasets() - CALL test_attributes() +MODULE TSTLITE -END PROGRAM lite_test +CONTAINS + +!------------------------------------------------------------------------- +! test_begin +!------------------------------------------------------------------------- + +SUBROUTINE test_begin(string) + CHARACTER(LEN=*), INTENT(IN) :: string + WRITE(*, fmt = '(14a)', advance = 'no') string + WRITE(*, fmt = '(40x,a)', advance = 'no') ' ' +END SUBROUTINE test_begin + +!------------------------------------------------------------------------- +! passed +!------------------------------------------------------------------------- + +SUBROUTINE passed() + WRITE(*, fmt = '(6a)') 'PASSED' +END SUBROUTINE passed + +END MODULE TSTLITE + +MODULE TSTLITE_TESTS + +CONTAINS !------------------------------------------------------------------------- @@ -42,6 +56,7 @@ SUBROUTINE test_dataset1D() USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library + USE TSTLITE ! module for testing lite support routines IMPLICIT NONE @@ -191,6 +206,7 @@ SUBROUTINE test_dataset2D() USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library + USE TSTLITE ! module for testing lite support routines IMPLICIT NONE @@ -387,6 +403,7 @@ SUBROUTINE test_dataset3D() USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library + USE TSTLITE ! module for testing lite support routines IMPLICIT NONE @@ -702,6 +719,7 @@ SUBROUTINE test_datasetND(rank) USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library + USE TSTLITE ! module for testing lite support routines IMPLICIT NONE @@ -1293,6 +1311,7 @@ SUBROUTINE test_datasets() USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library + USE TSTLITE ! module for testing lite support routines IMPLICIT NONE @@ -1302,7 +1321,6 @@ SUBROUTINE test_datasets() INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array INTEGER, PARAMETER :: LEN0 = 3 INTEGER, PARAMETER :: LEN1 = 12 - CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name @@ -1665,21 +1683,21 @@ SUBROUTINE test_attributes() USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library + USE TSTLITE ! module for testing lite support routines IMPLICIT NONE CHARACTER(len=9), PARAMETER :: filename = "dsetf5.h5"! File name - CHARACTER(len=9), PARAMETER :: filename1 ="tattr.h5" ! C written attribute file +!!$ CHARACTER(len=9), PARAMETER :: filename1 ="tattr.h5" ! C written attribute file INTEGER(HID_T) :: file_id ! File identifier ! INTEGER(HID_T) :: file_id1 INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array - CHARACTER(LEN=5), PARAMETER :: attrname1 = "attr1" ! Attribute name CHARACTER(LEN=5), PARAMETER :: attrname2 = "attr2" ! Attribute name CHARACTER(LEN=5), PARAMETER :: attrname3 = "attr3" ! Attribute name CHARACTER(LEN=5), PARAMETER :: attrname4 = "attr4" ! Attribute name CHARACTER(LEN=5), PARAMETER :: attrname5 = "attr5" ! Attribute name CHARACTER(LEN=8), PARAMETER :: buf1 = "mystring" ! Data buffer - CHARACTER(LEN=16), PARAMETER :: buf_c = "string attribute" +!!$ CHARACTER(LEN=16), PARAMETER :: buf_c = "string attribute" CHARACTER(LEN=8) :: bufr1 ! Data buffer CHARACTER(LEN=10) :: bufr1_lg ! Data buffer ! CHARACTER(LEN=16) :: bufr_c ! Data buffer @@ -1969,20 +1987,24 @@ SUBROUTINE test_attributes() ! END SUBROUTINE test_attributes -!------------------------------------------------------------------------- -! test_begin -!------------------------------------------------------------------------- +END MODULE TSTLITE_TESTS -SUBROUTINE test_begin(string) - CHARACTER(LEN=*), INTENT(IN) :: string - WRITE(*, fmt = '(14a)', advance = 'no') string - WRITE(*, fmt = '(40x,a)', advance = 'no') ' ' -END SUBROUTINE test_begin +PROGRAM lite_test + + USE TSTLITE_TESTS ! module for testing lite routines + + IMPLICIT NONE + + CALL test_dataset1D() + CALL test_dataset2D() + CALL test_dataset3D() + CALL test_datasetND(4) + CALL test_datasetND(5) + CALL test_datasetND(6) + CALL test_datasetND(7) + CALL test_datasets() + CALL test_attributes() + +END PROGRAM lite_test -!------------------------------------------------------------------------- -! passed -!------------------------------------------------------------------------- -SUBROUTINE passed() - WRITE(*, fmt = '(6a)') 'PASSED' -END SUBROUTINE passed diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index 5c55a66..822f116 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -18,29 +18,33 @@ ! #include <H5config_f.inc> -PROGRAM table_test +MODULE TSTTABLE - USE H5TB ! module of H5TB - USE HDF5 ! module of HDF5 library +CONTAINS - IMPLICIT NONE - INTEGER :: errcode = 0 +!------------------------------------------------------------------------- +! test_begin +!------------------------------------------------------------------------- - ! - ! Initialize FORTRAN predefined datatypes. - ! - CALL h5open_f(errcode) +SUBROUTINE test_begin(string) + CHARACTER(LEN=*), INTENT(IN) :: string + WRITE(*, fmt = '(A)', ADVANCE = 'no') string +END SUBROUTINE test_begin - CALL test_table1() - CALL test_table2() +!------------------------------------------------------------------------- +! passed +!------------------------------------------------------------------------- - ! - ! Close FORTRAN predefined datatypes. - ! - CALL h5close_f(errcode) +SUBROUTINE passed() + WRITE(*, fmt = '(T12,A6)') 'PASSED' +END SUBROUTINE passed + +END MODULE TSTTABLE -END PROGRAM table_test +MODULE TSTTABLE_TESTS + +CONTAINS !------------------------------------------------------------------------- ! test_table1 @@ -50,6 +54,7 @@ SUBROUTINE test_table1() USE H5TB ! module of H5TB USE HDF5 ! module of HDF5 library + USE TSTTABLE ! module for testing table support routines IMPLICIT NONE @@ -536,6 +541,7 @@ SUBROUTINE test_table2() USE H5TB ! module of H5TB USE HDF5 ! module of HDF5 library + USE TSTTABLE ! module for testing table support routines IMPLICIT NONE @@ -574,7 +580,6 @@ SUBROUTINE test_table2() INTEGER(hsize_t), PARAMETER :: chunk_size = 10 TYPE(particle_t), DIMENSION(1:nrecords), TARGET :: fill_data INTEGER :: compress - INTEGER :: status INTEGER :: i INTEGER(SIZE_T) :: dst_size TYPE(particle_t), DIMENSION(1:nrecords), TARGET :: dst_buf @@ -711,22 +716,31 @@ SUBROUTINE test_table2() END SUBROUTINE test_table2 +END MODULE TSTTABLE_TESTS -!------------------------------------------------------------------------- -! test_begin -!------------------------------------------------------------------------- -SUBROUTINE test_begin(string) - CHARACTER(LEN=*), INTENT(IN) :: string - WRITE(*, fmt = '(A)', ADVANCE = 'no') string -END SUBROUTINE test_begin +PROGRAM table_test -!------------------------------------------------------------------------- -! passed -!------------------------------------------------------------------------- + USE H5TB ! module of H5TB + USE HDF5 ! module of HDF5 library + USE TSTTABLE_TESTS ! module for testing table routines -SUBROUTINE passed() - WRITE(*, fmt = '(T12,A6)') 'PASSED' -END SUBROUTINE passed + IMPLICIT NONE + INTEGER :: errcode = 0 + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5open_f(errcode) + + CALL test_table1() + CALL test_table2() + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_f(errcode) + +END PROGRAM table_test @@ -183,13 +183,13 @@ done: herr_t H5AC__init_package(void) { +#ifdef H5_DEBUG_BUILD H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ + H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */ +#endif /* H5_DEBUG_BUILD */ #ifdef H5_HAVE_PARALLEL H5P_coll_md_read_flag_t coll_meta_read; #endif /* H5_HAVE_PARALLEL */ -#ifdef H5_DEBUG_BUILD - H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */ -#endif /* H5_DEBUG_BUILD */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -201,9 +201,8 @@ H5AC__init_package(void) const char *s; /* String for environment variables */ s = HDgetenv("H5_COLL_API_SANITY_CHECK"); - if(s && HDisdigit(*s)) { + if(s && HDisdigit(*s)) H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0); - } } #endif /* H5_HAVE_PARALLEL */ @@ -278,7 +277,9 @@ H5AC__init_package(void) H5AC_rawdata_dxpl_id = H5P_DATASET_XFER_DEFAULT; #endif /* defined(H5_HAVE_PARALLEL) || defined(H5_DEBUG_BUILD) */ +#if defined(H5_DEBUG_BUILD) | defined(H5_HAVE_PARALLEL) done: +#endif /* defined(H5_DEBUG_BUILD) | defined(H5_HAVE_PARALLEL) */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5AC__init_package() */ @@ -2077,113 +2078,6 @@ done: /*************************************************************************/ -/*************************** Debugging Functions: ************************/ -/*************************************************************************/ - -/*------------------------------------------------------------------------- - * - * Function: H5AC_get_entry_ptr_from_addr() - * - * Purpose: Debugging function that attempts to look up an entry in the - * cache by its file address, and if found, returns a pointer - * to the entry in *entry_ptr_ptr. If the entry is not in the - * cache, *entry_ptr_ptr is set to NULL. - * - * WARNING: This call should be used only in debugging - * routines, and it should be avoided when - * possible. - * - * Further, if we ever multi-thread the cache, - * this routine will have to be either discarded - * or heavily re-worked. - * - * Finally, keep in mind that the entry whose - * pointer is obtained in this fashion may not - * be in a stable state. - * - * Note that this function is only defined if NDEBUG - * is not defined. - * - * As heavy use of this function is almost certainly a - * bad idea, the metadata cache tracks the number of - * successful calls to this function, and (if - * H5C_DO_SANITY_CHECKS is defined) displays any - * non-zero count on cache shutdown. - * - * This function is just a wrapper that calls the H5C - * version of the function. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: John Mainzer, 5/30/14 - * - *------------------------------------------------------------------------- - */ -#ifndef NDEBUG -herr_t -H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, void **entry_ptr_ptr) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if(H5C_get_entry_ptr_from_addr(f, addr, entry_ptr_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_ptr_from_addr() failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC_get_entry_ptr_from_addr() */ -#endif /* NDEBUG */ - - -/*------------------------------------------------------------------------- - * - * Function: H5AC_verify_entry_type() - * - * Purpose: Debugging function that attempts to look up an entry in the - * cache by its file address, and if found, test to see if its - * type field contains the expected value. - * - * If the specified entry is in cache, *in_cache_ptr is set - * to TRUE, and *type_ok_ptr is set to TRUE or FALSE - * depending on whether the entries type field matches the - * expected_type parameter - * - * If the target entry is not in cache, *in_cache_ptr is - * set to FALSE, and *type_ok_ptr is undefined. - * - * Note that this function is only defined if NDEBUG - * is not defined. - * - * This function is just a wrapper that calls the H5C - * version of the function. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: John Mainzer, 5/30/14 - * - *------------------------------------------------------------------------- - */ -#ifndef NDEBUG -herr_t -H5AC_verify_entry_type(const H5F_t *f, haddr_t addr, const H5AC_class_t *expected_type, - hbool_t *in_cache_ptr, hbool_t *type_ok_ptr) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if(H5C_verify_entry_type(f, addr, expected_type, in_cache_ptr, type_ok_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_verify_entry_type() failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC_verify_entry_type() */ -#endif /* NDEBUG */ - - - -/*************************************************************************/ /**************************** Private Functions: *************************/ /*************************************************************************/ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 513ce61..84c9e93 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -53,35 +53,35 @@ /* Types of metadata objects cached */ typedef enum { - H5AC_BT_ID = 0, /* ( 0) B-tree nodes */ - H5AC_SNODE_ID, /* ( 1) symbol table nodes */ - H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */ - H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */ - H5AC_GHEAP_ID, /* ( 4) global heap */ - H5AC_OHDR_ID, /* ( 5) object header */ - H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */ - H5AC_BT2_HDR_ID, /* ( 8) v2 B-tree header */ - H5AC_BT2_INT_ID, /* ( 9) v2 B-tree internal node */ - H5AC_BT2_LEAF_ID, /* (10) v2 B-tree leaf node */ - H5AC_FHEAP_HDR_ID, /* (11) fractal heap header */ - H5AC_FHEAP_DBLOCK_ID, /* (12) fractal heap direct block */ - H5AC_FHEAP_IBLOCK_ID, /* (13) fractal heap indirect block */ - H5AC_FSPACE_HDR_ID, /* (14) free space header */ - H5AC_FSPACE_SINFO_ID, /* (15) free space sections */ - H5AC_SOHM_TABLE_ID, /* (16) shared object header message master table */ - H5AC_SOHM_LIST_ID, /* (17) shared message index stored as a list */ - H5AC_EARRAY_HDR_ID, /* (18) extensible array header */ - H5AC_EARRAY_IBLOCK_ID, /* (19) extensible array index block */ - H5AC_EARRAY_SBLOCK_ID, /* (20) extensible array super block */ - H5AC_EARRAY_DBLOCK_ID, /* (21) extensible array data block */ - H5AC_EARRAY_DBLK_PAGE_ID, /* (22) extensible array data block page */ - H5AC_FARRAY_HDR_ID, /* (23) fixed array header */ - H5AC_FARRAY_DBLOCK_ID, /* (24) fixed array data block */ - H5AC_FARRAY_DBLK_PAGE_ID, /* (25) fixed array data block page */ - H5AC_SUPERBLOCK_ID, /* (26) file superblock */ - H5AC_DRVRINFO_ID, /* (27) driver info block (supplements superblock)*/ - H5AC_TEST_ID, /* (28) test entry -- not used for actual files */ - H5AC_NTYPES /* Number of types, must be last */ + H5AC_BT_ID = 0, /* ( 0) B-tree nodes */ + H5AC_SNODE_ID, /* ( 1) symbol table nodes */ + H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */ + H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */ + H5AC_GHEAP_ID, /* ( 4) global heap */ + H5AC_OHDR_ID, /* ( 5) object header */ + H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */ + H5AC_BT2_HDR_ID, /* ( 7) v2 B-tree header */ + H5AC_BT2_INT_ID, /* ( 8) v2 B-tree internal node */ + H5AC_BT2_LEAF_ID, /* ( 9) v2 B-tree leaf node */ + H5AC_FHEAP_HDR_ID, /* (10) fractal heap header */ + H5AC_FHEAP_DBLOCK_ID, /* (11) fractal heap direct block */ + H5AC_FHEAP_IBLOCK_ID, /* (12) fractal heap indirect block */ + H5AC_FSPACE_HDR_ID, /* (13) free space header */ + H5AC_FSPACE_SINFO_ID, /* (14) free space sections */ + H5AC_SOHM_TABLE_ID, /* (15) shared object header message master table */ + H5AC_SOHM_LIST_ID, /* (16) shared message index stored as a list */ + H5AC_EARRAY_HDR_ID, /* (17) extensible array header */ + H5AC_EARRAY_IBLOCK_ID, /* (18) extensible array index block */ + H5AC_EARRAY_SBLOCK_ID, /* (19) extensible array super block */ + H5AC_EARRAY_DBLOCK_ID, /* (20) extensible array data block */ + H5AC_EARRAY_DBLK_PAGE_ID, /* (21) extensible array data block page */ + H5AC_FARRAY_HDR_ID, /* (22) fixed array header */ + H5AC_FARRAY_DBLOCK_ID, /* (23) fixed array data block */ + H5AC_FARRAY_DBLK_PAGE_ID, /* (24) fixed array data block page */ + H5AC_SUPERBLOCK_ID, /* (25) file superblock */ + H5AC_DRVRINFO_ID, /* (26) driver info block (supplements superblock) */ + H5AC_TEST_ID, /* (27) test entry -- not used for actual files */ + H5AC_NTYPES /* Number of types, must be last */ } H5AC_type_t; /* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when @@ -311,6 +311,7 @@ H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; #define H5AC__TAKE_OWNERSHIP_FLAG H5C__TAKE_OWNERSHIP_FLAG #define H5AC__FLUSH_LAST_FLAG H5C__FLUSH_LAST_FLAG #define H5AC__FLUSH_COLLECTIVELY_FLAG H5C__FLUSH_COLLECTIVELY_FLAG +#define H5AC__EVICT_ALLOW_LAST_PINS_FLAG H5C__EVICT_ALLOW_LAST_PINS_FLAG /* #defines of flags used to report entry status in the @@ -380,11 +381,6 @@ H5_DLL herr_t H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr); #ifndef NDEBUG /* debugging functions */ H5_DLL herr_t H5AC_stats(const H5F_t *f); H5_DLL herr_t H5AC_dump_cache(const H5F_t *f); -H5_DLL herr_t H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, - void ** entry_ptr_ptr); -H5_DLL herr_t H5AC_verify_entry_type(const H5F_t * f, haddr_t addr, - const H5AC_class_t * expected_type, hbool_t * in_cache_ptr, - hbool_t * type_ok_ptr); #endif /* NDEBUG */ /* end debugging functions */ #endif /* !_H5ACprivate_H */ diff --git a/src/H5B2int.c b/src/H5B2int.c index e877a17..3bd788c 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -3612,7 +3612,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +H5_ATTR_PURE static herr_t H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf) { /* General sanity checking on node */ @@ -3635,7 +3635,7 @@ H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf) * *------------------------------------------------------------------------- */ -static herr_t +H5_ATTR_PURE static herr_t H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t H5_ATTR_UNUSED *leaf2) { /* General sanity checking on node */ @@ -3658,7 +3658,7 @@ H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_le * *------------------------------------------------------------------------- */ -static herr_t +H5_ATTR_PURE static herr_t H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ @@ -3699,7 +3699,7 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2 * *------------------------------------------------------------------------- */ -static herr_t +H5_ATTR_PURE static herr_t H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ @@ -166,6 +166,10 @@ static herr_t H5C_make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted); +static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry); + +static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry); + static herr_t H5C__generate_image(const H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, hid_t dxpl_id, int64_t *entry_size_change_ptr); @@ -180,6 +184,11 @@ static herr_t H5C_validate_pinned_entry_list(H5C_t * cache_ptr); static herr_t H5C_validate_protected_entry_list(H5C_t * cache_ptr); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ +#ifndef NDEBUG +static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t * entry, + const H5C_cache_entry_t * base_entry); +#endif /* NDEBUG */ + #if 0 /* debugging routines */ herr_t H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name); herr_t H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn); @@ -206,6 +215,9 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Declare a free list to manage the H5C_t struct */ H5FL_DEFINE_STATIC(H5C_t); +/* Declare a free list to manage flush dependency arrays */ +H5FL_BLK_DEFINE_STATIC(parent); + /* Declare extern free list to manage the H5C_collective_write_t struct */ H5FL_EXTERN(H5C_collective_write_t); @@ -443,10 +455,6 @@ H5C_create(size_t max_cache_size, cache_ptr->prefix[0] = '\0'; /* empty string */ -#ifndef NDEBUG - cache_ptr->get_entry_ptr_from_addr_counter = 0; -#endif /* NDEBUG */ - /* Set return value */ ret_value = cache_ptr; @@ -738,23 +746,6 @@ H5C_dest(H5F_t * f, hid_t dxpl_id) cache_ptr->cork_list_ptr = NULL; } /* end if */ - /* Only display count of number of calls to H5C_get_entry_ptr_from_add() - * if NDEBUG is undefined, and H5C_DO_SANITY_CHECKS is defined. Need - * this as the print statement will upset windows, and we frequently - * run debug builds there. - * - * Note that the count is still kept whenever NDEBUG is undefined, and - * is reasonably accessible via debugger. - */ -#ifndef NDEBUG -#if H5C_DO_SANITY_CHECKS - if ( cache_ptr->get_entry_ptr_from_addr_counter > 0 ) - HDfprintf(stdout, - "*** %ld calls to H5C_get_entry_ptr_from_add(). ***\n", - cache_ptr->get_entry_ptr_from_addr_counter); -#endif /* H5C_DO_SANITY_CHECKS */ -#endif /* NDEBUG */ - #ifndef NDEBUG cache_ptr->magic = 0; #endif /* NDEBUG */ @@ -1243,7 +1234,6 @@ H5C_insert_entry(H5F_t * f, size_t empty_space; H5C_cache_entry_t *entry_ptr; H5C_cache_entry_t *test_entry_ptr; - unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1366,9 +1356,10 @@ H5C_insert_entry(H5F_t * f, /* Initialize flush dependency height fields */ entry_ptr->flush_dep_parent = NULL; - for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) - entry_ptr->child_flush_dep_height_rc[u] = 0; - entry_ptr->flush_dep_height = 0; + entry_ptr->flush_dep_nparents = 0; + entry_ptr->flush_dep_parent_nalloc = 0; + entry_ptr->flush_dep_nchildren = 0; + entry_ptr->flush_dep_ndirty_children = 0; entry_ptr->ht_next = NULL; entry_ptr->ht_prev = NULL; @@ -1585,31 +1576,32 @@ H5C_mark_entry_dirty(void *thing) entry_ptr->dirtied = TRUE; } else if ( entry_ptr->is_pinned ) { - hbool_t was_pinned_unprotected_and_clean; + hbool_t was_clean; - was_pinned_unprotected_and_clean = ! ( entry_ptr->is_dirty ); + was_clean = !entry_ptr->is_dirty; /* mark the entry as dirty if it isn't already */ entry_ptr->is_dirty = TRUE; entry_ptr->image_up_to_date = FALSE; - if ( was_pinned_unprotected_and_clean ) { - - H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr); - } + /* Propagate the dirty flag up the flush dependency chain if appropriate */ + if(was_clean) { + H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr); - if ( ! (entry_ptr->in_slist) ) { + if(entry_ptr->flush_dep_nparents > 0) + if(H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") + } /* end if */ + if(!entry_ptr->in_slist) { H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) } H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) - } else { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry is neither pinned nor protected??") - } + } /* end if */ + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is neither pinned nor protected??") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1638,9 +1630,6 @@ H5C_move_entry(H5C_t * cache_ptr, { H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t * test_entry_ptr = NULL; -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - hbool_t was_dirty; -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #if H5C_DO_SANITY_CHECKS hbool_t removed_entry_from_slist = FALSE; #endif /* H5C_DO_SANITY_CHECKS */ @@ -1735,24 +1724,29 @@ H5C_move_entry(H5C_t * cache_ptr, entry_ptr->addr = new_addr; - if ( ! ( entry_ptr->destroy_in_progress ) ) { + if(!entry_ptr->destroy_in_progress) { + hbool_t was_dirty; -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS was_dirty = entry_ptr->is_dirty; -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + entry_ptr->is_dirty = TRUE; - entry_ptr->is_dirty = TRUE; - /* This shouldn't be needed, but it keeps the test code happy */ + /* This shouldn't be needed, but it keeps the test code happy */ entry_ptr->image_up_to_date = FALSE; + /* Propagate the dirty flag up the flush dependency chain if + * appropriate */ + if(!entry_ptr->flush_in_progress) { + if(!was_dirty && entry_ptr->flush_dep_nparents > 0) + if(H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") + } /* end if */ + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) #if H5C_DO_SANITY_CHECKS - - if ( removed_entry_from_slist ) { - + if(removed_entry_from_slist) { /* we just removed the entry from the slist. Thus we * must touch up cache_ptr->slist_len_increase and * cache_ptr->slist_size_increase to keep from skewing @@ -1760,21 +1754,18 @@ H5C_move_entry(H5C_t * cache_ptr, */ cache_ptr->slist_len_increase -= 1; cache_ptr->slist_size_increase -= (int64_t)(entry_ptr->size); - } - + } /* end if */ #endif /* H5C_DO_SANITY_CHECKS */ - if ( ! ( entry_ptr->flush_in_progress ) ) { - + if(!entry_ptr->flush_in_progress) { /* skip the update if a flush is in progress */ H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL) } - } + } /* end if */ H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) done: - #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || @@ -1786,7 +1777,6 @@ done: #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_move_entry() */ @@ -1842,16 +1832,21 @@ H5C_resize_entry(void *thing, size_t new_size) hbool_t was_clean; /* make note of whether the entry was clean to begin with */ - was_clean = ! ( entry_ptr->is_dirty ); + was_clean = !entry_ptr->is_dirty; /* mark the entry as dirty if it isn't already */ entry_ptr->is_dirty = TRUE; entry_ptr->image_up_to_date = FALSE; /* Release the current image */ - if( entry_ptr->image_ptr ) + if(entry_ptr->image_ptr) entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + /* Propagate the dirty flag up the flush dependency chain if appropriate */ + if(was_clean && entry_ptr->flush_dep_nparents > 0) + if(H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") + /* do a flash cache size increase if appropriate */ if ( cache_ptr->flash_size_increase_possible ) { @@ -4119,9 +4114,25 @@ H5C_unprotect(H5F_t * f, entry_ptr->image_up_to_date = !entry_ptr->is_dirty; #endif /* JRM */ - /* Update index for newly dirtied entry */ - if(was_clean && entry_ptr->is_dirty) - H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) + /* Check for newly dirtied entry */ + if(was_clean && entry_ptr->is_dirty) { + /* Propagate the flush dep dirty flag up the flush dependency chain + * if appropriate */ + if(entry_ptr->flush_dep_nparents > 0) + if(H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") + + /* Update index for newly dirtied entry */ + H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) + } /* end if */ + /* Check for newly clean entry */ + else if(!was_clean && !entry_ptr->is_dirty) { + /* Propagate the flush dep clean flag up the flush dependency chain + * if appropriate */ + if(entry_ptr->flush_dep_nparents > 0) + if(H5C__mark_flush_dep_clean(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") + } /* end else-if */ /* Pin or unpin the entry as requested. */ if(pin_entry) { @@ -4455,103 +4466,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5C_adjust_flush_dependency_rc() - * - * Purpose: "Atomicly" adjust flush dependency ref. counts for an entry, - * as a result of a flush dependency child's height changing. - * - * Note: Entry will remain in flush dependency relationship with its - * child entry (i.e. it's not going to get unpinned as a result - * of this change), but change could trickle upward, if this - * entry's height changes and it has a flush dependency parent. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/05/09 - * - *------------------------------------------------------------------------- - */ -static void -H5C_adjust_flush_dependency_rc(H5C_cache_entry_t * cache_entry, - unsigned old_child_height, unsigned new_child_height) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity checks */ - HDassert(cache_entry); - HDassert(cache_entry->is_pinned); - HDassert(cache_entry->flush_dep_height > 0); - HDassert(cache_entry->flush_dep_height < H5C__NUM_FLUSH_DEP_HEIGHTS); - HDassert(cache_entry->child_flush_dep_height_rc[old_child_height] > 0); - HDassert(old_child_height < H5C__NUM_FLUSH_DEP_HEIGHTS); - HDassert(old_child_height != new_child_height); - HDassert(new_child_height < H5C__NUM_FLUSH_DEP_HEIGHTS); - - /* Adjust ref. counts for entry's flush dependency children heights */ - cache_entry->child_flush_dep_height_rc[new_child_height]++; - cache_entry->child_flush_dep_height_rc[old_child_height]--; - - /* Check for flush dependency height of entry increasing */ - if((new_child_height + 1) > cache_entry->flush_dep_height) { - - /* Check if entry has _its_ own parent flush dependency entry */ - if(NULL != cache_entry->flush_dep_parent) { - /* Adjust flush dependency ref. counts on entry's parent */ - H5C_adjust_flush_dependency_rc(cache_entry->flush_dep_parent, cache_entry->flush_dep_height, new_child_height + 1); - } /* end if */ - - /* Set new flush dependency height of entry */ - cache_entry->flush_dep_height = new_child_height + 1; - } /* end if */ - else { - /* Check for child's flush dep. height decreasing and ref. count of - * old child height going to zero, it could mean the parent's - * flush dependency height dropped. - */ - if((new_child_height < old_child_height) - && ((old_child_height + 1) == cache_entry->flush_dep_height) - && (0 == cache_entry->child_flush_dep_height_rc[old_child_height])) { - int i; /* Local index variable */ - - /* Re-scan child flush dependency height ref. counts to determine - * this entry's height. - */ -#ifndef NDEBUG - for(i = (H5C__NUM_FLUSH_DEP_HEIGHTS - 1); i > (int)new_child_height; i--) - HDassert(0 == cache_entry->child_flush_dep_height_rc[i]); -#endif /* NDEBUG */ - for(i = (int)new_child_height; i >= 0; i--) - /* Check for child flush dependencies of this height */ - if(cache_entry->child_flush_dep_height_rc[i] > 0) - break; - - /* Sanity checks */ - HDassert((unsigned)(i + 1) < cache_entry->flush_dep_height); - - /* Check if entry has _its_ own parent flush dependency entry */ - if(NULL != cache_entry->flush_dep_parent) { - /* Adjust flush dependency ref. counts on entry's parent */ - H5C_adjust_flush_dependency_rc(cache_entry->flush_dep_parent, cache_entry->flush_dep_height, (unsigned)(i + 1)); - } /* end if */ - - /* Set new flush dependency height of entry */ - cache_entry->flush_dep_height = (unsigned)(i + 1); - } /* end if */ - } /* end else */ - - - /* Post-conditions, for successful operation */ - HDassert(cache_entry->is_pinned); - HDassert(cache_entry->flush_dep_height > 0); - HDassert(cache_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); - HDassert(cache_entry->child_flush_dep_height_rc[new_child_height] > 0); - - FUNC_LEAVE_NOAPI_VOID -} /* H5C_adjust_flush_dependency_rc() */ - - -/*------------------------------------------------------------------------- * Function: H5C_create_flush_dependency() * * Purpose: Initiates a parent<->child entry flush dependency. The parent @@ -4563,11 +4477,6 @@ H5C_adjust_flush_dependency_rc(H5C_cache_entry_t * cache_entry, * currently used to implement Single-Writer/Multiple-Reader (SWMR) * I/O access for data structures in the file). * - * Each child entry can have only one parent entry, but parent - * entries can have >1 child entries. The flush dependency - * height of a parent entry is one greater than the max. flush - * dependency height of its children. - * * Creating a flush dependency between two entries will also pin * the parent entry. * @@ -4584,9 +4493,6 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) H5C_t * cache_ptr; H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */ H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */ -#ifndef NDEBUG - unsigned prev_flush_dep_height = parent_entry->flush_dep_height; /* Previous flush height for parent entry */ -#endif /* NDEBUG */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -4594,45 +4500,34 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) /* Sanity checks */ HDassert(parent_entry); HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(parent_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); HDassert(H5F_addr_defined(parent_entry->addr)); HDassert(child_entry); HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(H5F_addr_defined(child_entry->addr)); - HDassert(child_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); cache_ptr = parent_entry->cache_ptr; - HDassert(parent_entry->ring == child_entry->ring); HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr == child_entry->cache_ptr); +#ifndef NDEBUG + /* Make sure the parent is not already a parent */ + { + unsigned u; + + for(u = 0; u < child_entry->flush_dep_nparents; u++) + HDassert(child_entry->flush_dep_parent[u] != parent_entry); + } /* end block */ +#endif /* NDEBUG */ /* More sanity checks */ if(child_entry == parent_entry) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself") if(!(parent_entry->is_protected || parent_entry->is_pinned)) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected") - if(NULL != child_entry->flush_dep_parent) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry already has flush dependency parent") - { - H5C_cache_entry_t *tmp_entry = parent_entry; /* Temporary cache entry in flush dependency chain */ - unsigned tmp_flush_height = 0; /* Different in heights of parent entry */ - - /* Find the top entry in the flush dependency list */ - while(NULL != tmp_entry->flush_dep_parent) { - tmp_flush_height++; - tmp_entry = tmp_entry->flush_dep_parent; - } /* end while */ - - /* Check if we will make the dependency chain too long */ - if((tmp_flush_height + child_entry->flush_dep_height + 1) - > H5C__NUM_FLUSH_DEP_HEIGHTS) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Combined flush dependency height too large") - } /* Check for parent not pinned */ if(!parent_entry->is_pinned) { /* Sanity check */ - HDassert(parent_entry->flush_dep_height == 0); + HDassert(parent_entry->flush_dep_nchildren == 0); HDassert(!parent_entry->pinned_from_client); HDassert(!parent_entry->pinned_from_cache); @@ -4644,33 +4539,50 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) /* Mark the entry as pinned from the cache's action (possibly redundantly) */ parent_entry->pinned_from_cache = TRUE; - /* Increment ref. count for parent's flush dependency children heights */ - parent_entry->child_flush_dep_height_rc[child_entry->flush_dep_height]++; + /* Check if we need to resize the child's parent array */ + if(child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) { + if(child_entry->flush_dep_parent_nalloc == 0) { + /* Array does not exist yet, allocate it */ + HDassert(!child_entry->flush_dep_parent); - /* Check for increasing parent flush dependency height */ - if((child_entry->flush_dep_height + 1) > parent_entry->flush_dep_height) { - - /* Check if parent entry has _its_ own parent flush dependency entry */ - if(NULL != parent_entry->flush_dep_parent) { - /* Adjust flush dependency ref. counts on parent entry's parent */ - H5C_adjust_flush_dependency_rc(parent_entry->flush_dep_parent, parent_entry->flush_dep_height, (child_entry->flush_dep_height + 1)); + if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_MALLOC(parent, H5C_FLUSH_DEP_PARENT_INIT * sizeof(H5C_cache_entry_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") + child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; } /* end if */ + else { + /* Resize existing array */ + HDassert(child_entry->flush_dep_parent); - /* Increase flush dependency height of parent entry */ - parent_entry->flush_dep_height = child_entry->flush_dep_height + 1; + if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC(parent, child_entry->flush_dep_parent, 2 * child_entry->flush_dep_parent_nalloc * sizeof(H5C_cache_entry_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") + child_entry->flush_dep_parent_nalloc *= 2; + } /* end else */ } /* end if */ - /* Set parent for child entry */ - child_entry->flush_dep_parent = parent_entry; + /* Add the dependency to the child's parent array */ + child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry; + child_entry->flush_dep_nparents++; + + /* Increment parent's number of children */ + parent_entry->flush_dep_nchildren++; + + /* Adjust the number of dirty children */ + if(child_entry->is_dirty) { + /* Sanity check */ + HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren); + parent_entry->flush_dep_ndirty_children++; + } /* end if */ /* Post-conditions, for successful operation */ HDassert(parent_entry->is_pinned); - HDassert(parent_entry->flush_dep_height > 0); - HDassert(parent_entry->flush_dep_height < H5C__NUM_FLUSH_DEP_HEIGHTS); - HDassert(prev_flush_dep_height <= parent_entry->flush_dep_height); - HDassert(parent_entry->child_flush_dep_height_rc[child_entry->flush_dep_height] > 0); - HDassert(NULL != child_entry->flush_dep_parent); + HDassert(parent_entry->flush_dep_nchildren > 0); + HDassert(child_entry->flush_dep_parent); + HDassert(child_entry->flush_dep_nparents > 0); + HDassert(child_entry->flush_dep_parent_nalloc > 0); +#ifndef NDEBUG + H5C__assert_flush_dep_nocycle(parent_entry, child_entry); +#endif /* NDEBUG */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -4681,9 +4593,7 @@ done: * Function: H5C_destroy_flush_dependency() * * Purpose: Terminates a parent<-> child entry flush dependency. The - * parent entry must be pinned and have a positive flush - * dependency height (which could go to zero as a result of - * this operation). + * parent entry must be pinned. * * Return: Non-negative on success/Negative on failure * @@ -4698,9 +4608,7 @@ H5C_destroy_flush_dependency(void *parent_thing, void * child_thing) H5C_t * cache_ptr; H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */ H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */ -#ifndef NDEBUG - unsigned prev_flush_dep_height = parent_entry->flush_dep_height; /* Previous flush height for parent entry */ -#endif /* NDEBUG */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -4709,9 +4617,7 @@ H5C_destroy_flush_dependency(void *parent_thing, void * child_thing) HDassert(parent_entry); HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(H5F_addr_defined(parent_entry->addr)); - HDassert(parent_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); HDassert(child_entry); - HDassert(child_entry->flush_dep_parent != child_entry); HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(H5F_addr_defined(child_entry->addr)); cache_ptr = parent_entry->cache_ptr; @@ -4722,78 +4628,70 @@ H5C_destroy_flush_dependency(void *parent_thing, void * child_thing) /* Usage checks */ if(!parent_entry->is_pinned) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned") - if(0 == parent_entry->flush_dep_height) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't a flush dependency parent") if(NULL == child_entry->flush_dep_parent) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Child entry doesn't have a flush dependency parent") - if(0 == parent_entry->child_flush_dep_height_rc[child_entry->flush_dep_height]) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry flush dependency ref. count has no child entries of this height") - if(child_entry->flush_dep_parent != parent_entry) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't flush dependency parent for child entry") - - /* Decrement the ref. count for flush dependency height of children for parent entry */ - parent_entry->child_flush_dep_height_rc[child_entry->flush_dep_height]--; - - /* Check for flush dependency ref. count at this height going to zero and - * parent entry flush dependency height dropping - */ - if(((child_entry->flush_dep_height + 1) == parent_entry->flush_dep_height) && - 0 == parent_entry->child_flush_dep_height_rc[child_entry->flush_dep_height]) { - int i; /* Local index variable */ - - /* Reverse scan for new flush dependency height of parent */ -#ifndef NDEBUG - for(i = (H5C__NUM_FLUSH_DEP_HEIGHTS - 1); i > (int)child_entry->flush_dep_height; i--) - HDassert(0 == parent_entry->child_flush_dep_height_rc[i]); -#endif /* NDEBUG */ - for(i = (int)child_entry->flush_dep_height; i >= 0; i--) - /* Check for child flush dependencies of this height */ - if(parent_entry->child_flush_dep_height_rc[i] > 0) - break; - + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Child entry doesn't have a flush dependency parent array") + if(0 == parent_entry->flush_dep_nchildren) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry flush dependency ref. count has no child dependencies") + + /* Search for parent in child's parent array. This is a linear search + * because we do not expect large numbers of parents. If this changes, we + * may wish to change the parent array to a skip list */ + for(u = 0; u < child_entry->flush_dep_nparents; u++) + if(child_entry->flush_dep_parent[u] == parent_entry) + break; + if(u == child_entry->flush_dep_nparents) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't a flush dependency parent for child entry") + + /* Remove parent entry from child's parent array */ + if(u < (child_entry->flush_dep_nparents - 1)) + HDmemmove(&child_entry->flush_dep_parent[u], + &child_entry->flush_dep_parent[u + 1], + (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0])); + child_entry->flush_dep_nparents--; + + /* Adjust parent entry's nchildren and unpin parent if it goes to zero */ + parent_entry->flush_dep_nchildren--; + if(0 == parent_entry->flush_dep_nchildren) { /* Sanity check */ - HDassert((unsigned)(i + 1) < parent_entry->flush_dep_height); + HDassert(parent_entry->pinned_from_cache); - /* Check if parent entry is a child in another flush dependency relationship */ - if(NULL != parent_entry->flush_dep_parent) { - /* Change flush dependency ref. counts of parent's parent */ - H5C_adjust_flush_dependency_rc(parent_entry->flush_dep_parent, parent_entry->flush_dep_height, (unsigned)(i + 1)); - } /* end if */ + /* Check if we should unpin parent entry now */ + if(!parent_entry->pinned_from_client) { + /* Update the replacement policy if the entry is not protected */ + if(!parent_entry->is_protected) + H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, parent_entry, FAIL) - /* Increase flush dependency height of parent entry */ - parent_entry->flush_dep_height = (unsigned)(i + 1); + /* Unpin the entry now */ + parent_entry->is_pinned = FALSE; - /* Check for height of parent dropping to zero (i.e. no longer a - * parent of _any_ child flush dependencies). - */ - if(0 == parent_entry->flush_dep_height) { - /* Sanity check */ - HDassert(parent_entry->pinned_from_cache); - - /* Check if we should unpin parent entry now */ - if(!parent_entry->pinned_from_client) { - /* Update the replacement policy if the entry is not protected */ - if(!parent_entry->is_protected) - H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, parent_entry, FAIL) + /* Update the stats for an unpin operation */ + H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, parent_entry) + } /* end if */ - /* Unpin the entry now */ - parent_entry->is_pinned = FALSE; + /* Mark the entry as unpinned from the cache's action */ + parent_entry->pinned_from_cache = FALSE; + } /* end if */ - /* Update the stats for an unpin operation */ - H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, parent_entry) - } /* end if */ + /* Adjust parent entry's ndirty_children */ + if(child_entry->is_dirty) { + /* Sanity check */ + HDassert(parent_entry->flush_dep_ndirty_children > 0); - /* Mark the entry as unpinned from the cache's action */ - parent_entry->pinned_from_cache = FALSE; - } /* end if */ + parent_entry->flush_dep_ndirty_children--; } /* end if */ - /* Reset parent of child entry */ - child_entry->flush_dep_parent = NULL; - - /* Post-conditions, for successful operation */ - HDassert(prev_flush_dep_height >= parent_entry->flush_dep_height); - HDassert(NULL == child_entry->flush_dep_parent); + /* Shrink or free the parent array if apporpriate */ + if(child_entry->flush_dep_nparents == 0) { + child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_FREE(parent, child_entry->flush_dep_parent); + child_entry->flush_dep_parent_nalloc = 0; + } /* end if */ + else if(child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT + && child_entry->flush_dep_nparents + <= (child_entry->flush_dep_parent_nalloc / 4)) { + if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC(parent, child_entry->flush_dep_parent, (child_entry->flush_dep_parent_nalloc / 4) * sizeof(H5C_cache_entry_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") + child_entry->flush_dep_parent_nalloc /= 4; + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -6208,8 +6106,8 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, int32_t i; int32_t cur_ring_pel_len; int32_t old_ring_pel_len; - int32_t passes = 0; unsigned cooked_flags; + unsigned evict_flags; H5SL_node_t * node_ptr = NULL; H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t * next_entry_ptr = NULL; @@ -6239,10 +6137,9 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, HDassert(cache_ptr->epoch_markers_active == 0); /* Filter out the flags that are not relevant to the flush/invalidate. - * At present, only the H5C__FLUSH_CLEAR_ONLY_FLAG is kept. */ cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; - + evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG; /* The flush proceedure here is a bit strange. * @@ -6253,10 +6150,8 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, * * Since the fractal heap can dirty, resize, and/or move entries * in is flush callback, it is possible that the cache will still - * contain dirty entries at this point. If so, we must make up to - * H5C__MAX_PASSES_ON_FLUSH more passes through the skip list - * to allow it to empty. If is is not empty at this point, we again - * scream and die. + * contain dirty entries at this point. If so, we must make more + * passes through the skip list to allow it to empty. * * Further, since clean entries can be dirtied, resized, and/or moved * as the result of a flush call back (either the entries own, or that @@ -6289,402 +6184,353 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, old_ring_pel_len = cur_ring_pel_len; while(cache_ptr->index_ring_len[ring] > 0) { - unsigned curr_flush_dep_height = 0; - unsigned flush_dep_passes = 0; - - /* Loop over all flush dependency heights of entries */ - while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && - (cache_ptr->index_ring_len[ring] > 0) && - (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH)) { - hbool_t flushed_during_dep_loop = FALSE; - - /* first, try to flush-destroy any dirty entries. Do this by - * making a scan through the slist. Note that new dirty entries - * may be created by the flush call backs. Thus it is possible - * that the slist will not be empty after we finish the scan. - */ + /* first, try to flush-destroy any dirty entries. Do this by + * making a scan through the slist. Note that new dirty entries + * may be created by the flush call backs. Thus it is possible + * that the slist will not be empty after we finish the scan. + */ #if H5C_DO_SANITY_CHECKS - /* Depending on circumstances, H5C__flush_single_entry() will - * remove dirty entries from the slist as it flushes them. - * Thus for sanity checks we must make note of the initial - * slist length and size before we do any flushes. - */ - initial_slist_len = cache_ptr->slist_len; - initial_slist_size = cache_ptr->slist_size; - - /* There is also the possibility that entries will be - * dirtied, resized, moved, and/or removed from the cache - * as the result of calls to the flush callbacks. We use - * the slist_len_increase and slist_size_increase increase - * fields in struct H5C_t to track these changes for purpose - * of sanity checking. - * - * To this end, we must zero these fields before we start - * the pass through the slist. - */ - cache_ptr->slist_len_increase = 0; - cache_ptr->slist_size_increase = 0; + /* Depending on circumstances, H5C__flush_single_entry() will + * remove dirty entries from the slist as it flushes them. + * Thus for sanity checks we must make note of the initial + * slist length and size before we do any flushes. + */ + initial_slist_len = cache_ptr->slist_len; + initial_slist_size = cache_ptr->slist_size; + + /* There is also the possibility that entries will be + * dirtied, resized, moved, and/or removed from the cache + * as the result of calls to the flush callbacks. We use + * the slist_len_increase and slist_size_increase increase + * fields in struct H5C_t to track these changes for purpose + * of sanity checking. + * + * To this end, we must zero these fields before we start + * the pass through the slist. + */ + cache_ptr->slist_len_increase = 0; + cache_ptr->slist_size_increase = 0; - /* Finally, reset the flushed_slist_len and flushed_slist_size - * fields to zero, as these fields are used to accumulate - * the slist lenght and size that we see as we scan through - * the slist. - */ - flushed_slist_len = 0; - flushed_slist_size = 0; + /* Finally, reset the flushed_slist_len and flushed_slist_size + * fields to zero, as these fields are used to accumulate + * the slist lenght and size that we see as we scan through + * the slist. + */ + flushed_slist_len = 0; + flushed_slist_size = 0; #endif /* H5C_DO_SANITY_CHECKS */ - /* set the cache_ptr->slist_change_in_pre_serialize and - * cache_ptr->slist_change_in_serialize to false. - * - * These flags are set to TRUE by H5C__flush_single_entry if the - * slist is modified by a pre_serialize or serialize call - * respectively. - * - * H5C_flush_invalidate_cache() uses these flags to detect any - * modifications to the slist that might corrupt the scan of - * the slist -- and restart the scan in this event. - */ - cache_ptr->slist_change_in_pre_serialize = FALSE; - cache_ptr->slist_change_in_serialize = FALSE; - - /* this done, start the scan of the slist */ - restart_slist_scan = TRUE; - while(restart_slist_scan || (node_ptr != NULL)) { - if(restart_slist_scan) { - restart_slist_scan = FALSE; - - /* Start at beginning of skip list */ - node_ptr = H5SL_first(cache_ptr->slist_ptr); - if(node_ptr == NULL) - /* the slist is empty -- break out of inner loop */ - break; - - /* Get cache entry for this node */ - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - HDassert(next_entry_ptr->ring >= ring); - } /* end if */ + /* set the cache_ptr->slist_change_in_pre_serialize and + * cache_ptr->slist_change_in_serialize to false. + * + * These flags are set to TRUE by H5C__flush_single_entry if the + * slist is modified by a pre_serialize or serialize call + * respectively. + * + * H5C_flush_invalidate_cache() uses these flags to detect any + * modifications to the slist that might corrupt the scan of + * the slist -- and restart the scan in this event. + */ + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + + /* this done, start the scan of the slist */ + restart_slist_scan = TRUE; + while(restart_slist_scan || (node_ptr != NULL)) { + if(restart_slist_scan) { + restart_slist_scan = FALSE; + + /* Start at beginning of skip list */ + node_ptr = H5SL_first(cache_ptr->slist_ptr); + if(node_ptr == NULL) + /* the slist is empty -- break out of inner loop */ + break; - entry_ptr = next_entry_ptr; + /* Get cache entry for this node */ + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - /* It is possible that entries will be dirtied, resized, - * flushed, or removed from the cache via the take ownership - * flag as the result of pre_serialize or serialized callbacks. - * - * This in turn can corrupt the scan through the slist. - * - * We test for slist modifications in the pre_serialize - * and serialize callbacks, and restart the scan of the - * slist if we find them. However, best we do some extra - * sanity checking just in case. - */ - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->in_slist); - HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->ring >= ring); + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + } /* end if */ - /* increment node pointer now, before we delete its target - * from the slist. - */ - node_ptr = H5SL_next(node_ptr); - if(node_ptr != NULL) { - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - HDassert(next_entry_ptr->ring >= ring); - HDassert(entry_ptr != next_entry_ptr); - } /* end if */ - else - next_entry_ptr = NULL; + entry_ptr = next_entry_ptr; - /* Note that we now remove nodes from the slist as we flush - * the associated entries, instead of leaving them there - * until we are done, and then destroying all nodes in - * the slist. - * - * While this optimization used to be easy, with the possibility - * of new entries being added to the slist in the midst of the - * flush, we must keep the slist in cannonical form at all - * times. - */ - HDassert(entry_ptr != NULL); - HDassert(entry_ptr->in_slist); + /* It is possible that entries will be dirtied, resized, + * flushed, or removed from the cache via the take ownership + * flag as the result of pre_serialize or serialized callbacks. + * + * This in turn can corrupt the scan through the slist. + * + * We test for slist modifications in the pre_serialize + * and serialize callbacks, and restart the scan of the + * slist if we find them. However, best we do some extra + * sanity checking just in case. + */ + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->in_slist); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->ring >= ring); - if(((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && - (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && - (entry_ptr->ring == ring)) { - if(entry_ptr->is_protected) { - /* we have major problems -- but lets flush - * everything we can before we flag an error. - */ - protected_entries++; - } else if(entry_ptr->is_pinned) { + /* increment node pointer now, before we delete its target + * from the slist. + */ + node_ptr = H5SL_next(node_ptr); + if(node_ptr != NULL) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + HDassert(entry_ptr != next_entry_ptr); + } /* end if */ + else + next_entry_ptr = NULL; + + /* Note that we now remove nodes from the slist as we flush + * the associated entries, instead of leaving them there + * until we are done, and then destroying all nodes in + * the slist. + * + * While this optimization used to be easy, with the possibility + * of new entries being added to the slist in the midst of the + * flush, we must keep the slist in cannonical form at all + * times. + */ + HDassert(entry_ptr != NULL); + HDassert(entry_ptr->in_slist); + + if(((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->flush_dep_nchildren == 0) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { + /* we have major problems -- but lets flush + * everything we can before we flag an error. + */ + protected_entries++; + } else if(entry_ptr->is_pinned) { - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush, but don't tell - * H5C__flush_single_entry() to destroy the entry - * as pinned entries can't be evicted. - */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height) { #if H5C_DO_SANITY_CHECKS - /* update flushed_slist_len & flushed_slist_size - * before the flush. Note that the entry will - * be removed from the slist after the flush, - * and thus may be resized by the flush callback. - * This is OK, as we will catch the size delta in - * cache_ptr->slist_size_increase. - * - */ - flushed_slist_len++; - flushed_slist_size += (int64_t)entry_ptr->size; - entry_size_change = 0; + /* update flushed_slist_len & flushed_slist_size + * before the flush. Note that the entry will + * be removed from the slist after the flush, + * and thus may be resized by the flush callback. + * This is OK, as we will catch the size delta in + * cache_ptr->slist_size_increase. + * + */ + flushed_slist_len++; + flushed_slist_size += (int64_t)entry_ptr->size; + entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") #if H5C_DO_SANITY_CHECKS - /* entry size may have changed during the flush. - * Update flushed_slist_size to account for this. - */ - flushed_slist_size += entry_size_change; + /* entry size may have changed during the flush. + * Update flushed_slist_size to account for this. + */ + flushed_slist_size += entry_size_change; #endif /* H5C_DO_SANITY_CHECKS */ - flushed_during_dep_loop = TRUE; - if((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize = FALSE; - cache_ptr->slist_change_in_serialize = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); - } /* end if */ - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); } /* end if */ - else { - if(entry_ptr->flush_dep_height == curr_flush_dep_height) { + } /* end if */ + else { #if H5C_DO_SANITY_CHECKS - /* update flushed_slist_len & flushed_slist_size - * before the flush. Note that the entry will - * be removed from the slist after the flush, - * and thus may be resized by the flush callback. - * This is OK, as we will catch the size delta in - * cache_ptr->slist_size_increase. - * - */ - flushed_slist_len++; - flushed_slist_size += (int64_t)entry_ptr->size; - entry_size_change = 0; + /* update flushed_slist_len & flushed_slist_size + * before the flush. Note that the entry will + * be removed from the slist after the flush, + * and thus may be resized by the flush callback. + * This is OK, as we will catch the size delta in + * cache_ptr->slist_size_increase. + * + */ + flushed_slist_len++; + flushed_slist_size += (int64_t)entry_ptr->size; + entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, - (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), - entry_size_change_ptr, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.") + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), + entry_size_change_ptr, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.") #if H5C_DO_SANITY_CHECKS - /* entry size may have changed during the flush. - * Update flushed_slist_size to account for this. - */ - flushed_slist_size += entry_size_change; + /* entry size may have changed during the flush. + * Update flushed_slist_size to account for this. + */ + flushed_slist_size += entry_size_change; #endif /* H5C_DO_SANITY_CHECKS */ - flushed_during_dep_loop = TRUE; - - if((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize = FALSE; - cache_ptr->slist_change_in_serialize = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } /* end if */ - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } /* end else */ - } /* end if */ - } /* end while loop scanning skip list */ + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ + } /* end else */ + } /* end if */ + } /* end while loop scanning skip list */ #if H5C_DO_SANITY_CHECKS - /* It is possible that entries were added to the slist during - * the scan, either before or after scan pointer. The following - * asserts take this into account. - * - * Don't bother with the sanity checks if node_ptr != NULL, as - * in this case we broke out of the loop because it got changed - * out from under us. - */ + /* It is possible that entries were added to the slist during + * the scan, either before or after scan pointer. The following + * asserts take this into account. + * + * Don't bother with the sanity checks if node_ptr != NULL, as + * in this case we broke out of the loop because it got changed + * out from under us. + */ - if(node_ptr == NULL) { - HDassert((flushed_slist_len + cache_ptr->slist_len) == - (initial_slist_len + cache_ptr->slist_len_increase)); - HDassert((flushed_slist_size + (int64_t)cache_ptr->slist_size) == - ((int64_t)initial_slist_size + cache_ptr->slist_size_increase)); - } /* end if */ + if(node_ptr == NULL) { + HDassert((flushed_slist_len + cache_ptr->slist_len) == + (initial_slist_len + cache_ptr->slist_len_increase)); + HDassert((flushed_slist_size + (int64_t)cache_ptr->slist_size) == + ((int64_t)initial_slist_size + cache_ptr->slist_size_increase)); + } /* end if */ #endif /* H5C_DO_SANITY_CHECKS */ - /* Since we are doing a destroy, we must make a pass through - * the hash table and try to flush - destroy all entries that - * remain. - * - * It used to be that all entries remaining in the cache at - * this point had to be clean, but with the fractal heap mods - * this may not be the case. If so, we will flush entries out - * of increasing address order. - * - * Writes to disk are possible here. - */ - for(i = 0; i < H5C__HASH_TABLE_LEN; i++) { - next_entry_ptr = cache_ptr->index[i]; - - while(next_entry_ptr != NULL) { - entry_ptr = next_entry_ptr; - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring >= ring); - - next_entry_ptr = entry_ptr->ht_next; - HDassert((next_entry_ptr == NULL) || - (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC)); - - if(((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && - (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && - (entry_ptr->ring == ring)) { - - if(entry_ptr->is_protected) { - /* we have major problems -- but lets flush and - * destroy everything we can before we flag an - * error. - */ - protected_entries++; - if(!entry_ptr->in_slist) - HDassert(!(entry_ptr->is_dirty)); - } else if(!(entry_ptr->is_pinned)) { + /* Since we are doing a destroy, we must make a pass through + * the hash table and try to flush - destroy all entries that + * remain. + * + * It used to be that all entries remaining in the cache at + * this point had to be clean, but with the fractal heap mods + * this may not be the case. If so, we will flush entries out + * of increasing address order. + * + * Writes to disk are possible here. + */ + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) { + next_entry_ptr = cache_ptr->index[i]; - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush. + while(next_entry_ptr != NULL) { + entry_ptr = next_entry_ptr; + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); + + next_entry_ptr = entry_ptr->ht_next; + HDassert((next_entry_ptr == NULL) || + (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC)); + + if(((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->flush_dep_nchildren == 0) && + (entry_ptr->ring == ring)) { + + if(entry_ptr->is_protected) { + /* we have major problems -- but lets flush and + * destroy everything we can before we flag an + * error. + */ + protected_entries++; + if(!entry_ptr->in_slist) + HDassert(!(entry_ptr->is_dirty)); + } else if(!(entry_ptr->is_pinned)) { + + /* if *entry_ptr is dirty, it is possible + * that one or more other entries may be + * either removed from the cache, loaded + * into the cache, or moved to a new location + * in the file as a side effect of the flush. + * + * If this happens, and one of the target + * entries happens to be the next entry in + * the hash bucket, we could find ourselves + * either find ourselves either scanning a + * non-existant entry, scanning through a + * different bucket, or skipping an entry. + * + * Neither of these are good, so restart the + * the scan at the head of the hash bucket + * after the flush if *entry_ptr was dirty, + * on the off chance that the next entry was + * a target. + * + * This is not as inefficient at it might seem, + * as hash buckets typically have at most two + * or three entries. + */ + hbool_t entry_was_dirty; + + entry_was_dirty = entry_ptr->is_dirty; + + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), + NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.") + + if(entry_was_dirty) { + /* update stats for hash bucket scan + * restart here. + * -- JRM */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height) { - /* if *entry_ptr is dirty, it is possible - * that one or more other entries may be - * either removed from the cache, loaded - * into the cache, or moved to a new location - * in the file as a side effect of the flush. - * - * If this happens, and one of the target - * entries happens to be the next entry in - * the hash bucket, we could find ourselves - * either find ourselves either scanning a - * non-existant entry, scanning through a - * different bucket, or skipping an entry. - * - * Neither of these are good, so restart the - * the scan at the head of the hash bucket - * after the flush if *entry_ptr was dirty, - * on the off chance that the next entry was - * a target. - * - * This is not as inefficient at it might seem, - * as hash buckets typically have at most two - * or three entries. - */ - hbool_t entry_was_dirty; - - entry_was_dirty = entry_ptr->is_dirty; - - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, - (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.") - - if(entry_was_dirty) { - /* update stats for hash bucket scan - * restart here. - * -- JRM - */ - next_entry_ptr = cache_ptr->index[i]; - H5C__UPDATE_STATS_FOR_HASH_BUCKET_SCAN_RESTART(cache_ptr) - } /* end if */ - - flushed_during_dep_loop = TRUE; - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + next_entry_ptr = cache_ptr->index[i]; + H5C__UPDATE_STATS_FOR_HASH_BUCKET_SCAN_RESTART(cache_ptr) } /* end if */ } /* end if */ - /* We can't do anything if the entry is pinned. The - * hope is that the entry will be unpinned as the - * result of destroys of entries that reference it. - * - * We detect this by noting the change in the number - * of pinned entries from pass to pass. If it stops - * shrinking before it hits zero, we scream and die. - */ - /* if the serialize function on the entry we last evicted - * loaded an entry into cache (as Quincey has promised me - * it never will), and if the cache was full, it is - * possible that *next_entry_ptr was flushed or evicted. - * - * Test to see if this happened here. Note that if this - * test is triggred, we are accessing a deallocated piece - * of dynamically allocated memory, so we just scream and - * die. - * - * Update: The code to restart the scan after flushes - * of dirty entries should make it impossible - * to satisfy the following test. Leave it in - * in case I am wrong. - * -- JRM - */ - if((next_entry_ptr != NULL) && (next_entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC)) - /* Something horrible has happened to - * *next_entry_ptr -- scream and die. - */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr->magic is invalid?!?!?.") - } /* end while loop scanning hash table bin */ - } /* end for loop scanning hash table */ - - /* Check for incrementing flush dependency height */ - if(flushed_during_dep_loop) { - /* If we flushed an entry at this flush dependency height - * start over at the bottom level of the flush dependencies - */ - curr_flush_dep_height = 0; - - /* Make certain we don't get stuck in an infinite loop */ - flush_dep_passes++; - } /* end if */ - else - curr_flush_dep_height++; + } /* end if */ - } /* end while loop over flush dependency heights */ + /* We can't do anything if the entry is pinned. The + * hope is that the entry will be unpinned as the + * result of destroys of entries that reference it. + * + * We detect this by noting the change in the number + * of pinned entries from pass to pass. If it stops + * shrinking before it hits zero, we scream and die. + */ + /* if the serialize function on the entry we last evicted + * loaded an entry into cache (as Quincey has promised me + * it never will), and if the cache was full, it is + * possible that *next_entry_ptr was flushed or evicted. + * + * Test to see if this happened here. Note that if this + * test is triggred, we are accessing a deallocated piece + * of dynamically allocated memory, so we just scream and + * die. + * + * Update: The code to restart the scan after flushes + * of dirty entries should make it impossible + * to satisfy the following test. Leave it in + * in case I am wrong. + * -- JRM + */ + if((next_entry_ptr != NULL) && (next_entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC)) + /* Something horrible has happened to + * *next_entry_ptr -- scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr->magic is invalid?!?!?.") + } /* end while loop scanning hash table bin */ + } /* end for loop scanning hash table */ old_ring_pel_len = cur_ring_pel_len; entry_ptr = cache_ptr->pel_head_ptr; @@ -6700,20 +6546,19 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, } /* end while */ if((cur_ring_pel_len > 0) && (cur_ring_pel_len >= old_ring_pel_len)) { + /* Don't error if allowed to have pinned entries remaining */ + if(evict_flags) + HGOTO_DONE(TRUE) + /* The number of pinned entries in the ring is positive, and * it is not declining. Scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring) - } else if((cur_ring_pel_len == 0) && (old_ring_pel_len == 0)) { - /* increment the pass count */ - passes++; - } + } /* end if */ - if(passes >= H5C__MAX_PASSES_ON_FLUSH) - /* we have exceeded the maximum number of passes through the - * cache to flush and destroy all entries. Scream and die. - */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Maximum passes on flush exceeded.") + HDassert(protected_entries == cache_ptr->pl_len); + if((protected_entries > 0) && (protected_entries == cache_ptr->index_len)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Only protected entries left in cache, protected_entries = %d", (int)protected_entries) } /* main while loop */ /* Invariants, after destroying all entries in the ring */ @@ -6767,12 +6612,12 @@ herr_t H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) { H5C_t * cache_ptr = f->shared->cache; + hbool_t destroy; hbool_t flushed_entries_last_pass; hbool_t flush_marked_entries; hbool_t ignore_protected; hbool_t tried_to_flush_protected_entry = FALSE; hbool_t restart_slist_scan; - int32_t passes = 0; int32_t protected_entries = 0; H5SL_node_t * node_ptr = NULL; H5C_cache_entry_t * entry_ptr = NULL; @@ -6807,6 +6652,7 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); + destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); flush_marked_entries = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ); if(!flush_marked_entries) @@ -6834,264 +6680,182 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) cache_ptr->slist_change_in_pre_serialize = FALSE; cache_ptr->slist_change_in_serialize = FALSE; - while((passes < H5C__MAX_PASSES_ON_FLUSH) && - (cache_ptr->slist_ring_len[ring] > 0) && + while((cache_ptr->slist_ring_len[ring] > 0) && (protected_entries == 0) && (flushed_entries_last_pass)) { - unsigned curr_flush_dep_height = 0; - unsigned flush_dep_passes = 0; - flushed_entries_last_pass = FALSE; - /* Loop over all flush dependency heights of entries */ - while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && - (cache_ptr->slist_ring_len[ring] > 0) && - (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH)) { - hbool_t flushed_during_dep_loop = FALSE; - #if H5C_DO_SANITY_CHECKS - /* For sanity checking, try to verify that the skip list has - * the expected size and number of entries at the end of each - * internal while loop (see below). - * - * Doing this get a bit tricky, as depending on flags, we may - * or may not flush all the entries in the slist. - * - * To make things more entertaining, with the advent of the - * fractal heap, the entry serialize callback can cause entries - * to be dirtied, resized, and/or moved. Also, the - * pre_serialize callback can result in an entry being - * removed from the cache via the take ownership flag. - * - * To deal with this, we first make note of the initial - * skip list length and size: - */ - initial_slist_len = cache_ptr->slist_len; - initial_slist_size = cache_ptr->slist_size; + /* For sanity checking, try to verify that the skip list has + * the expected size and number of entries at the end of each + * internal while loop (see below). + * + * Doing this get a bit tricky, as depending on flags, we may + * or may not flush all the entries in the slist. + * + * To make things more entertaining, with the advent of the + * fractal heap, the entry serialize callback can cause entries + * to be dirtied, resized, and/or moved. Also, the + * pre_serialize callback can result in an entry being + * removed from the cache via the take ownership flag. + * + * To deal with this, we first make note of the initial + * skip list length and size: + */ + initial_slist_len = cache_ptr->slist_len; + initial_slist_size = cache_ptr->slist_size; - /* We then zero counters that we use to track the number - * and total size of entries flushed: - */ - flushed_entries_count = 0; - flushed_entries_size = 0; - - /* As mentioned above, there is the possibility that - * entries will be dirtied, resized, flushed, or removed - * from the cache via the take ownership flag during - * our pass through the skip list. To capture the number - * of entries added, and the skip list size delta, - * zero the slist_len_increase and slist_size_increase of - * the cache's instance of H5C_t. These fields will be - * updated elsewhere to account for slist insertions and/or - * dirty entry size changes. - */ - cache_ptr->slist_len_increase = 0; - cache_ptr->slist_size_increase = 0; + /* We then zero counters that we use to track the number + * and total size of entries flushed: + */ + flushed_entries_count = 0; + flushed_entries_size = 0; + + /* As mentioned above, there is the possibility that + * entries will be dirtied, resized, flushed, or removed + * from the cache via the take ownership flag during + * our pass through the skip list. To capture the number + * of entries added, and the skip list size delta, + * zero the slist_len_increase and slist_size_increase of + * the cache's instance of H5C_t. These fields will be + * updated elsewhere to account for slist insertions and/or + * dirty entry size changes. + */ + cache_ptr->slist_len_increase = 0; + cache_ptr->slist_size_increase = 0; - /* at the end of the loop, use these values to compute the - * expected slist length and size and compare this with the - * value recorded in the cache's instance of H5C_t. - */ + /* at the end of the loop, use these values to compute the + * expected slist length and size and compare this with the + * value recorded in the cache's instance of H5C_t. + */ #endif /* H5C_DO_SANITY_CHECKS */ - restart_slist_scan = TRUE; - - while((restart_slist_scan ) || (node_ptr != NULL)) { - if(restart_slist_scan) { - restart_slist_scan = FALSE; + restart_slist_scan = TRUE; - /* Start at beginning of skip list */ - node_ptr = H5SL_first(cache_ptr->slist_ptr); + while((restart_slist_scan ) || (node_ptr != NULL)) { + if(restart_slist_scan) { + restart_slist_scan = FALSE; - if(node_ptr == NULL) - /* the slist is empty -- break out of inner loop */ - break; + /* Start at beginning of skip list */ + node_ptr = H5SL_first(cache_ptr->slist_ptr); - /* Get cache entry for this node */ - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(node_ptr == NULL) + /* the slist is empty -- break out of inner loop */ + break; - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + /* Get cache entry for this node */ + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - } /* end if */ - - entry_ptr = next_entry_ptr; + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - /* With the advent of the fractal heap, the free space - * manager, and the version 3 cache, it is possible - * that the pre-serialize or serialize callback will - * dirty, resize, or take ownership of other entries - * in the cache. - * - * To deal with this, I have inserted code to detect any - * change in the skip list not directly under the control - * of this function. If such modifications are detected, - * we must re-start the scan of the skip list to avoid - * the possibility that the target of the next_entry_ptr - * may have been flushed or deleted from the cache. - * - * To verify that all such possibilities have been dealt - * with, we do a bit of extra sanity checking on - * entry_ptr. - */ - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->in_slist); - HDassert(entry_ptr->is_dirty); - if(!flush_marked_entries || entry_ptr->flush_marker) - HDassert(entry_ptr->ring >= ring); + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + } /* end if */ + + entry_ptr = next_entry_ptr; + + /* With the advent of the fractal heap, the free space + * manager, and the version 3 cache, it is possible + * that the pre-serialize or serialize callback will + * dirty, resize, or take ownership of other entries + * in the cache. + * + * To deal with this, I have inserted code to detect any + * change in the skip list not directly under the control + * of this function. If such modifications are detected, + * we must re-start the scan of the skip list to avoid + * the possibility that the target of the next_entry_ptr + * may have been flushed or deleted from the cache. + * + * To verify that all such possibilities have been dealt + * with, we do a bit of extra sanity checking on + * entry_ptr. + */ + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->in_slist); + HDassert(entry_ptr->is_dirty); + if(!flush_marked_entries || entry_ptr->flush_marker) + HDassert(entry_ptr->ring >= ring); - /* increment node pointer now, before we delete its target - * from the slist. - */ - node_ptr = H5SL_next(node_ptr); - if(node_ptr != NULL) { - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - if(!flush_marked_entries || next_entry_ptr->flush_marker) - HDassert(next_entry_ptr->ring >= ring); - HDassert(entry_ptr != next_entry_ptr); - } /* end if */ - else - next_entry_ptr = NULL; + /* increment node pointer now, before we delete its target + * from the slist. + */ + node_ptr = H5SL_next(node_ptr); + if(node_ptr != NULL) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + if(!flush_marked_entries || next_entry_ptr->flush_marker) + HDassert(next_entry_ptr->ring >= ring); - HDassert(entry_ptr != NULL); - HDassert(entry_ptr->in_slist); + HDassert(entry_ptr != next_entry_ptr); + } /* end if */ + else + next_entry_ptr = NULL; - if(((!flush_marked_entries) || (entry_ptr->flush_marker)) && - ((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && - (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && - (entry_ptr->ring == ring)) { - if(entry_ptr->is_protected) { - /* we probably have major problems -- but lets - * flush everything we can before we decide - * whether to flag an error. - */ - tried_to_flush_protected_entry = TRUE; - protected_entries++; - } /* end if */ - else if(entry_ptr->is_pinned) { + HDassert(entry_ptr != NULL); + HDassert(entry_ptr->in_slist); - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush. Note that we - * aren't trying to do a destroy here, so that - * is not an issue. - */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height) { + if(((!flush_marked_entries) || (entry_ptr->flush_marker)) && + ((!entry_ptr->flush_me_last) || + (entry_ptr->flush_me_last && + ((cache_ptr->num_last_entries >= cache_ptr->slist_len) || + (flush_marked_entries && entry_ptr->flush_marker)))) && + ( ( entry_ptr->flush_dep_nchildren == 0 ) || + ( ( ! destroy ) && + ( entry_ptr->flush_dep_ndirty_children == 0 ) ) ) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { + /* we probably have major problems -- but lets + * flush everything we can before we decide + * whether to flag an error. + */ + tried_to_flush_protected_entry = TRUE; + protected_entries++; + } /* end if */ + else { #if H5C_DO_SANITY_CHECKS - flushed_entries_count++; - flushed_entries_size += (int64_t)entry_ptr->size; - entry_size_change = 0; + flushed_entries_count++; + flushed_entries_size += (int64_t)entry_ptr->size; + entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ - - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") #if H5C_DO_SANITY_CHECKS - /* it is possible that the entry size changed - * during flush -- update flushed_entries_size - * to account for this. - */ - flushed_entries_size += entry_size_change; + /* it is possible that the entry size changed + * during flush -- update flushed_entries_size + * to account for this. + */ + flushed_entries_size += entry_size_change; #endif /* H5C_DO_SANITY_CHECKS */ - flushed_during_dep_loop = TRUE; - - if((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize = FALSE; - cache_ptr->slist_change_in_serialize = FALSE; - - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } /* end if */ - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } /* end else-if */ - else { - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush. Note that we - * aren't trying to do a destroy here, so that - * is not an issue. + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height) { -#if H5C_DO_SANITY_CHECKS - flushed_entries_count++; - flushed_entries_size += (int64_t)entry_ptr->size; - entry_size_change = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") - -#if H5C_DO_SANITY_CHECKS - /* it is possible that the entry size changed - * during flush -- update flushed_entries_size - * to account for this. - */ - flushed_entries_size += entry_size_change; -#endif /* H5C_DO_SANITY_CHECKS */ - - flushed_during_dep_loop = TRUE; - - if((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize = FALSE; - cache_ptr->slist_change_in_serialize = FALSE; - - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } /* end if */ - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } /* end else */ - } /* end if */ - } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ - - /* Check for incrementing flush dependency height */ - if(flushed_during_dep_loop) { - - /* If we flushed an entry at this flush dependency height - * start over at the bottom level of the flush dependencies - */ - curr_flush_dep_height = 0; + restart_slist_scan = TRUE; + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; - /* Make certain we don't get stuck in an infinite loop */ - flush_dep_passes++; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ - /* Set flag for outer loop */ - flushed_entries_last_pass = TRUE; + flushed_entries_last_pass = TRUE; + } /* end else */ } /* end if */ - else - curr_flush_dep_height++; - } /* while ( curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) */ - - passes++; + } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ #if H5C_DO_SANITY_CHECKS /* Verify that the slist size and length are as expected. */ @@ -7108,9 +6872,6 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) if(((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry)) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items") - if((cache_ptr->slist_len != 0) && (passes >= H5C__MAX_PASSES_ON_FLUSH)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush pass limit exceeded.") - #if H5C_DO_SANITY_CHECKS if(!flush_marked_entries) { HDassert(cache_ptr->slist_ring_len[ring] == 0); @@ -7442,6 +7203,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL) + + /* verify that the entry is no longer part of any flush dependencies */ + HDassert(entry_ptr->flush_dep_nparents == 0); + HDassert(entry_ptr->flush_dep_nchildren == 0); } else { HDassert(clear_only || write_entry); @@ -7471,6 +7236,16 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ if(entry_ptr->type->clear && (entry_ptr->type->clear)(f, (void *)entry_ptr, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to clear entry") + + /* Propagate the clean flag up the flush dependency chain if + * appropriate */ + if(was_dirty) { + HDassert(entry_ptr->flush_dep_ndirty_children == 0); + + if(entry_ptr->flush_dep_nparents > 0) + if(H5C__mark_flush_dep_clean(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep clean flag") + } /* end if */ } /* reset the flush_in progress flag */ @@ -7646,7 +7421,6 @@ H5C_load_entry(H5F_t * f, void * thing = NULL; /* Pointer to thing loaded */ H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */ size_t len; /* Size of image in file */ - unsigned u; /* Local index variable */ #ifdef H5_HAVE_PARALLEL int mpi_rank = 0; /* MPI process rank */ MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */ @@ -7986,9 +7760,10 @@ H5C_load_entry(H5F_t * f, /* Initialize flush dependency height fields */ entry->flush_dep_parent = NULL; - for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) - entry->child_flush_dep_height_rc[u] = 0; - entry->flush_dep_height = 0; + entry->flush_dep_nparents = 0; + entry->flush_dep_parent_nalloc = 0; + entry->flush_dep_nchildren = 0; + entry->flush_dep_ndirty_children = 0; entry->ht_next = NULL; entry->ht_prev = NULL; @@ -8834,188 +8609,6 @@ H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr) /*------------------------------------------------------------------------- * - * Function: H5C_get_entry_ptr_from_addr() - * - * Purpose: Debugging function that attempts to look up an entry in the - * cache by its file address, and if found, returns a pointer - * to the entry in *entry_ptr_ptr. If the entry is not in the - * cache, *entry_ptr_ptr is set to NULL. - * - * WARNING: This call should be used only in debugging - * routines, and it should be avoided when - * possible. - * - * Further, if we ever multi-thread the cache, - * this routine will have to be either discarded - * or heavily re-worked. - * - * Finally, keep in mind that the entry whose - * pointer is obtained in this fashion may not - * be in a stable state. - * - * Note that this function is only defined if NDEBUG - * is not defined. - * - * As heavy use of this function is almost certainly a - * bad idea, the metadata cache tracks the number of - * successful calls to this function, and (if - * H5C_DO_SANITY_CHECKS is defined) displays any - * non-zero count on cache shutdown. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: John Mainzer, 5/30/14 - * - * Changes: - * - * None. - * - *------------------------------------------------------------------------- - */ -#ifndef NDEBUG -herr_t -H5C_get_entry_ptr_from_addr(const H5F_t *f, - haddr_t addr, - void ** entry_ptr_ptr) -{ - H5C_t * cache_ptr; - H5C_cache_entry_t * entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert( f ); - HDassert( f->shared ); - - cache_ptr = f->shared->cache; - - HDassert( cache_ptr != NULL ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( H5F_addr_defined(addr) ); - HDassert( entry_ptr_ptr != NULL ); - - /* this test duplicates two of the above asserts, but we need an - * invocation of HGOTO_ERROR to keep the compiler happy. - */ - if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - } - - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - - if ( entry_ptr == NULL ) { - - /* the entry doesn't exist in the cache -- report this - * and quit. - */ - *entry_ptr_ptr = NULL; - - } else { - - *entry_ptr_ptr = entry_ptr; - - /* increment call counter */ - (cache_ptr->get_entry_ptr_from_addr_counter)++; - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_get_entry_ptr_from_addr() */ - -#endif /* NDEBUG */ - - -/*------------------------------------------------------------------------- - * - * Function: H5C_verify_entry_type() - * - * Purpose: Debugging function that attempts to look up an entry in the - * cache by its file address, and if found, test to see if its - * type field contains the expted value. - * - * If the specified entry is in cache, *in_cache_ptr is set - * to TRUE, and *type_ok_ptr is set to TRUE or FALSE - * depending on whether the entries type field matches the - * expected_type parameter - * - * If the target entry is not in cache, *in_cache_ptr is - * set to FALSE, and *type_ok_ptr is undefined. - * - * Note that this function is only defined if NDEBUG - * is not defined. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: John Mainzer, 5/30/14 - * - * Changes: - * - * None. - * - *------------------------------------------------------------------------- - */ -#ifndef NDEBUG -herr_t -H5C_verify_entry_type(const H5F_t *f, - haddr_t addr, - const H5C_class_t * expected_type, - hbool_t * in_cache_ptr, - hbool_t * type_ok_ptr) -{ - H5C_t * cache_ptr; - H5C_cache_entry_t * entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert( f ); - HDassert( f->shared ); - - cache_ptr = f->shared->cache; - - HDassert( cache_ptr != NULL ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( H5F_addr_defined(addr) ); - HDassert( in_cache_ptr != NULL ); - HDassert( type_ok_ptr != NULL ); - - /* this test duplicates two of the above asserts, but we need an - * invocation of HGOTO_ERROR to keep the compiler happy. - */ - if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - } - - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - - if ( entry_ptr == NULL ) { - - /* the entry doesn't exist in the cache -- report this - * and quit. - */ - *in_cache_ptr = FALSE; - - } else { - - *in_cache_ptr = TRUE; - *type_ok_ptr = (expected_type == entry_ptr->type); - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_verify_entry_type() */ - -#endif /* NDEBUG */ - - -/*------------------------------------------------------------------------- - * * Function: H5C__flush_marked_entries * * Purpose: Flushes all marked entries in the cache. @@ -9145,6 +8738,122 @@ done: /*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_dirty() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming dirty or having its flush_dep_ndirty_children + * increased from 0. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * 11/13/12 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(entry); + + /* Iterate over the parent entries, if any */ + for(u = 0; u < entry->flush_dep_nparents; u++) { + /* Sanity check */ + HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children < entry->flush_dep_parent[u]->flush_dep_nchildren); + + /* Adjust the parent's number of dirty children */ + entry->flush_dep_parent[u]->flush_dep_ndirty_children++; + } /* end for */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5C__mark_flush_dep_dirty() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_clean() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming clean or having its flush_dep_ndirty_children + * reduced to 0. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * 11/13/12 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(entry); + + /* Iterate over the parent entries, if any */ + for(u = 0; u < entry->flush_dep_nparents; u++) { + /* Sanity check */ + HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children > 0); + + /* Adjust the parent's number of dirty children */ + entry->flush_dep_parent[u]->flush_dep_ndirty_children--; + } /* end for */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5C__mark_flush_dep_clean() */ + +#ifndef NDEBUG + +/*------------------------------------------------------------------------- + * Function: H5C__assert_flush_dep_nocycle() + * + * Purpose: Assert recursively that base_entry is not the same as + * entry, and perform the same assertion on all of entry's + * flush dependency parents. This is used to detect cycles + * created by flush dependencies. + * + * Return: void + * + * Programmer: Neil Fortner + * 12/10/12 + * + *------------------------------------------------------------------------- + */ +static void +H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t * entry, + const H5C_cache_entry_t * base_entry) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(entry); + HDassert(base_entry); + + /* Make sure the entries are not the same */ + HDassert(base_entry != entry); + + /* Iterate over entry's parents (if any) */ + for(u = 0; u < entry->flush_dep_nparents; u++) + H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry); + + FUNC_LEAVE_NOAPI_VOID +} /* H5C__assert_flush_dep_nocycle() */ +#endif /* NDEBUG */ + + +/*------------------------------------------------------------------------- * Function: H5C__generate_image * * Purpose: Serialize an entry and generate its image. diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index fe2be2f..cf2da3e 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -45,22 +45,13 @@ /* Package Private Macros */ /**************************/ -/* With the introduction of the fractal heap, it is now possible for - * entries to be dirtied, resized, and/or moved in the flush callbacks. - * As a result, on flushes, it may be necessary to make multiple passes - * through the slist before it is empty. The H5C__MAX_PASSES_ON_FLUSH - * #define is used to set an upper limit on the number of passes. - * The current value was obtained via personal communication with - * Quincey. I have applied a fudge factor of 2. - * - * -- JRM - */ -#define H5C__MAX_PASSES_ON_FLUSH 4 - /* Cache configuration settings */ #define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */ #define H5C__H5C_T_MAGIC 0x005CAC0E +/* Initial allocated size of the "flush_dep_parent" array */ +#define H5C_FLUSH_DEP_PARENT_INIT 8 + /* Cache client ID for epoch markers */ /* Note that H5C__MAX_EPOCH_MARKERS is defined in H5Cprivate.h, not here because * it is needed to dimension arrays in H5C_t. @@ -4063,11 +4054,6 @@ if ( ( (entry_ptr) == NULL ) || \ * field is intended to allow marking of output of with * the processes mpi rank. * - * get_entry_ptr_from_addr_counter: Counter used to track the number of - * times the H5C_get_entry_ptr_from_addr() function has been - * called successfully. This field is only defined when - * NDEBUG is not #defined. - * ****************************************************************************/ struct H5C_t { uint32_t magic; @@ -4252,10 +4238,6 @@ struct H5C_t { #endif /* H5C_COLLECT_CACHE_STATS */ char prefix[H5C__PREFIX_LEN]; - -#ifndef NDEBUG - int64_t get_entry_ptr_from_addr_counter; -#endif /* NDEBUG */ }; #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 8f88ebd..4137edf 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -97,14 +97,6 @@ #define H5C__DEFAULT_MAX_CACHE_SIZE ((size_t)(4 * 1024 * 1024)) #define H5C__DEFAULT_MIN_CLEAN_SIZE ((size_t)(2 * 1024 * 1024)) -/* Maximum height of flush dependency relationships between entries. This is - * currently tuned to the extensible array (H5EA) data structure, which only - * requires 6 levels of dependency (i.e. heights 0-6) (actually, the extensible - * array needs 4 levels, plus another 2 levels are needed: one for the layer - * under the extensible array and one for the layer above it). - */ -#define H5C__NUM_FLUSH_DEP_HEIGHTS 6 - /* Values for cache entry magic field */ #define H5C__H5C_CACHE_ENTRY_T_MAGIC 0x005CAC0A #define H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC 0xDeadBeef @@ -209,6 +201,7 @@ #define H5C__TAKE_OWNERSHIP_FLAG 0x0800 #define H5C__FLUSH_LAST_FLAG 0x1000 #define H5C__FLUSH_COLLECTIVELY_FLAG 0x2000 +#define H5C__EVICT_ALLOW_LAST_PINS_FLAG 0x4000 #define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x8000 /* Definitions for cache "tag" property */ @@ -1473,33 +1466,29 @@ typedef int H5C_ring_t; * * Fields supporting the 'flush dependency' feature: * - * Entries in the cache may have a 'flush dependency' on another entry in the + * Entries in the cache may have 'flush dependencies' on other entries in the * cache. A flush dependency requires that all dirty child entries be flushed * to the file before a dirty parent entry (of those child entries) can be * flushed to the file. This can be used by cache clients to create data * structures that allow Single-Writer/Multiple-Reader (SWMR) access for the * data structure. * - * The leaf child entry will have a "height" of 0, with any parent entries - * having a height of 1 greater than the maximum height of any of their child - * entries (flush dependencies are allowed to create asymmetric trees of - * relationships). - * - * flush_dep_parent: Pointer to the parent entry for an entry in a flush - * dependency relationship. + * flush_dep_parent: Pointer to the array of flush dependency parent entries + * for this entry. * - * child_flush_dep_height_rc: An array of reference counts for child entries, - * where the number of children of each height is tracked. + * flush_dep_nparents: Number of flush dependency parent entries for this + * entry, i.e. the number of valid elements in flush_dep_parent. * - * flush_dep_height: The height of the entry, which is one greater than the - * maximum height of any of its child entries.. + * flush_dep_parent_nalloc: The number of allocated elements in + * flush_dep_parent_nalloc. * - * pinned_from_client: Whether the entry was pinned by an explicit pin request - * from a cache client. + * flush_dep_nchildren: Number of flush dependency children for this entry. If + * this field is nonzero, then this entry must be pinned and + * therefore cannot be evicted. * - * pinned_from_cache: Whether the entry was pinned implicitly as a - * request of being a parent entry in a flush dependency - * relationship. + * flush_dep_ndirty_children: Number of flush dependency children that are + * either dirty or have a nonzero flush_dep_ndirty_children. If + * this field is nonzero, then this entry cannot be flushed. * * * Fields supporting the hash table: @@ -1644,9 +1633,11 @@ typedef struct H5C_cache_entry_t { H5C_ring_t ring; /* fields supporting the 'flush dependency' feature: */ - struct H5C_cache_entry_t * flush_dep_parent; - uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; - unsigned flush_dep_height; + struct H5C_cache_entry_t ** flush_dep_parent; + unsigned flush_dep_nparents; + unsigned flush_dep_parent_nalloc; + unsigned flush_dep_nchildren; + unsigned flush_dep_ndirty_children; hbool_t pinned_from_client; hbool_t pinned_from_cache; @@ -2041,13 +2032,5 @@ H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t *f, hid_t dxpl_id, int32_t ce_arra haddr_t *ce_array_ptr); #endif /* H5_HAVE_PARALLEL */ -#ifndef NDEBUG /* debugging functions */ -H5_DLL herr_t H5C_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, - void **entry_ptr_ptr); -H5_DLL herr_t H5C_verify_entry_type(const H5F_t *f, haddr_t addr, - const H5C_class_t *expected_type, hbool_t *in_cache_ptr, - hbool_t *type_ok_ptr); -#endif /* NDEBUG */ - #endif /* !_H5Cprivate_H */ diff --git a/src/H5Cquery.c b/src/H5Cquery.c index a693ec2..874b12f 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -277,9 +277,9 @@ H5C_get_entry_status(const H5F_t *f, if(is_corked_ptr != NULL) *is_corked_ptr = entry_ptr->is_corked; if(is_flush_dep_parent_ptr != NULL) - *is_flush_dep_parent_ptr = (entry_ptr->flush_dep_height > 0); + *is_flush_dep_parent_ptr = (entry_ptr->flush_dep_nchildren > 0); if(is_flush_dep_child_ptr != NULL) - *is_flush_dep_child_ptr = (entry_ptr->flush_dep_parent != NULL); + *is_flush_dep_child_ptr = (entry_ptr->flush_dep_nparents > 0); } /* end else */ done: @@ -74,6 +74,11 @@ typedef herr_t (*H5EA__unprotect_func_t)(void *thing, hid_t dxpl_id, /* Local Prototypes */ /********************/ +static herr_t +H5EA__lookup_elmt(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, hbool_t will_extend, + unsigned thing_acc, void **thing, uint8_t **thing_elmt_buf, + hsize_t *thing_elmt_idx, H5EA__unprotect_func_t *thing_unprot_func); + /*********************/ /* Package Variables */ @@ -133,10 +138,6 @@ H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam, void *ctx_udat H5EA_hdr_t *hdr = NULL; /* The extensible array header information */ haddr_t ea_addr; /* Array header address */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* * Check arguments. */ @@ -213,9 +214,6 @@ H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata)) HDassert(H5F_addr_defined(ea_addr)); /* Load the array header into memory */ -#ifdef QAK -HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); -#endif /* QAK */ if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header, address = %llu", (unsigned long long)ea_addr) @@ -272,10 +270,6 @@ H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts)) /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* * Check arguments. */ @@ -307,10 +301,6 @@ H5EA_get_addr(const H5EA_t *ea, haddr_t *addr)) /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* * Check arguments. */ @@ -325,7 +315,7 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */ /*------------------------------------------------------------------------- - * Function: H5EA_lookup_elmt + * Function: H5EA__lookup_elmt * * Purpose: Retrieve the metadata object and the element buffer for a * given element in the array. @@ -340,9 +330,9 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, -H5EA__lookup_elmt(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, unsigned thing_acc, - void **thing, uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx, - H5EA__unprotect_func_t *thing_unprot_func)) +H5EA__lookup_elmt(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, hbool_t will_extend, + unsigned thing_acc, void **thing, uint8_t **thing_elmt_buf, + hsize_t *thing_elmt_idx, H5EA__unprotect_func_t *thing_unprot_func)) /* Local variables */ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ @@ -355,11 +345,6 @@ H5EA__lookup_elmt(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, unsigned thing_a hbool_t stats_changed = FALSE; /* Whether array statistics changed */ hbool_t hdr_dirty = FALSE; /* Whether the array header changed */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); -#endif /* QAK */ - /* * Check arguments. */ @@ -383,9 +368,6 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); /* Check if we should create the index block */ if(!H5F_addr_defined(hdr->idx_blk_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: Index block address not defined!\n", FUNC, idx); -#endif /* QAK */ /* Check if we are allowed to create the thing */ if(0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ /* Create the index block */ @@ -397,9 +379,6 @@ HDfprintf(stderr, "%s: Index block address not defined!\n", FUNC, idx); else H5_LEAVE(SUCCEED) } /* end if */ -#ifdef QAK -HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); -#endif /* QAK */ /* Protect index block */ if(NULL == (iblock = H5EA__iblock_protect(hdr, dxpl_id, thing_acc))) @@ -420,26 +399,14 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); /* Get super block index where element is located */ sblk_idx = H5EA__dblock_sblk_idx(hdr, idx); -#ifdef QAK -HDfprintf(stderr, "%s: sblk_idx = %u, iblock->nsblks = %Zu\n", FUNC, sblk_idx, iblock->nsblks); -#endif /* QAK */ /* Adjust index to offset in super block */ elmt_idx = idx - (hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx); -#ifdef QAK -HDfprintf(stderr, "%s: after adjusting for super block elements, elmt_idx = %Hu\n", FUNC, elmt_idx); -#endif /* QAK */ /* Check for data block containing element address in the index block */ if(sblk_idx < iblock->nsblks) { -#ifdef QAK -HDfprintf(stderr, "%s: Element in data block pointed to by address in index block\n", FUNC); -#endif /* QAK */ /* Compute the data block index in index block */ dblk_idx = (size_t)(hdr->sblk_info[sblk_idx].start_dblk + (elmt_idx / hdr->sblk_info[sblk_idx].dblk_nelmts)); -#ifdef QAK -HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_idx, iblock->ndblk_addrs); -#endif /* QAK */ HDassert(dblk_idx < iblock->ndblk_addrs); /* Check if the data block has been allocated on disk yet */ @@ -470,6 +437,13 @@ HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_i /* Adjust index to offset in data block */ elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; + /* Check if there is already a dependency on the header */ + if(will_extend && !dblock->has_hdr_depend) { + if(H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and header, index = %llu", (unsigned long long)idx) + dblock->has_hdr_depend = TRUE; + } /* end if */ + /* Set 'thing' info to refer to the data block */ *thing = dblock; *thing_elmt_buf = (uint8_t *)dblock->elmts; @@ -490,9 +464,6 @@ HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_i /* Create super block */ sblk_addr = H5EA__sblock_create(hdr, dxpl_id, iblock, &stats_changed, sblk_idx); -#ifdef QAK -HDfprintf(stderr, "%s: New super block address is: %a\n", FUNC, sblk_addr); -#endif /* QAK */ if(!H5F_addr_defined(sblk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block") @@ -510,9 +481,6 @@ HDfprintf(stderr, "%s: New super block address is: %a\n", FUNC, sblk_addr); /* Compute the data block index in super block */ dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts); -#ifdef QAK -HDfprintf(stderr, "%s: dblk_idx = %u, sblock->ndblks = %Zu\n", FUNC, dblk_idx, sblock->ndblks); -#endif /* QAK */ HDassert(dblk_idx < sblock->ndblks); /* Check if the data block has been allocated on disk yet */ @@ -531,21 +499,20 @@ HDfprintf(stderr, "%s: dblk_idx = %u, sblock->ndblks = %Zu\n", FUNC, dblk_idx, s /* Set data block address in index block */ sblock->dblk_addrs[dblk_idx] = dblk_addr; sblock_cache_flags |= H5AC__DIRTIED_FLAG; + + /* Create flush dependency on header, if extending the array and one doesn't already exist */ + if(will_extend && !sblock->has_hdr_depend) { + if(H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr) + sblock->has_hdr_depend = TRUE; + } /* end if */ } /* end if */ else H5_LEAVE(SUCCEED) } /* end if */ -#ifdef QAK -if(sblock->dblk_npages) - HDfprintf(stderr, "%s: Check 1.0: elmt_idx = %Hu\n", FUNC, elmt_idx); -#endif /* QAK */ /* Adjust index to offset in data block */ elmt_idx %= sblock->dblk_nelmts; -#ifdef QAK -if(sblock->dblk_npages) - HDfprintf(stderr, "%s: Check 2.0: elmt_idx = %Hu\n", FUNC, elmt_idx); -#endif /* QAK */ /* Check if the data block is paged */ if(sblock->dblk_npages) { @@ -566,14 +533,6 @@ if(sblock->dblk_npages) dblk_page_addr = sblock->dblk_addrs[dblk_idx] + H5EA_DBLOCK_PREFIX_SIZE(sblock) + (page_idx * sblock->dblk_page_size); -#ifdef QAK -HDfprintf(stderr, "%s: sblock->addr = %a\n", FUNC, sblock->addr); -HDfprintf(stderr, "%s: sblock->dblk_addrs[%Zu] = %a\n", FUNC, dblk_idx, sblock->dblk_addrs[dblk_idx]); -HDfprintf(stderr, "%s: H5EA_DBLOCK_PREFIX_SIZE(sblock) = %u\n", FUNC, (unsigned)H5EA_DBLOCK_PREFIX_SIZE(sblock)); -HDfprintf(stderr, "%s: sblock->page_init[%Zu] = %t\n", FUNC, page_init_idx, H5VM_bit_get(sblock->page_init, page_init_idx)); -HDfprintf(stderr, "%s: page_idx = %Zu, elmt_idx = %Hu, dblk_page_addr = %a\n", FUNC, page_idx, elmt_idx, dblk_page_addr); -HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_size); -#endif /* QAK */ /* Check if page has been initialized yet */ if(!H5VM_bit_get(sblock->page_init, page_init_idx)) { @@ -595,6 +554,13 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, dxpl_id, sblock, dblk_page_addr, thing_acc))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr) + /* Check if there is already a dependency on the header */ + if(will_extend && !dblk_page->has_hdr_depend) { + if(H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block page and header, index = %llu", (unsigned long long)idx) + dblk_page->has_hdr_depend = TRUE; + } /* end if */ + /* Set 'thing' info to refer to the data block page */ *thing = dblk_page; *thing_elmt_buf = (uint8_t *)dblk_page->elmts; @@ -606,6 +572,13 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, sblock, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, thing_acc))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)sblock->dblk_addrs[dblk_idx]) + /* Check if there is already a dependency on the header */ + if(will_extend && !dblock->has_hdr_depend) { + if(H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and header, index = %llu", (unsigned long long)idx) + dblock->has_hdr_depend = TRUE; + } /* end if */ + /* Set 'thing' info to refer to the data block */ *thing = dblock; *thing_elmt_buf = (uint8_t *)dblock->elmts; @@ -615,6 +588,10 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ } /* end else */ } /* end else */ + /* Sanity checks */ + HDassert(*thing != NULL); + HDassert(*thing_unprot_func != NULL); + CATCH /* Reset 'thing' info on error */ if(ret_value < 0) { @@ -644,7 +621,7 @@ CATCH if(dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page") -END_FUNC(STATIC) /* end H5EA_lookup_elmt() */ +END_FUNC(STATIC) /* end H5EA__lookup_elmt() */ /*------------------------------------------------------------------------- @@ -670,13 +647,9 @@ H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt)) uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ + hbool_t will_extend; /* Flag indicating if setting the element will extend the array */ unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); -#endif /* QAK */ - /* * Check arguments. */ @@ -687,7 +660,8 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); hdr->f = ea->f; /* Look up the array metadata containing the element we want to set */ - if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) + will_extend = (idx >= hdr->stats.stored.max_idx_set); + if(H5EA__lookup_elmt(ea, dxpl_id, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") /* Sanity check */ @@ -700,10 +674,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); thing_cache_flags |= H5AC__DIRTIED_FLAG; /* Update max. element set in array, if appropriate */ -#ifdef QAK -HDfprintf(stderr, "%s: idx = %Hu, hdr->stats.max_idx_set = %Hu\n", FUNC, idx, hdr->stats.max_idx_set); -#endif /* QAK */ - if(idx >= hdr->stats.stored.max_idx_set) { + if(will_extend) { /* Update the max index for the array */ hdr->stats.stored.max_idx_set = idx + 1; if(H5EA__hdr_modified(hdr) < 0) @@ -740,11 +711,6 @@ H5EA_get(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt)) void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); -#endif /* QAK */ - /* * Check arguments. */ @@ -753,9 +719,6 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); /* Check for element beyond max. element in array */ if(idx >= hdr->stats.stored.max_idx_set) { -#ifdef QAK -HDfprintf(stderr, "%s: Element beyond max. index set, hdr->stats.max_idx_set = %Hu, idx = %Hu\n", FUNC, hdr->stats.max_idx_set, idx); -#endif /* QAK */ /* Call the class's 'fill' callback */ if((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") @@ -764,15 +727,11 @@ HDfprintf(stderr, "%s: Element beyond max. index set, hdr->stats.max_idx_set = % uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ -#ifdef QAK -HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); -#endif /* QAK */ - /* Set the shared array header's file context for this operation */ hdr->f = ea->f; /* Look up the array metadata containing the element we want to set */ - if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) + if(H5EA__lookup_elmt(ea, dxpl_id, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") /* Check if the thing holding the element has been created yet */ @@ -815,10 +774,6 @@ H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea)) /* Local variables */ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* * Check arguments. */ @@ -838,49 +793,6 @@ END_FUNC(PRIV) /* end H5EA_depend() */ /*------------------------------------------------------------------------- - * Function: H5EA_undepend - * - * Purpose: Remove a child flush dependency between the extensible array's - * header and another piece of metadata in the file. - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * May 27 2009 - * - *------------------------------------------------------------------------- - */ -BEGIN_FUNC(PRIV, ERR, -herr_t, SUCCEED, FAIL, -H5EA_undepend(H5AC_info_t *parent_entry, H5EA_t *ea)) - - /* Local variables */ - H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ - -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - - /* - * Check arguments. - */ - HDassert(ea); - HDassert(hdr); - - /* Set the shared array header's file context for this operation */ - hdr->f = ea->f; - - /* Remove flush dependency between parent entry and extensible array header */ - if(H5EA__destroy_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on file metadata") - -CATCH - -END_FUNC(PRIV) /* end H5EA_undepend() */ - - -/*------------------------------------------------------------------------- * Function: H5EA_close * * Purpose: Close an extensible array @@ -901,10 +813,6 @@ H5EA_close(H5EA_t *ea, hid_t dxpl_id)) hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* * Check arguments. */ @@ -1009,9 +917,6 @@ H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata)) HDassert(H5F_addr_defined(ea_addr)); /* Lock the array header into memory */ -#ifdef QAK -HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); -#endif /* QAK */ if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) diff --git a/src/H5EAcache.c b/src/H5EAcache.c index e9c93d4..9224916 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -1179,13 +1179,25 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)) break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - /* do nothing */ + /* Destroy flush dependency on extensible array header, if set */ + if(sblock->has_hdr_depend) { + if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr) + sblock->has_hdr_depend = FALSE; + } /* end if */ break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on index block */ if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) + + /* Destroy flush dependency on extensible array header, if set */ + if(sblock->has_hdr_depend) { + if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr) + sblock->has_hdr_depend = FALSE; + } /* end if */ break; default: @@ -1534,13 +1546,25 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - /* do nothing */ + /* Destroy flush dependency on extensible array header, if set */ + if(dblock->has_hdr_depend) { + if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between direct block and header, address = %llu", (unsigned long long)dblock->addr) + dblock->has_hdr_depend = FALSE; + } /* end if */ break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr) + + /* Destroy flush dependency on extensible array header, if set */ + if(dblock->has_hdr_depend) { + if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between direct block and header, address = %llu", (unsigned long long)dblock->addr) + dblock->has_hdr_depend = FALSE; + } /* end if */ break; default: @@ -1856,13 +1880,25 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - /* do nothing */ + /* Destroy flush dependency on extensible array header, if set */ + if(dblk_page->has_hdr_depend) { + if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and header, address = %llu", (unsigned long long)dblk_page->addr) + dblk_page->has_hdr_depend = FALSE; + } /* end if */ break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) + + /* Destroy flush dependency on extensible array header, if set */ + if(dblk_page->has_hdr_depend) { + if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and header, address = %llu", (unsigned long long)dblk_page->addr) + dblk_page->has_hdr_depend = FALSE; + } /* end if */ break; default: diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 9f3b39a..327feb0 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -156,10 +156,6 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent, /* Local variables */ H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ -#ifdef QAK -HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); @@ -170,9 +166,6 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); /* Set info about data block page on disk */ dblk_page->addr = addr; dblk_page->size = H5EA_DBLK_PAGE_SIZE(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); -#endif /* QAK */ /* Clear any elements in data block page to fill value */ if((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0) @@ -215,10 +208,6 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent, /* Local variables */ H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(dblk_page_addr)); @@ -261,10 +250,6 @@ H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, hid_t dxpl_id, /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(dblk_page); @@ -296,6 +281,7 @@ H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page)) /* Sanity check */ HDassert(dblk_page); + HDassert(!dblk_page->has_hdr_depend); /* Check if header field has been initialized */ if(dblk_page->hdr) { diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index 3eaaf1c..9511a9d 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -169,10 +169,6 @@ H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ haddr_t dblock_addr; /* Extensible array data block address */ -#ifdef QAK -HDfprintf(stderr, "%s: Called, hdr->dblk_page_nelmts = %Zu, nelmts = %Zu\n", FUNC, hdr->dblk_page_nelmts, nelmts); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(stats_changed); @@ -184,15 +180,9 @@ HDfprintf(stderr, "%s: Called, hdr->dblk_page_nelmts = %Zu, nelmts = %Zu\n", FUN /* Set size of data block on disk */ dblock->size = H5EA_DBLOCK_SIZE(dblock); -#ifdef QAK -HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); -#endif /* QAK */ /* Set offset of block in array's address space */ dblock->block_off = dblk_off; -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ /* Allocate space for the data block on disk */ if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dxpl_id, (hsize_t)dblock->size))) @@ -262,25 +252,12 @@ H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx)) HDassert(hdr); HDassert(idx >= hdr->cparam.idx_blk_elmts); -#ifdef QAK -HDfprintf(stderr, "%s: Entering - idx = %Hu\n", FUNC, idx); -#endif /* QAK */ /* Adjust index for elements in index block */ idx -= hdr->cparam.idx_blk_elmts; -#ifdef QAK -HDfprintf(stderr, "%s: after adjusting for index block elements, idx = %Hu\n", FUNC, idx); -#endif /* QAK */ /* Determine the superblock information for the index */ H5_CHECK_OVERFLOW(idx, /*From:*/hsize_t, /*To:*/uint64_t); -#ifdef QAK -HDfprintf(stderr, "%s: hdr->cparam.data_blk_min_elmts = %u\n", FUNC, (unsigned)hdr->cparam.data_blk_min_elmts); -#endif /* QAK */ sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); -#ifdef QAK -HDfprintf(stderr, "%s: sblk_idx = %u\n", FUNC, sblk_idx); -HDfprintf(stderr, "%s: hdr->sblk_info[%u] = {%Hu, %Zu, %Hu, %Hu}\n", FUNC, sblk_idx, hdr->sblk_info[sblk_idx].ndblks, hdr->sblk_info[sblk_idx].dblk_nelmts, hdr->sblk_info[sblk_idx].start_idx, hdr->sblk_info[sblk_idx].start_dblk); -#endif /* QAK */ /* Set return value */ ret_value = sblk_idx; @@ -309,10 +286,6 @@ H5EA__dblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, /* Local variables */ H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(dblk_addr)); @@ -355,10 +328,6 @@ H5EA__dblock_unprotect(H5EA_dblock_t *dblock, hid_t dxpl_id, unsigned cache_flag /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(dblock); @@ -392,10 +361,6 @@ H5EA__dblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, /* Local variables */ H5EA_dblock_t *dblock = NULL; /* Pointer to data block */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(parent); @@ -420,16 +385,10 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Iterate over pages in data block */ for(u = 0; u < npages; u++) { -#ifdef QAK -HDfprintf(stderr, "%s: Expunging data block page from cache\n", FUNC); -#endif /* QAK */ /* Evict the data block page from the metadata cache */ /* (OK to call if it doesn't exist in the cache) */ if(H5AC_expunge_entry(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache") -#ifdef QAK -HDfprintf(stderr, "%s: Done expunging data block page from cache\n", FUNC); -#endif /* QAK */ /* Advance to next page address */ dblk_page_addr += dblk_page_size; @@ -463,6 +422,7 @@ H5EA__dblock_dest(H5EA_dblock_t *dblock)) /* Sanity check */ HDassert(dblock); + HDassert(!dblock->has_hdr_depend); /* Check if shared header field has been initialized */ if(dblock->hdr) { diff --git a/src/H5EApkg.h b/src/H5EApkg.h index 2e13694..6f3ee9c 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -241,6 +241,7 @@ typedef struct H5EA_sblock_t { /* Internal array information (not stored) */ H5EA_hdr_t *hdr; /* Shared array header info */ + hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */ H5EA_iblock_t *parent; /* Parent object for super block (index block) */ haddr_t addr; /* Address of this index block on disk */ size_t size; /* Size of index block on disk */ @@ -265,6 +266,7 @@ typedef struct H5EA_dblock_t { /* Internal array information (not stored) */ H5EA_hdr_t *hdr; /* Shared array header info */ + hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */ void *parent; /* Parent object for data block (index or super block) */ haddr_t addr; /* Address of this data block on disk */ size_t size; /* Size of data block on disk */ @@ -284,6 +286,7 @@ typedef struct H5EA_dbk_page_t { /* Internal array information (not stored) */ H5EA_hdr_t *hdr; /* Shared array header info */ + hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */ H5EA_sblock_t *parent; /* Parent object for data block page (super block) */ haddr_t addr; /* Address of this data block page on disk */ size_t size; /* Size of data block page on disk */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index f775484..4f153cd 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -133,9 +133,6 @@ H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx)) sblock->ndblks = hdr->sblk_info[sblk_idx].ndblks; HDassert(sblock->ndblks); sblock->dblk_nelmts = hdr->sblk_info[sblk_idx].dblk_nelmts; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->dblk_page_nelmts = %Zu, sblock->ndblks = %Zu, sblock->dblk_nelmts = %Zu\n", FUNC, hdr->dblk_page_nelmts, sblock->ndblks, sblock->dblk_nelmts); -#endif /* QAK */ /* Allocate buffer for data block addresses in super block */ if(NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks))) @@ -199,10 +196,6 @@ H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_iblock_t *parent, haddr_t sblock_addr; /* Extensible array super block address */ haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(stats_changed); @@ -213,15 +206,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Set size of super block on disk */ sblock->size = H5EA_SBLOCK_SIZE(sblock); -#ifdef QAK -HDfprintf(stderr, "%s: sblock->size = %Zu\n", FUNC, sblock->size); -#endif /* QAK */ /* Set offset of block in array's address space */ sblock->block_off = hdr->sblk_info[sblk_idx].start_idx; -#ifdef QAK -HDfprintf(stderr, "%s: sblock->block_off = %Hu\n", FUNC, sblock->block_off); -#endif /* QAK */ /* Allocate space for the super block on disk */ if(HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, dxpl_id, (hsize_t)sblock->size))) @@ -281,11 +268,6 @@ H5EA__sblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_iblock_t *parent, /* Local variables */ H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */ - -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(sblk_addr)); @@ -327,10 +309,6 @@ H5EA__sblock_unprotect(H5EA_sblock_t *sblock, hid_t dxpl_id, unsigned cache_flag /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(sblock); @@ -365,10 +343,6 @@ H5EA__sblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_iblock_t *parent, H5EA_sblock_t *sblock = NULL; /* Pointer to super block */ size_t u; /* Local index variable */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(sblk_addr)); @@ -415,9 +389,7 @@ H5EA__sblock_dest(H5EA_sblock_t *sblock)) /* Sanity check */ HDassert(sblock); -#ifdef QAK -HDfprintf(stderr, "%s: sblock->hdr->dblk_page_nelmts = %Zu, sblock->ndblks = %Zu, sblock->dblk_nelmts = %Zu\n", FUNC, sblock->hdr->dblk_page_nelmts, sblock->ndblks, sblock->dblk_nelmts); -#endif /* QAK */ + HDassert(!sblock->has_hdr_depend); /* Check if shared header field has been initialized */ if(sblock->hdr) { @@ -1608,12 +1608,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing) +H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*xiIu", file, dxpl_id, closing); + H5TRACE3("e", "*xib", file, dxpl_id, closing); /* Check args */ if(!file || !file->cls) @@ -1647,7 +1647,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing) +H5FD_flush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 865a29e..5ce6560 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -139,7 +139,7 @@ static herr_t H5FD__core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, had size_t size, void *buf); static herr_t H5FD__core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_core_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_core_unlock(H5FD_t *_file); @@ -1335,7 +1335,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UNUSED closing) +H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index b92a685..3b38836 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -104,8 +104,8 @@ static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, ha size_t size, void *_buf/*out*/); static herr_t H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf); -static herr_t H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); -static herr_t H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +static herr_t H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_family_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_family_unlock(H5FD_t *_file); @@ -1249,7 +1249,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) +H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned u, nerrors = 0; @@ -1284,7 +1284,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, unsigned closing) +H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned u, nerrors = 0; diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index bf27b1a..0e49813 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -133,7 +133,7 @@ static herr_t H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, had size_t size, void *_buf/*out*/); static herr_t H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf); -static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_multi_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_multi_unlock(H5FD_t *_file); @@ -1686,7 +1686,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, *------------------------------------------------------------------------- */ static herr_t -H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) +H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { H5FD_multi_t *file = (H5FD_multi_t*)_file; H5FD_mem_t mt; diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 639f3eb..915f7e1 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -158,7 +158,7 @@ H5_DLL herr_t H5FD_read(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t typ haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing); +H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw); H5_DLL herr_t H5FD_unlock(H5FD_t *file); diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 4183d14..4931e0f 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -272,7 +272,7 @@ typedef struct H5FD_class_t { haddr_t addr, size_t size, void *buffer); herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, const void *buffer); - herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, unsigned closing); + herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); herr_t (*truncate)(H5FD_t *file, hid_t dxpl_id, hbool_t closing); herr_t (*lock)(H5FD_t *file, hbool_t rw); herr_t (*unlock)(H5FD_t *file); @@ -353,7 +353,7 @@ H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing); +H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); H5_DLL herr_t H5FDunlock(H5FD_t *file); diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index bc85c74..0168ff4 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -173,7 +173,7 @@ static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_ size_t size, void *buf); static herr_t H5FD_stdio_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_stdio_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_stdio_unlock(H5FD_t *_file); @@ -955,7 +955,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, unsigned closing) +H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 38556b7..759fff0 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -118,13 +118,13 @@ static herr_t H5HF__cache_dblock_free_icr(void *thing); /* Debugging Function Prototypes */ #ifndef NDEBUG -static herr_t H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, - H5HF_hdr_t *hdr, hbool_t *clean); -static herr_t H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, hid_t dxpl_id, +static herr_t H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, + hbool_t *clean); +static herr_t H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, H5HF_indirect_t *iblock, unsigned *iblock_status, hbool_t *clean); static herr_t H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_dblocks); -static herr_t H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, hid_t dxpl_id, +static herr_t H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_iblocks); #endif /* NDEBUG */ @@ -657,7 +657,7 @@ H5HF__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, * * Do this with a call to H5HF__cache_verify_hdr_descendants_clean(). */ - if(H5HF__cache_verify_hdr_descendants_clean((H5F_t *)f, dxpl_id, hdr, &descendants_clean) < 0) + if(H5HF__cache_verify_hdr_descendants_clean((H5F_t *)f, hdr, &descendants_clean) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify hdr descendants clean.") HDassert(descendants_clean); } @@ -1165,7 +1165,7 @@ H5HF__cache_iblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, * there is no need to check to see if it is pinned or protected, or to * protect it if it is not. */ - if(H5HF__cache_verify_iblock_descendants_clean((H5F_t *)f, dxpl_id, iblock, &iblock_status, &descendants_clean) < 0) + if(H5HF__cache_verify_iblock_descendants_clean((H5F_t *)f, iblock, &iblock_status, &descendants_clean) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify descendants clean.") HDassert(descendants_clean); } @@ -2479,8 +2479,8 @@ done: */ #ifndef NDEBUG static herr_t -H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, - H5HF_hdr_t * hdr, hbool_t *clean) +H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, + hbool_t *clean) { haddr_t hdr_addr; /* Address of header */ unsigned hdr_status = 0; /* Header cache entry status */ @@ -2561,122 +2561,11 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, *clean = TRUE; else if(root_iblock_status & H5AC_ES__IS_DIRTY) *clean = FALSE; - else { /* must examine children */ - hbool_t unprotect_root_iblock = FALSE; - - /* At this point, the root iblock may be pinned, protected, - * both, or neither, and we may or may not have a pointer - * to root iblock in memory. - * - * Before we call H5HF__cache_verify_iblock_descendants_clean(), - * we must ensure that the root iblock is either pinned or - * protected or both, and that we have a pointer to it. - * Do this as follows: - */ - if(root_iblock == NULL) { /* we don't have ptr to root iblock */ - if(0 == (root_iblock_status & H5AC_ES__IS_PROTECTED)) { - /* just protect the root iblock -- this will give us - * the pointer we need to proceed, and ensure that - * it is locked into the metadata cache for the - * duration. - * - * Note that the udata is only used in the load callback. - * While the fractal heap makes heavy use of the udata - * in this case, since we know that the entry is in cache, - * we can pass NULL udata. - */ - if(NULL == (root_iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5C__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") - unprotect_root_iblock = TRUE; - } /* end if */ - else { - /* the root iblock is protected, and we have no - * legitimate way of getting a pointer to it. - * - * We square this circle by using the - * H5AC_get_entry_ptr_from_addr() to get the needed - * pointer. - * - * WARNING: This call should be used only in debugging - * routines, and it should be avoided there when - * possible. - * - * Further, if we ever multi-thread the cache, - * this routine will have to be either discarded - * or heavily re-worked. - * - * Finally, keep in mind that the entry whose - * pointer is obtained in this fashion may not - * be in a stable state. - * - * Assuming that the flush dependency code is working - * as it should, the only reason for the root iblock to - * be unpinned is if none of its children are in cache. - * This unfortunately means that if it is protected and - * not pinned, the fractal heap is in the process of loading - * or inserting one of its children. The obvious implication - * is that there is a significant chance that the root - * iblock is in an unstable state. - * - * All this suggests that using H5AC_get_entry_ptr_from_addr() - * to obtain the pointer to the protected root iblock is - * questionable here. However, since this is test/debugging - * code, I expect that we will use this approach until it - * causes problems, or we think of a better way. - */ - if(H5AC_get_entry_ptr_from_addr(f, root_iblock_addr, (void **)(&root_iblock)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() failed.") - HDassert(root_iblock); - } /* end else */ - } /* end if */ - else { /* root_iblock != NULL */ - /* we have the pointer to the root iblock. Protect it - * if it is neither pinned nor protected -- otherwise we - * are ready to go. - */ - H5HF_indirect_t * iblock = NULL; - - if(((root_iblock_status & H5AC_ES__IS_PINNED) == 0) && - ((root_iblock_status & H5AC_ES__IS_PROTECTED) == 0)) { - /* the root iblock is neither pinned nor protected -- hence - * we must protect it before we proceed - * - * Note that the udata is only used in the load callback. - * While the fractal heap makes heavy use of the udata - * in this case, since we know that the entry is in cache, - * we can pass NULL udata. - */ - if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5C__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") - unprotect_root_iblock = TRUE; - HDassert(iblock == root_iblock); - } /* end if */ - } /* end else */ - - /* at this point, one way or another, the root iblock is locked - * in memory for the duration of the call. Do some sanity checks, - * and then call H5HF__cache_verify_iblock_descendants_clean(). - */ - HDassert(hdr->root_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->root_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - - if(H5HF__cache_verify_iblock_descendants_clean(f, dxpl_id, root_iblock, &root_iblock_status, clean) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify root iblock & descendants clean.") - - /* unprotect the root indirect block if required */ - if(unprotect_root_iblock) { - HDassert(root_iblock); - if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, root_iblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") - } /* end if */ - } /* end else */ } /* end if */ else if((hdr->man_dtable.curr_root_rows == 0) && (HADDR_UNDEF != hdr->man_dtable.table_addr)) { haddr_t root_dblock_addr; unsigned root_dblock_status = 0; - hbool_t in_cache; - hbool_t type_ok; /* this is scenario 2 -- we have a root dblock */ root_dblock_addr = hdr->man_dtable.table_addr; @@ -2684,27 +2573,16 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root dblock status") if(root_dblock_status & H5AC_ES__IN_CACHE) { - if(H5AC_verify_entry_type(f, root_dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") - HDassert(in_cache); - if(!type_ok) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock addr doesn't refer to a dblock?!?") - /* If a root dblock is in cache, it must have a flush - * dependency relationship with the header, and it - * may not be the parent in any flush dependency - * relationship. - * - * We don't test this fully, but we will verify that - * the root iblock is a child in some flush dependency - * relationship. + * dependency relationship with the header. */ if(0 == (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and not a flush dep child.") if(0 != (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT)) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and is a flush dep parent.") - *clean = ! (root_dblock_status & H5AC_ES__IS_DIRTY); + if(root_dblock_status & H5AC_ES__IS_DIRTY) + *clean = FALSE; } /* end if */ else /* root dblock not in cache */ *clean = TRUE; @@ -2757,8 +2635,8 @@ done: */ #ifndef NDEBUG static herr_t -H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, hid_t dxpl_id, - H5HF_indirect_t *iblock, unsigned *iblock_status, hbool_t *clean) +H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, H5HF_indirect_t *iblock, + unsigned *iblock_status, hbool_t *clean) { hbool_t has_dblocks = FALSE; hbool_t has_iblocks = FALSE; @@ -2778,12 +2656,9 @@ H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, hid_t dxpl_id, if((*clean) && H5HF__cache_verify_iblocks_dblocks_clean(f, iblock, clean, &has_dblocks) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify dblocks clean.") - if((*clean) && H5HF__cache_verify_descendant_iblocks_clean(f, dxpl_id, iblock, clean, &has_iblocks) < 0) + if((*clean) && H5HF__cache_verify_descendant_iblocks_clean(f, iblock, clean, &has_iblocks) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify iblocks clean.") - if((NULL == iblock_status) && H5AC_get_entry_status(f, iblock->addr, iblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") - /* verify that flush dependency setup is plausible */ if(0 == (*iblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock is not a flush dep child.") @@ -2855,41 +2730,25 @@ H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, dblock_addr = iblock->ents[i].addr; if(H5F_addr_defined(dblock_addr)) { - hbool_t in_cache; - hbool_t type_ok; - - if(H5AC_verify_entry_type(f, dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") - - if(in_cache) { /* dblock is in cache */ - unsigned dblock_status = 0; + unsigned dblock_status = 0; - if(!type_ok) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock addr doesn't refer to a dblock?!?") + if(H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get dblock status") + if(dblock_status & H5AC_ES__IN_CACHE) { + *has_dblocks = TRUE; - if(H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get dblock status") - HDassert(dblock_status & H5AC_ES__IN_CACHE); - - *has_dblocks = TRUE; if(dblock_status & H5AC_ES__IS_DIRTY) - *clean = FALSE; + *clean = FALSE; /* If a child dblock is in cache, it must have a flush * dependency relationship with this iblock, and it * may not be the parent in any flush dependency * relationship. - * - * We don't test this fully, but we will verify that - * the child iblock is a child in some flush dependency - * relationship. */ if(0 == (dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock in cache and not a flush dep child.") - if(0 != (dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT)) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock in cache and is a flush dep parent.") - } /* end if */ } /* end if */ @@ -2931,8 +2790,8 @@ done: */ #ifndef NDEBUG static herr_t -H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, hid_t dxpl_id, - H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_iblocks) +H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, + hbool_t *clean, hbool_t *has_iblocks) { unsigned first_iblock_index; unsigned last_iblock_index; @@ -2970,113 +2829,6 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, hid_t dxpl_id, *has_iblocks = TRUE; if(child_iblock_status & H5AC_ES__IS_DIRTY) *clean = FALSE; - - /* if the child iblock is in cache and *clean is TRUE, - * we must continue to explore down the fractal heap tree - * structure to verify that all descendant blocks are either - * clean, or not in the metadata cache. We do this with a - * recursive call to - * H5HF__cache_verify_iblock_descendants_clean(). - * However, we can't make this call unless the child iblock - * is somehow locked into the cache -- typically via either - * pinning or protecting. - * - * If the child iblock is pinned, we can look up its pointer - * on the current iblock's pinned child iblock list, and - * and use that pointer in the recursive call. - * - * If the entry is unprotected and unpinned, we simply - * protect it. - * - * If, however, the the child iblock is already protected, - * but not pinned, we have a bit of a problem, as we have - * no legitimate way of looking up its pointer in memory. - * - * To solve this problem, I have added a new metadata cache - * call to obtain the pointer. - * - * WARNING: This call should be used only in debugging - * routines, and it should be avoided there when - * possible. - * - * Further, if we ever multi-thread the cache, - * this routine will have to be either discarded - * or heavily re-worked. - * - * Finally, keep in mind that the entry whose - * pointer is obtained in this fashion may not - * be in a stable state. - * - * Assuming that the flush dependency code is working - * as it should, the only reason for the child entry to - * be unpinned is if none of its children are in cache. - * This unfortunately means that if it is protected and - * not pinned, the fractal heap is in the process of loading - * or inserting one of its children. The obvious implication - * is that there is a significant chance that the child - * iblock is in an unstable state. - * - * All this suggests that using the new call to obtain the - * pointer to the protected child iblock is questionable - * here. However, since this is test/debugging code, I - * expect that we will use this approach until it causes - * problems, or we think of a better way. - */ - if(*clean) { - H5HF_indirect_t *child_iblock = NULL; - hbool_t unprotect_child_iblock = FALSE; - - if(0 == (child_iblock_status & H5AC_ES__IS_PINNED)) { - /* child iblock is not pinned */ - if(0 == (child_iblock_status & H5AC_ES__IS_PROTECTED)) { - /* child iblock is unprotected, and unpinned */ - /* protect it. Note that the udata is only */ - /* used in the load callback. While the */ - /* fractal heap makes heavy use of the udata */ - /* in this case, since we know that the */ - /* entry is in cache, we can pass NULL udata */ - - if(NULL == (child_iblock = (H5HF_indirect_t *) H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, child_iblock_addr, NULL, H5C__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") - unprotect_child_iblock = TRUE; - } /* end if */ - else { - /* child iblock is protected -- use */ - /* H5AC_get_entry_ptr_from_addr() to get a */ - /* pointer to the entry. This is very slimy -- */ - /* come up with a better solution. */ - if(H5AC_get_entry_ptr_from_addr(f, child_iblock_addr, (void **)(&child_iblock)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() faild.") - HDassert(child_iblock); - } /* end else */ - } /* end if */ - else { - /* child iblock is pinned -- look it up in the */ - /* parent iblocks child_iblocks array. */ - HDassert(iblock->child_iblocks); - child_iblock = iblock->child_iblocks[i - first_iblock_index]; - } /* end else */ - - /* At this point, one way or another we should have - * a pointer to the child iblock. Verify that we - * that we have the correct one. - */ - HDassert(child_iblock); - HDassert(child_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(child_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(child_iblock->addr == child_iblock_addr); - - /* now make the recursive call */ - if(H5HF__cache_verify_iblock_descendants_clean(f, dxpl_id, child_iblock, &child_iblock_status, clean) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify child iblock clean.") - - /* if we protected the child iblock, unprotect it now */ - if(unprotect_child_iblock) { - if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, child_iblock_addr, child_iblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") - - } /* end if */ - } /* end if */ } /* end if */ } /* end if */ @@ -156,7 +156,7 @@ H5MM__is_our_block(void *mem) * *------------------------------------------------------------------------- */ -static void +H5_ATTR_PURE static void H5MM__sanity_check_block(const H5MM_block_t *block) { HDassert(block->u.info.size > 0); @@ -182,7 +182,7 @@ H5MM__sanity_check_block(const H5MM_block_t *block) * *------------------------------------------------------------------------- */ -static void +H5_ATTR_PURE static void H5MM__sanity_check(void *mem) { H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); @@ -203,7 +203,7 @@ H5MM__sanity_check(void *mem) * *------------------------------------------------------------------------- */ -void +H5_ATTR_PURE void H5MM_sanity_check_all(void) { H5MM_block_t *curr = NULL; @@ -228,7 +228,7 @@ H5MM_sanity_check_all(void) * *------------------------------------------------------------------------- */ -void +H5_ATTR_PURE void H5MM_final_sanity_check(void) { HDassert(0 == H5MM_curr_alloc_bytes_s); @@ -704,7 +704,7 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info) const H5Z_class2_t *plugin_info; if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PLget_plugin_info"))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)())) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info") @@ -3090,8 +3090,10 @@ H5T__create(H5T_class_t type, size_t size) subtype = H5T_NATIVE_INT_g; else if(sizeof(long) == size) subtype = H5T_NATIVE_LONG_g; +#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG else if(sizeof(long long) == size) subtype = H5T_NATIVE_LLONG_g; +#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type") if(NULL == (dt = H5T__alloc())) diff --git a/src/H5Znbit.c b/src/H5Znbit.c index e2fb300..04e8869 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -29,10 +29,10 @@ * one nbit atomic datatype: integer or floating-point */ typedef struct { - size_t size; /* size of datatype */ - int order; /* datatype endianness order */ - int precision; /* datatype precision */ - int offset; /* datatype offset */ + unsigned size; /* size of datatype */ + unsigned order; /* datatype endianness order */ + unsigned precision; /* datatype precision */ + unsigned offset; /* datatype offset */ } parms_atomic; /* Local function prototypes */ @@ -41,41 +41,50 @@ static herr_t H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id); static size_t H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); -static void H5Z_calc_parms_nooptype(void); -static void H5Z_calc_parms_atomic(void); -static herr_t H5Z_calc_parms_array(const H5T_t *type); -static herr_t H5Z_calc_parms_compound(const H5T_t *type); - -static herr_t H5Z_set_parms_nooptype(const H5T_t *type, unsigned cd_values[]); -static herr_t H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]); -static herr_t H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]); -static herr_t H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]); - -static void H5Z_nbit_next_byte(size_t *j, int *buf_len); -static void H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i, -int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int datatype_len); -static void H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i, -int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int datatype_len); +static void H5Z_calc_parms_nooptype(size_t *cd_values_actual_nparms); +static void H5Z_calc_parms_atomic(size_t *cd_values_actual_nparms); +static herr_t H5Z_calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms); +static herr_t H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms); + +static herr_t H5Z_set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, + unsigned cd_values[]); +static herr_t H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, + unsigned cd_values[], hbool_t *need_not_compress); +static herr_t H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, + unsigned cd_values[], hbool_t *need_not_compress); +static herr_t H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, + unsigned cd_values[], hbool_t *need_not_compress); + +static void H5Z_nbit_next_byte(size_t *j, size_t *buf_len); +static void H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, + unsigned k, unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, + size_t *buf_len, const parms_atomic *p, size_t datatype_len); +static void H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, + unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len); static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, unsigned size); + unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size); static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p); + unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p); static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]); + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index); static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]); + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index); static void H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, - const unsigned parms[]); + const unsigned parms[]); static void H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, unsigned size); + unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size); static void H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p); + unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p); static void H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]); + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index); static void H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]); + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index); static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, - size_t *buffer_size, const unsigned parms[]); + size_t *buffer_size, const unsigned parms[]); /* This message derives from H5Z */ H5Z_class2_t H5Z_NBIT[1] = {{ @@ -99,16 +108,6 @@ H5Z_class2_t H5Z_NBIT[1] = {{ #define H5Z_NBIT_ORDER_BE 1 /* Big endian for datatype byte order */ /* Local variables */ -/* - * cd_values_index: index of array cd_values inside function H5Z_set_local_nbit - * cd_values_actual_nparms: number of parameters in array cd_values[] - * need_not_compress: flag if TRUE indicating no need to do nbit compression - * parms_index: index of array parms used by compression/decompression functions - */ -static unsigned cd_values_index = 0; -static size_t cd_values_actual_nparms = 0; -static unsigned char need_not_compress = FALSE; -static unsigned parms_index = 0; /*------------------------------------------------------------------------- @@ -166,13 +165,14 @@ done: * *------------------------------------------------------------------------- */ -static void H5Z_calc_parms_nooptype(void) +static void +H5Z_calc_parms_nooptype(size_t *cd_values_actual_nparms) { /* Store datatype class code */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Store datatype size */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; } @@ -190,22 +190,23 @@ static void H5Z_calc_parms_nooptype(void) * *------------------------------------------------------------------------- */ -static void H5Z_calc_parms_atomic(void) +static void +H5Z_calc_parms_atomic(size_t *cd_values_actual_nparms) { /* Store datatype class code */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Store datatype size */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Store datatype endianness */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Store datatype's precision */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Store datatype's offset */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; } @@ -227,7 +228,7 @@ static void H5Z_calc_parms_atomic(void) *------------------------------------------------------------------------- */ static herr_t -H5Z_calc_parms_array(const H5T_t *type) +H5Z_calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) { H5T_t *dtype_base = NULL; /* Array datatype's base datatype */ H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */ @@ -236,10 +237,10 @@ H5Z_calc_parms_array(const H5T_t *type) FUNC_ENTER_NOAPI_NOINIT /* Store datatype class code */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Store array datatype's size */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Get array datatype's base datatype */ if(NULL == (dtype_base = H5T_get_super(type))) @@ -253,16 +254,16 @@ H5Z_calc_parms_array(const H5T_t *type) switch(dtype_base_class) { case H5T_INTEGER: case H5T_FLOAT: - H5Z_calc_parms_atomic(); + H5Z_calc_parms_atomic(cd_values_actual_nparms); break; case H5T_ARRAY: - if(H5Z_calc_parms_array(dtype_base) == FAIL) + if(H5Z_calc_parms_array(dtype_base, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_calc_parms_compound(dtype_base) == FAIL) + if(H5Z_calc_parms_compound(dtype_base, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; @@ -274,7 +275,7 @@ H5Z_calc_parms_array(const H5T_t *type) case H5T_ENUM: case H5T_VLEN: /* Other datatype classes: nbit does no compression */ - H5Z_calc_parms_nooptype(); + H5Z_calc_parms_nooptype(cd_values_actual_nparms); break; case H5T_NO_CLASS: @@ -312,31 +313,32 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_calc_parms_compound(const H5T_t *type) +H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) { int nmembers; /* Compound datatype's number of members */ H5T_t *dtype_member = NULL; /* Compound datatype's member datatype */ - H5T_class_t dtype_member_class; /* Compound datatype's member datatype's class */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Store compound datatype class code */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Store compound datatype's size */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Get number of members */ if((nmembers = H5T_get_nmembers(type)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members") /* Store number of members */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* For each member, calculate parameters */ for(u = 0; u < (unsigned)nmembers; u++) { + H5T_class_t dtype_member_class; /* Compound datatype's member datatype's class */ + /* Get member datatype */ if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype") @@ -346,22 +348,22 @@ H5Z_calc_parms_compound(const H5T_t *type) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype class") /* Store member offset */ - ++cd_values_actual_nparms; + *cd_values_actual_nparms += 1; /* Calculate parameters according to member's datatype class */ switch(dtype_member_class) { case H5T_INTEGER: case H5T_FLOAT: - H5Z_calc_parms_atomic(); + H5Z_calc_parms_atomic(cd_values_actual_nparms); break; case H5T_ARRAY: - if(H5Z_calc_parms_array(dtype_member) == FAIL) + if(H5Z_calc_parms_array(dtype_member, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_calc_parms_compound(dtype_member) == FAIL) + if(H5Z_calc_parms_compound(dtype_member, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; @@ -373,7 +375,7 @@ H5Z_calc_parms_compound(const H5T_t *type) case H5T_ENUM: case H5T_VLEN: /* Other datatype classes: nbit does no compression */ - H5Z_calc_parms_nooptype(); + H5Z_calc_parms_nooptype(cd_values_actual_nparms); break; case H5T_NO_CLASS: @@ -418,7 +420,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_nooptype(const H5T_t *type, unsigned cd_values[]) +H5Z_set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[]) { size_t dtype_size; /* No-op datatype's size (in bytes) */ herr_t ret_value = SUCCEED; /* Return value */ @@ -426,14 +428,15 @@ H5Z_set_parms_nooptype(const H5T_t *type, unsigned cd_values[]) FUNC_ENTER_NOAPI_NOINIT /* Set datatype class code */ - cd_values[cd_values_index++] = H5Z_NBIT_NOOPTYPE; + cd_values[(*cd_values_index)++] = H5Z_NBIT_NOOPTYPE; /* Get datatype's size */ if((dtype_size = H5T_get_size(type)) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for datatype size */ - cd_values[cd_values_index++] = dtype_size; + H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); + cd_values[(*cd_values_index)++] = (unsigned)dtype_size; done: FUNC_LEAVE_NOAPI(ret_value) @@ -457,25 +460,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]) +H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, + unsigned cd_values[], hbool_t *need_not_compress) { H5T_order_t dtype_order; /* Atomic datatype's endianness order */ size_t dtype_size; /* Atomic datatype's size (in bytes) */ size_t dtype_precision; /* Atomic datatype's precision (in bits) */ - int dtype_offset; /* Atomic datatype's offset (in bits) */ + int sdtype_offset; /* Atomic datatype's offset (in bits) */ + unsigned dtype_offset; /* Atomic datatype's offset (in bits) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Set datatype class code */ - cd_values[cd_values_index++] = H5Z_NBIT_ATOMIC; + cd_values[(*cd_values_index)++] = H5Z_NBIT_ATOMIC; /* Get datatype's size */ if((dtype_size = H5T_get_size(type)) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for datatype size */ - cd_values[cd_values_index++] = dtype_size; + H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); + cd_values[(*cd_values_index)++] = (unsigned)dtype_size; /* Get datatype's endianness order */ if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR) @@ -484,11 +490,11 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]) /* Set "local" parameter for datatype endianness */ switch(dtype_order) { case H5T_ORDER_LE: /* Little-endian byte order */ - cd_values[cd_values_index++] = H5Z_NBIT_ORDER_LE; + cd_values[(*cd_values_index)++] = H5Z_NBIT_ORDER_LE; break; case H5T_ORDER_BE: /* Big-endian byte order */ - cd_values[cd_values_index++] = H5Z_NBIT_ORDER_BE; + cd_values[(*cd_values_index)++] = H5Z_NBIT_ORDER_BE; break; case H5T_ORDER_VAX: @@ -504,27 +510,28 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision") /* Get datatype's offset */ - if((dtype_offset = H5T_get_offset(type)) < 0) + if((sdtype_offset = H5T_get_offset(type)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype offset") + dtype_offset = (unsigned)sdtype_offset; /* Check values of precision and offset */ - if(dtype_precision > dtype_size * 8 || (dtype_precision + dtype_offset) > dtype_size * 8 - || dtype_precision <= 0 || dtype_offset < 0) + if(dtype_precision > dtype_size * 8 || (dtype_precision + dtype_offset) > dtype_size * 8) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") /* Set "local" parameter for datatype precision */ - cd_values[cd_values_index++] = dtype_precision; + H5_CHECK_OVERFLOW(dtype_precision, size_t, unsigned); + cd_values[(*cd_values_index)++] = (unsigned)dtype_precision; /* Set "local" parameter for datatype offset */ - cd_values[cd_values_index++] = dtype_offset; + cd_values[(*cd_values_index)++] = dtype_offset; /* If before this point, there is no need to compress, check the need to * compress at this point. If current datatype is not full-precision, * flag need_not_compress should be set to FALSE. */ - if(need_not_compress) /* so far no need to compress */ + if(*need_not_compress) /* so far no need to compress */ if(dtype_offset != 0 || dtype_precision != dtype_size * 8) - need_not_compress = FALSE; + *need_not_compress = FALSE; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_set_parms_atomic() */ @@ -547,7 +554,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) +H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, + unsigned cd_values[], hbool_t *need_not_compress) { H5T_t *dtype_base = NULL; /* Array datatype's base datatype */ H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */ @@ -558,14 +566,15 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) FUNC_ENTER_NOAPI_NOINIT /* Set datatype class code */ - cd_values[cd_values_index++] = H5Z_NBIT_ARRAY; + cd_values[(*cd_values_index)++] = H5Z_NBIT_ARRAY; /* Get array datatype's size */ if((dtype_size = H5T_get_size(type)) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for array datatype's size */ - cd_values[cd_values_index++]=dtype_size; + H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); + cd_values[(*cd_values_index)++] = (unsigned)dtype_size; /* Get array datatype's base datatype */ if(NULL == (dtype_base = H5T_get_super(type))) @@ -579,17 +588,17 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) switch(dtype_base_class) { case H5T_INTEGER: case H5T_FLOAT: - if(H5Z_set_parms_atomic(dtype_base, cd_values) == FAIL) + if(H5Z_set_parms_atomic(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_ARRAY: - if(H5Z_set_parms_array(dtype_base, cd_values) == FAIL) + if(H5Z_set_parms_array(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_set_parms_compound(dtype_base, cd_values) == FAIL) + if(H5Z_set_parms_compound(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -602,7 +611,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) if(dtype_base_class == H5T_VLEN || is_vlstring) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype not supported by nbit") - if(H5Z_set_parms_nooptype(dtype_base, cd_values) == FAIL) + if(H5Z_set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -612,7 +621,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) case H5T_OPAQUE: case H5T_REFERENCE: case H5T_ENUM: - if(H5Z_set_parms_nooptype(dtype_base, cd_values) == FAIL) + if(H5Z_set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -650,9 +659,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) +H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, + unsigned cd_values[], hbool_t *need_not_compress) { - int nmembers; /* Compound datatype's number of members */ + int snmembers; /* Compound datatype's number of members */ + unsigned nmembers; /* Compound datatype's number of members */ H5T_t *dtype_member = NULL; /* Compound datatype's member datatype */ H5T_class_t dtype_member_class; /* Compound datatype's member datatype's class */ size_t dtype_member_offset; /* Compound datatype's current member datatype's offset (in bytes) */ @@ -665,24 +676,26 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) FUNC_ENTER_NOAPI_NOINIT /* Set "local" parameter for compound datatype class code */ - cd_values[cd_values_index++] = H5Z_NBIT_COMPOUND; + cd_values[(*cd_values_index)++] = H5Z_NBIT_COMPOUND; /* Get datatype's size */ if((dtype_size = H5T_get_size(type)) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for compound datatype size */ - cd_values[cd_values_index++] = dtype_size; + H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); + cd_values[(*cd_values_index)++] = (unsigned)dtype_size; /* Get number of members */ - if((nmembers = H5T_get_nmembers(type)) < 0) + if((snmembers = H5T_get_nmembers(type)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members") + nmembers = (unsigned)snmembers; /* Set "local" parameter for number of members */ - cd_values[cd_values_index++] = nmembers; + cd_values[(*cd_values_index)++] = nmembers; /* For each member, set parameters */ - for(u = 0; u < (unsigned)nmembers; u++) { + for(u = 0; u < nmembers; u++) { /* Get member datatype */ if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype") @@ -695,23 +708,24 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) dtype_member_offset = H5T_get_member_offset(type, u); /* Set "local" parameter for member offset */ - cd_values[cd_values_index++] = dtype_member_offset; + H5_CHECK_OVERFLOW(dtype_member_offset, size_t, unsigned); + cd_values[(*cd_values_index)++] = (unsigned)dtype_member_offset; /* Call appropriate function according to member's datatype class */ switch(dtype_member_class) { case H5T_INTEGER: case H5T_FLOAT: - if(H5Z_set_parms_atomic(dtype_member, cd_values) == FAIL) + if(H5Z_set_parms_atomic(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_ARRAY: - if(H5Z_set_parms_array(dtype_member, cd_values) == FAIL) + if(H5Z_set_parms_array(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_set_parms_compound(dtype_member, cd_values) == FAIL) + if(H5Z_set_parms_compound(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -721,22 +735,24 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot determine if datatype is a variable-length string") /* Because for some no-op datatype (VL datatype and VL string datatype), its - * size can not be retrieved correctly by using function call H5T_get_size, - * special handling is needed for getting the size. Here the difference between + * size can not be retrieved correctly by using function call H5T_get_size, + * special handling is needed for getting the size. Here the difference between * adjacent member offset is used (if alignment is present, the result can be - * larger, but it does not affect the nbit filter's correctness). + * larger, but it does not affect the nbit filter's correctness). */ if(dtype_member_class == H5T_VLEN || is_vlstring) { /* Set datatype class code */ - cd_values[cd_values_index++] = H5Z_NBIT_NOOPTYPE; + cd_values[(*cd_values_index)++] = H5Z_NBIT_NOOPTYPE; - if(u != (unsigned)nmembers - 1) + if(u != nmembers - 1) dtype_next_member_offset = H5T_get_member_offset(type, u + 1); else /* current member is the last member */ dtype_next_member_offset = dtype_size; /* Set "local" parameter for datatype size */ - cd_values[cd_values_index++] = dtype_next_member_offset - dtype_member_offset; + H5_CHECK_OVERFLOW(dtype_member_offset, size_t, unsigned); + H5_CHECK_OVERFLOW(dtype_next_member_offset, size_t, unsigned); + cd_values[(*cd_values_index)++] = (unsigned)dtype_next_member_offset - (unsigned)dtype_member_offset; } break; @@ -747,7 +763,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) case H5T_REFERENCE: case H5T_ENUM: /* other datatype that nbit does no compression */ - if(H5Z_set_parms_nooptype(dtype_member, cd_values) == FAIL) + if(H5Z_set_parms_nooptype(dtype_member, cd_values_index, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -796,10 +812,13 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) const H5T_t *type; /* Datatype */ const H5S_t *ds; /* Dataspace */ unsigned flags; /* Filter flags */ + unsigned cd_values_index; /* Index of array cd_values */ + size_t cd_values_actual_nparms; /* Number of parameters in array cd_values[] */ size_t cd_nelmts = H5Z_NBIT_USER_NPARMS; /* Number of filter parameters */ unsigned *cd_values = NULL; /* Filter parameters */ hssize_t npoints; /* Number of points in the dataspace */ H5T_class_t dtype_class; /* Datatype's class */ + hbool_t need_not_compress; /* Flag if TRUE indicating no need to do nbit compression */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -822,16 +841,16 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) switch(dtype_class) { case H5T_INTEGER: case H5T_FLOAT: - H5Z_calc_parms_atomic(); + H5Z_calc_parms_atomic(&cd_values_actual_nparms); break; case H5T_ARRAY: - if(H5Z_calc_parms_array(type) == FAIL) + if(H5Z_calc_parms_array(type, &cd_values_actual_nparms) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_calc_parms_compound(type) == FAIL) + if(H5Z_calc_parms_compound(type, &cd_values_actual_nparms) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; @@ -882,7 +901,8 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) cd_values_index = 2; /* Set "local" parameter for number of elements in the chunk */ - H5_CHECKED_ASSIGN(cd_values[cd_values_index++], unsigned, npoints, hssize_t); + H5_CHECK_OVERFLOW(npoints, hssize_t, unsigned); + cd_values[cd_values_index++] = (unsigned)npoints; /* Assume no need to compress now, will be changed to FALSE later if not */ need_not_compress = TRUE; @@ -891,17 +911,17 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) switch(dtype_class) { case H5T_INTEGER: case H5T_FLOAT: - if(H5Z_set_parms_atomic(type, cd_values) < 0) + if(H5Z_set_parms_atomic(type, &cd_values_index, cd_values, &need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_ARRAY: - if(H5Z_set_parms_array(type, cd_values) < 0) + if(H5Z_set_parms_array(type, &cd_values_index, cd_values, &need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_set_parms_compound(type, cd_values) < 0) + if(H5Z_set_parms_compound(type, &cd_values_index, cd_values, &need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -927,8 +947,9 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) HDassert(cd_values_actual_nparms == cd_values_index); /* Finally set the first two entries of cd_values[] */ - cd_values[0] = cd_values_actual_nparms; - cd_values[1] = need_not_compress; + H5_CHECK_OVERFLOW(cd_values_actual_nparms, size_t, unsigned); + cd_values[0] = (unsigned)cd_values_actual_nparms; + cd_values[1] = (unsigned)need_not_compress; /* Modify the filter's parameters for this dataset */ if(H5P_modify_filter(dcpl_plist, H5Z_FILTER_NBIT, flags, cd_values_actual_nparms, cd_values) < 0) @@ -957,7 +978,7 @@ done: */ static size_t H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], - size_t nbytes, size_t *buf_size, void **buf) + size_t nbytes, size_t *buf_size, void **buf) { unsigned char *outbuf; /* pointer to new output buffer */ size_t size_out = 0; /* size of output buffer */ @@ -1027,63 +1048,64 @@ done: */ static void -H5Z_nbit_next_byte(size_t *j, int *buf_len) +H5Z_nbit_next_byte(size_t *j, size_t *buf_len) { ++(*j); *buf_len = 8 * sizeof(unsigned char); } static void -H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, - int begin_i, int end_i, unsigned char *buffer, size_t *j, int *buf_len, - parms_atomic p, int datatype_len) +H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, + unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, + const parms_atomic *p, size_t datatype_len) { - int dat_len; /* dat_len is the number of bits to be copied in each data byte */ - int uchar_offset; + size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */ + size_t dat_offset; unsigned char val; /* value to be copied in each data byte */ /* initialize value and bits of unsigned char to be copied */ val = buffer[*j]; - uchar_offset = 0; + dat_offset = 0; if(begin_i != end_i) { /* significant bits occupy >1 unsigned char */ if(k == begin_i) - dat_len = 8 - (datatype_len - p.precision - p.offset) % 8; + dat_len = 8 - (datatype_len - p->precision - p->offset) % 8; else if(k == end_i) { - dat_len = 8 - p.offset %8; - uchar_offset = 8 - dat_len; + dat_len = 8 - p->offset % 8; + dat_offset = 8 - dat_len; } else dat_len = 8; } else { /* all significant bits in one unsigned char */ - uchar_offset = p.offset % 8; - dat_len = p.precision; + dat_offset = p->offset % 8; + dat_len = p->precision; } if(*buf_len > dat_len) { - data[data_offset + k] = - ((val >> (*buf_len - dat_len)) & ~(~0 << dat_len)) << uchar_offset; + data[data_offset + k] = (unsigned char)( + ((unsigned)(val >> (*buf_len - dat_len)) & (unsigned)(~((unsigned)(~0) << dat_len))) << dat_offset); *buf_len -= dat_len; } else { - data[data_offset + k] = - ((val & ~(~0 << *buf_len)) << (dat_len - *buf_len)) << uchar_offset; + data[data_offset + k] = (unsigned char)( + ((val & ~((unsigned)(~0) << *buf_len)) << (dat_len - *buf_len)) << dat_offset); dat_len -= *buf_len; H5Z_nbit_next_byte(j, buf_len); - if(dat_len == 0) return; + if(dat_len == 0) + return; val = buffer[*j]; - data[data_offset + k] |= - ((val >> (*buf_len - dat_len)) & ~(~0 << dat_len)) << uchar_offset; + data[data_offset + k] |= (unsigned char)( + ((unsigned)(val >> (*buf_len - dat_len)) & (unsigned)(~((unsigned)(~0) << dat_len))) << dat_offset); *buf_len -= dat_len; } } static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, unsigned size) + unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size) { unsigned i; /* index */ - unsigned dat_len; /* dat_len is the number of bits to be copied in each data byte */ + size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */ unsigned char val; /* value to be copied in each data byte */ for(i = 0; i < size; i++) { @@ -1091,99 +1113,109 @@ H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, val = buffer[*j]; dat_len = sizeof(unsigned char) * 8; - data[data_offset + i] = ((val & ~(~0 << *buf_len)) << (dat_len - *buf_len)); + data[data_offset + i] = (unsigned char)(((val & ~((unsigned)(~0) << *buf_len)) << (dat_len - *buf_len))); dat_len -= *buf_len; H5Z_nbit_next_byte(j, buf_len); - if(dat_len == 0) continue; + if(dat_len == 0) + continue; val = buffer[*j]; - data[data_offset + i] |= ((val >> (*buf_len - dat_len)) & ~(~0 << dat_len)); + data[data_offset + i] |= (unsigned char)((unsigned)(val >> (*buf_len - dat_len)) & (unsigned)(~((unsigned)(~0) << dat_len))); *buf_len -= dat_len; } } static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p) + unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p) { - /* begin_i: the index of byte having first significant bit - end_i: the index of byte having last significant bit */ - int k, begin_i, end_i, datatype_len; - - datatype_len = p.size * 8; - - if(p.order == H5Z_NBIT_ORDER_LE) { /* little endian */ - /* calculate begin_i and end_i */ - if((p.precision + p.offset) % 8 != 0) - begin_i = (p.precision + p.offset) / 8; - else - begin_i = (p.precision + p.offset) / 8 - 1; - end_i = p.offset / 8; - - for(k = begin_i; k >= end_i; k--) - H5Z_nbit_decompress_one_byte(data, data_offset, k, begin_i, end_i, - buffer, j, buf_len, p, datatype_len); - } - - if(p.order == H5Z_NBIT_ORDER_BE) { /* big endian */ - /* calculate begin_i and end_i */ - begin_i = (datatype_len - p.precision - p.offset) / 8; - if(p.offset % 8 != 0) - end_i = (datatype_len - p.offset) / 8; - else - end_i = (datatype_len - p.offset) / 8 - 1; - - for(k = begin_i; k <= end_i; k++) - H5Z_nbit_decompress_one_byte(data, data_offset, k, begin_i, end_i, - buffer, j, buf_len, p, datatype_len); - } + /* begin_i: the index of byte having first significant bit + end_i: the index of byte having last significant bit */ + int k; + unsigned begin_i, end_i; + size_t datatype_len; + + datatype_len = p->size * 8; + + if(p->order == H5Z_NBIT_ORDER_LE) { /* little endian */ + /* calculate begin_i and end_i */ + if((p->precision + p->offset) % 8 != 0) + begin_i = (p->precision + p->offset) / 8; + else + begin_i = (p->precision + p->offset) / 8 - 1; + end_i = p->offset / 8; + + for(k = (int)begin_i; k >= (int)end_i; k--) + H5Z_nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + buffer, j, buf_len, p, datatype_len); + } + else { /* big endian */ + /* Sanity check */ + HDassert(p->order == H5Z_NBIT_ORDER_BE); + + /* calculate begin_i and end_i */ + begin_i = ((unsigned)datatype_len - p->precision - p->offset) / 8; + if(p->offset % 8 != 0) + end_i = ((unsigned)datatype_len - p->offset) / 8; + else + end_i = ((unsigned)datatype_len - p->offset) / 8 - 1; + + for(k = (int)begin_i; k <= (int)end_i; k++) + H5Z_nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + buffer, j, buf_len, p, datatype_len); + } } static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]) + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index) { unsigned i, total_size, base_class, base_size, n, begin_index; parms_atomic p; - total_size = parms[parms_index++]; - base_class = parms[parms_index++]; + total_size = parms[(*parms_index)++]; + base_class = parms[(*parms_index)++]; switch(base_class) { case H5Z_NBIT_ATOMIC: - p.size = parms[parms_index++]; - p.order = parms[parms_index++]; - p.precision = parms[parms_index++]; - p.offset = parms[parms_index++]; - n = total_size/p.size; + p.size = parms[(*parms_index)++]; + p.order = parms[(*parms_index)++]; + p.precision = parms[(*parms_index)++]; + p.offset = parms[(*parms_index)++]; + n = total_size / p.size; for(i = 0; i < n; i++) - H5Z_nbit_decompress_one_atomic(data, data_offset + i*p.size, - buffer, j, buf_len, p); + H5Z_nbit_decompress_one_atomic(data, data_offset + i * p.size, + buffer, j, buf_len, &p); break; + case H5Z_NBIT_ARRAY: - base_size = parms[parms_index]; /* read in advance */ - n = total_size/base_size; /* number of base_type elements inside the array datatype */ - begin_index = parms_index; + base_size = parms[*parms_index]; /* read in advance */ + n = total_size / base_size; /* number of base_type elements inside the array datatype */ + begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_decompress_one_array(data, data_offset + i*base_size, - buffer, j, buf_len, parms); - parms_index = begin_index; + H5Z_nbit_decompress_one_array(data, data_offset + i * base_size, + buffer, j, buf_len, parms, parms_index); + *parms_index = begin_index; } break; + case H5Z_NBIT_COMPOUND: - base_size = parms[parms_index]; /* read in advance */ - n = total_size/base_size; /* number of base_type elements inside the array datatype */ - begin_index = parms_index; + base_size = parms[*parms_index]; /* read in advance */ + n = total_size / base_size; /* number of base_type elements inside the array datatype */ + begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_decompress_one_compound(data, data_offset + i*base_size, - buffer, j, buf_len, parms); - parms_index = begin_index; + H5Z_nbit_decompress_one_compound(data, data_offset + i * base_size, + buffer, j, buf_len, parms, parms_index); + *parms_index = begin_index; } break; + case H5Z_NBIT_NOOPTYPE: - parms_index++; /* skip size of no-op type */ + (*parms_index)++; /* skip size of no-op type */ H5Z_nbit_decompress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ @@ -1191,39 +1223,44 @@ H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset, static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]) + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index) { unsigned i, nmembers, member_offset, member_class, size; parms_atomic p; - parms_index++; /* skip total size of compound datatype */ - nmembers = parms[parms_index++]; + (*parms_index)++; /* skip total size of compound datatype */ + nmembers = parms[(*parms_index)++]; for(i = 0; i < nmembers; i++) { - member_offset = parms[parms_index++]; - member_class = parms[parms_index++]; + member_offset = parms[(*parms_index)++]; + member_class = parms[(*parms_index)++]; switch(member_class) { case H5Z_NBIT_ATOMIC: - p.size = parms[parms_index++]; - p.order = parms[parms_index++]; - p.precision = parms[parms_index++]; - p.offset = parms[parms_index++]; + p.size = parms[(*parms_index)++]; + p.order = parms[(*parms_index)++]; + p.precision = parms[(*parms_index)++]; + p.offset = parms[(*parms_index)++]; H5Z_nbit_decompress_one_atomic(data, data_offset + member_offset, - buffer, j, buf_len, p); + buffer, j, buf_len, &p); break; + case H5Z_NBIT_ARRAY: H5Z_nbit_decompress_one_array(data, data_offset + member_offset, - buffer, j, buf_len, parms); + buffer, j, buf_len, parms, parms_index); break; + case H5Z_NBIT_COMPOUND: H5Z_nbit_decompress_one_compound(data, data_offset+member_offset, - buffer, j, buf_len, parms); + buffer, j, buf_len, parms, parms_index); break; + case H5Z_NBIT_NOOPTYPE: - size = parms[parms_index++]; + size = parms[(*parms_index)++]; H5Z_nbit_decompress_one_nooptype(data, data_offset+member_offset, buffer, j, buf_len, size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ @@ -1232,94 +1269,101 @@ H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset, static void H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, - const unsigned parms[]) + const unsigned parms[]) { - /* i: index of data, j: index of buffer, - buf_len: number of bits to be filled in current byte */ - size_t i, j, size; - int buf_len; - parms_atomic p; + /* i: index of data, j: index of buffer, + buf_len: number of bits to be filled in current byte */ + unsigned i; + size_t j, size; + size_t buf_len; + parms_atomic p; + unsigned parms_index; /* index in array parms used by compression/decompression functions */ + + /* may not have to initialize to zeros */ + HDmemset(data, 0, d_nelmts * parms[4]); + + /* initialization before the loop */ + j = 0; + buf_len = sizeof(unsigned char) * 8; + + switch(parms[3]) { + case H5Z_NBIT_ATOMIC: + p.size = parms[4]; + p.order = parms[5]; + p.precision = parms[6]; + p.offset = parms[7]; + for(i = 0; i < d_nelmts; i++) + H5Z_nbit_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, &p); + break; - /* may not have to initialize to zeros */ - for(i = 0; i < d_nelmts*parms[4]; i++) data[i] = 0; + case H5Z_NBIT_ARRAY: + size = parms[4]; + parms_index = 4; /* set the index before goto function call */ + for(i = 0; i < d_nelmts; i++) { + H5Z_nbit_decompress_one_array(data, i * size, buffer, &j, &buf_len, parms, &parms_index); + parms_index = 4; + } + break; - /* initialization before the loop */ - j = 0; - buf_len = sizeof(unsigned char) * 8; + case H5Z_NBIT_COMPOUND: + size = parms[4]; + parms_index = 4; /* set the index before goto function call */ + for(i = 0; i < d_nelmts; i++) { + H5Z_nbit_decompress_one_compound(data, i * size, buffer, &j, &buf_len, parms, &parms_index); + parms_index = 4; + } + break; - switch(parms[3]) { - case H5Z_NBIT_ATOMIC: - /* set the index before goto function call */ - p.size = parms[4]; - p.order = parms[5]; - p.precision = parms[6]; - p.offset = parms[7]; - for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_decompress_one_atomic(data, i*p.size, buffer, &j, &buf_len, p); - } - break; - case H5Z_NBIT_ARRAY: - size = parms[4]; - parms_index = 4; - for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_decompress_one_array(data, i*size, buffer, &j, &buf_len, parms); - parms_index = 4; - } - break; - case H5Z_NBIT_COMPOUND: - size = parms[4]; - parms_index = 4; - for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_decompress_one_compound(data, i*size, buffer, &j, &buf_len, parms); - parms_index = 4; - } - break; - default: - HDassert(0 && "This Should never be executed!"); - } /* end switch */ + default: + HDassert(0 && "This Should never be executed!"); + } /* end switch */ } -static void H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i, -int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int datatype_len) +static void +H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, + unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, + const parms_atomic *p, size_t datatype_len) { - int dat_len; /* dat_len is the number of bits to be copied in each data byte */ + size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */ unsigned char val; /* value to be copied in each data byte */ /* initialize value and bits of unsigned char to be copied */ val = data[data_offset + k]; if(begin_i != end_i) { /* significant bits occupy >1 unsigned char */ if(k == begin_i) - dat_len = 8 - (datatype_len - p.precision - p.offset) % 8; + dat_len = 8 - (datatype_len - p->precision - p->offset) % 8; else if(k == end_i) { - dat_len = 8 - p.offset % 8; - val >>= 8 - dat_len; + dat_len = 8 - p->offset % 8; + val = (unsigned char)(val >> (8 - dat_len)); } else dat_len = 8; } else { /* all significant bits in one unsigned char */ - val >>= p.offset % 8; - dat_len = p.precision; + val = (unsigned char)(val >> (p->offset % 8)); + dat_len = p->precision; } if(*buf_len > dat_len) { - buffer[*j] |= (val & ~(~0 << dat_len)) << (*buf_len - dat_len); + buffer[*j] |= (unsigned char)((val & ~((unsigned)(~0) << dat_len)) << (*buf_len - dat_len)); *buf_len -= dat_len; } else { - buffer[*j] |= (val >> (dat_len - *buf_len)) & ~(~0 << *buf_len); + buffer[*j] |= (unsigned char)((unsigned)(val >> (dat_len - *buf_len)) & ~((unsigned)(~0) << *buf_len)); dat_len -= *buf_len; H5Z_nbit_next_byte(j, buf_len); - if(dat_len == 0) return; + if(dat_len == 0) + return; - buffer[*j] = (val & ~(~0 << dat_len)) << (*buf_len - dat_len); + buffer[*j] = (unsigned char)((val & ~((unsigned)(~0) << dat_len)) << (*buf_len - dat_len)); *buf_len -= dat_len; } } -static void H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, unsigned size) +static void +H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, + unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size) { unsigned i; /* index */ - unsigned dat_len; /* dat_len is the number of bits to be copied in each data byte */ + size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */ unsigned char val; /* value to be copied in each data byte */ for(i = 0; i < size; i++) { @@ -1327,192 +1371,214 @@ static void H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offs val = data[data_offset + i]; dat_len = sizeof(unsigned char) * 8; - buffer[*j] |= (val >> (dat_len - *buf_len)) & ~(~0 << *buf_len); + buffer[*j] |= (unsigned char)((unsigned)(val >> (dat_len - *buf_len)) & ~((unsigned)(~0) << *buf_len)); dat_len -= *buf_len; H5Z_nbit_next_byte(j, buf_len); - if(dat_len == 0) continue; + if(dat_len == 0) + continue; - buffer[*j] = (val & ~(~0 << dat_len)) << (*buf_len - dat_len); + buffer[*j] = (unsigned char)((val & ~((unsigned)(~0) << dat_len)) << (*buf_len - dat_len)); *buf_len -= dat_len; } } -static void H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p) +static void +H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, + unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p) { - /* begin_i: the index of byte having first significant bit - end_i: the index of byte having last significant bit */ - int k, begin_i, end_i, datatype_len; - - datatype_len = p.size * 8; - - if(p.order == H5Z_NBIT_ORDER_LE) { /* little endian */ - /* calculate begin_i and end_i */ - if((p.precision + p.offset) % 8 != 0) - begin_i = (p.precision + p.offset) / 8; - else - begin_i = (p.precision + p.offset) / 8 - 1; - end_i = p.offset / 8; - - for(k = begin_i; k >= end_i; k--) - H5Z_nbit_compress_one_byte(data, data_offset, k, begin_i, end_i, - buffer, j, buf_len, p, datatype_len); - } - - if(p.order == H5Z_NBIT_ORDER_BE) { /* big endian */ - /* calculate begin_i and end_i */ - begin_i = (datatype_len - p.precision - p.offset) / 8; - if(p.offset % 8 != 0) - end_i = (datatype_len - p.offset) / 8; - else - end_i = (datatype_len - p.offset) / 8 - 1; - - for(k = begin_i; k <= end_i; k++) - H5Z_nbit_compress_one_byte(data, data_offset, k, begin_i, end_i, - buffer, j, buf_len, p, datatype_len); - } + /* begin_i: the index of byte having first significant bit + end_i: the index of byte having last significant bit */ + int k; + unsigned begin_i, end_i; + size_t datatype_len; + + datatype_len = p->size * 8; + + if(p->order == H5Z_NBIT_ORDER_LE) { /* little endian */ + /* calculate begin_i and end_i */ + if((p->precision + p->offset) % 8 != 0) + begin_i = (p->precision + p->offset) / 8; + else + begin_i = (p->precision + p->offset) / 8 - 1; + end_i = p->offset / 8; + + for(k = (int)begin_i; k >= (int)end_i; k--) + H5Z_nbit_compress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + buffer, j, buf_len, p, datatype_len); + } + else { /* big endian */ + /* Sanity check */ + HDassert(p->order == H5Z_NBIT_ORDER_BE); + + /* calculate begin_i and end_i */ + begin_i = ((unsigned)datatype_len - p->precision - p->offset) / 8; + if(p->offset % 8 != 0) + end_i = ((unsigned)datatype_len - p->offset) / 8; + else + end_i = ((unsigned)datatype_len - p->offset) / 8 - 1; + + for(k = (int)begin_i; k <= (int)end_i; k++) + H5Z_nbit_compress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + buffer, j, buf_len, p, datatype_len); + } } -static void H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, - size_t *j, int *buf_len, const unsigned parms[]) +static void +H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index) { unsigned i, total_size, base_class, base_size, n, begin_index; parms_atomic p; - total_size = parms[parms_index++]; - base_class = parms[parms_index++]; + total_size = parms[(*parms_index)++]; + base_class = parms[(*parms_index)++]; switch(base_class) { case H5Z_NBIT_ATOMIC: - p.size = parms[parms_index++]; - p.order = parms[parms_index++]; - p.precision = parms[parms_index++]; - p.offset = parms[parms_index++]; - n = total_size/p.size; + p.size = parms[(*parms_index)++]; + p.order = parms[(*parms_index)++]; + p.precision = parms[(*parms_index)++]; + p.offset = parms[(*parms_index)++]; + n = total_size / p.size; for(i = 0; i < n; i++) - H5Z_nbit_compress_one_atomic(data, data_offset + i*p.size, - buffer, j, buf_len, p); + H5Z_nbit_compress_one_atomic(data, data_offset + i * p.size, + buffer, j, buf_len, &p); break; + case H5Z_NBIT_ARRAY: - base_size = parms[parms_index]; /* read in advance */ - n = total_size/base_size; /* number of base_type elements inside the array datatype */ - begin_index = parms_index; + base_size = parms[*parms_index]; /* read in advance */ + n = total_size / base_size; /* number of base_type elements inside the array datatype */ + begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_compress_one_array(data, data_offset + i*base_size, - buffer, j, buf_len, parms); - parms_index = begin_index; + H5Z_nbit_compress_one_array(data, data_offset + i * base_size, + buffer, j, buf_len, parms, parms_index); + *parms_index = begin_index; } break; + case H5Z_NBIT_COMPOUND: - base_size = parms[parms_index]; /* read in advance */ - n = total_size/base_size; /* number of base_type elements inside the array datatype */ - begin_index = parms_index; + base_size = parms[*parms_index]; /* read in advance */ + n = total_size / base_size; /* number of base_type elements inside the array datatype */ + begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_compress_one_compound(data, data_offset + i*base_size, - buffer, j, buf_len, parms); - parms_index = begin_index; + H5Z_nbit_compress_one_compound(data, data_offset + i * base_size, + buffer, j, buf_len, parms, parms_index); + *parms_index = begin_index; } break; + case H5Z_NBIT_NOOPTYPE: - parms_index++; /* skip size of no-op type */ + (*parms_index)++; /* skip size of no-op type */ H5Z_nbit_compress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ } -static void H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[]) +static void +H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, + unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], + unsigned *parms_index) { unsigned i, nmembers, member_offset, member_class, size; parms_atomic p; - parms_index++; /* skip size of compound datatype */ - nmembers = parms[parms_index++]; + (*parms_index)++; /* skip size of compound datatype */ + nmembers = parms[(*parms_index)++]; for(i = 0; i < nmembers; i++) { - member_offset = parms[parms_index++]; - member_class = parms[parms_index++]; + member_offset = parms[(*parms_index)++]; + member_class = parms[(*parms_index)++]; switch(member_class) { case H5Z_NBIT_ATOMIC: - p.size = parms[parms_index++]; - p.order = parms[parms_index++]; - p.precision = parms[parms_index++]; - p.offset = parms[parms_index++]; + p.size = parms[(*parms_index)++]; + p.order = parms[(*parms_index)++]; + p.precision = parms[(*parms_index)++]; + p.offset = parms[(*parms_index)++]; H5Z_nbit_compress_one_atomic(data, data_offset + member_offset, - buffer, j, buf_len, p); + buffer, j, buf_len, &p); break; + case H5Z_NBIT_ARRAY: H5Z_nbit_compress_one_array(data, data_offset + member_offset, - buffer, j, buf_len, parms); + buffer, j, buf_len, parms, parms_index); break; + case H5Z_NBIT_COMPOUND: H5Z_nbit_compress_one_compound(data, data_offset+member_offset, - buffer, j, buf_len, parms); + buffer, j, buf_len, parms, parms_index); break; + case H5Z_NBIT_NOOPTYPE: - size = parms[parms_index++]; + size = parms[(*parms_index)++]; H5Z_nbit_compress_one_nooptype(data, data_offset+member_offset, buffer, j, buf_len, size); break; + default: HDassert(0 && "This Should never be executed!"); } /* end switch */ } } -static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, - size_t *buffer_size, const unsigned parms[]) +static void +H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, + size_t *buffer_size, const unsigned parms[]) { - /* i: index of data, new_size: index of buffer, - buf_len: number of bits to be filled in current byte */ - size_t i, size; - size_t new_size = 0; - int buf_len; - parms_atomic p; + /* i: index of data, new_size: index of buffer, + buf_len: number of bits to be filled in current byte */ + unsigned i; + size_t size; + size_t new_size = 0; + size_t buf_len; + parms_atomic p; + unsigned parms_index; /* index in array parms used by compression/decompression functions */ + + /* must initialize buffer to be zeros */ + HDmemset(buffer, 0, *buffer_size); + + /* initialization before the loop */ + buf_len = sizeof(unsigned char) * 8; + + switch(parms[3]) { + case H5Z_NBIT_ATOMIC: + p.size = parms[4]; + p.order = parms[5]; + p.precision = parms[6]; + p.offset = parms[7]; + + for(i = 0; i < d_nelmts; i++) + H5Z_nbit_compress_one_atomic(data, i * p.size, buffer, &new_size, &buf_len, &p); + break; - /* must initialize buffer to be zeros */ - HDmemset(buffer, 0, *buffer_size); + case H5Z_NBIT_ARRAY: + size = parms[4]; + parms_index = 4; + for(i = 0; i < d_nelmts; i++) { + H5Z_nbit_compress_one_array(data, i * size, buffer, &new_size, &buf_len, parms, &parms_index); + parms_index = 4; + } + break; - /* initialization before the loop */ - buf_len = sizeof(unsigned char) * 8; + case H5Z_NBIT_COMPOUND: + size = parms[4]; + parms_index = 4; + for(i = 0; i < d_nelmts; i++) { + H5Z_nbit_compress_one_compound(data, i * size, buffer, &new_size, &buf_len, parms, &parms_index); + parms_index = 4; + } + break; - switch(parms[3]) { - case H5Z_NBIT_ATOMIC: - /* set the index before goto function call */ - p.size = parms[4]; - p.order = parms[5]; - p.precision = parms[6]; - p.offset = parms[7]; - - for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_atomic(data, i*p.size, buffer, &new_size, &buf_len, p); - } - break; - case H5Z_NBIT_ARRAY: - size = parms[4]; - parms_index = 4; - for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_array(data, i*size, buffer, &new_size, &buf_len, parms); - parms_index = 4; - } - break; - case H5Z_NBIT_COMPOUND: - size = parms[4]; - parms_index = 4; - for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_compound(data, i*size, buffer, &new_size, &buf_len, parms); - parms_index = 4; - } - break; - default: - HDassert(0 && "This Should never be executed!"); - } /* end switch */ + default: + HDassert(0 && "This Should never be executed!"); + } /* end switch */ - /* Update the size to the new value after compression. If there are any bits hanging over in - * the last byte, increment the value by 1. */ - *buffer_size = new_size + 1; + /* Update the size to the new value after compression. If there are any bits hanging over in + * the last byte, increment the value by 1. */ + *buffer_size = new_size + 1; } diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 7c9dbf9..1cca9b1 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -28,7 +28,7 @@ /* Struct of parameters needed for compressing/decompressing one atomic datatype */ typedef struct { - size_t size; /* datatype size */ + unsigned size; /* datatype size */ uint32_t minbits; /* minimum bits to compress one value of such datatype */ unsigned mem_order; /* current memory endianness order */ } parms_atomic; @@ -38,7 +38,6 @@ enum H5Z_scaleoffset_t {t_bad=0, t_uchar=1, t_ushort, t_uint, t_ulong, t_ulong_l t_float, t_double}; /* Local function prototypes */ -static double H5Z_scaleoffset_rnd(double val); static htri_t H5Z_can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id); static enum H5Z_scaleoffset_t H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dtype_sign); @@ -48,7 +47,7 @@ static herr_t H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id); static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); -static void H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, size_t dtype_size); +static void H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size); static H5_ATTR_CONST unsigned H5Z_scaleoffset_log2(unsigned long long num); static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], @@ -389,25 +388,28 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Check and handle special situation for floating-point type */ -#define H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ +#define H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \ { \ - if(sizeof(type)==sizeof(int)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ - > HDpow(2.0f, (double)(sizeof(int)*8 - 1))) { \ - *minbits = sizeof(int)*8; goto done; \ - } \ - } else if(sizeof(type)==sizeof(long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ - > HDpow(2.0f, (double)(sizeof(long)*8 - 1))) { \ - *minbits = sizeof(long)*8; goto done; \ - } \ - } else if(sizeof(type)==sizeof(long long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ - > HDpow(2.0f, (double)(sizeof(long long)*8 - 1))) { \ - *minbits = sizeof(long long)*8; goto done; \ - } \ - } else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ + if(sizeof(type) == sizeof(int)) { \ + if(round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) \ + > pow_fun(2.0f, (type)(sizeof(int) * 8 - 1))) { \ + *minbits = sizeof(int) * 8; \ + goto done; \ + } \ + } else if(sizeof(type) == sizeof(long)) { \ + if(round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) \ + > pow_fun(2.0f, (type)(sizeof(long) * 8 - 1))) { \ + *minbits = sizeof(long) * 8; \ + goto done; \ + } \ + } else if(sizeof(type) == sizeof(long long)) { \ + if(round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) \ + > pow_fun(2.0f, (type)(sizeof(long long) * 8 - 1))) { \ + *minbits = sizeof(long long) * 8; \ + goto done; \ + } \ + } else \ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } /* Precompress for unsigned integer type */ @@ -477,53 +479,47 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Modify values of data in precompression if fill value defined for floating-point type */ -#define H5Z_scaleoffset_modify_1(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ +#define H5Z_scaleoffset_modify_1(i, type, pow_fun, abs_fun, lround_fun, llround_fun, buf, d_nelmts, filval, minbits, min, D_val) \ { \ - if(sizeof(type)==sizeof(int)) \ + if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ + if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ *(int *)&buf[i] = (int)(((unsigned int)1 << *minbits) - 1); \ else \ - *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ + *(int *)&buf[i] = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ - else if(sizeof(type)==sizeof(long)) \ + else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ + if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ *(long *)&buf[i] = (long)(((unsigned long)1 << *minbits) - 1); \ else \ - *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ + *(long *)&buf[i] = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ - else if(sizeof(type)==sizeof(long long)) \ + else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ + if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ *(long long *)&buf[i] = (long long)(((unsigned long long)1 << *minbits) - 1); \ else \ - *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ + *(long long *)&buf[i] = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } /* Modify values of data in precompression if fill value undefined for floating-point type */ -#define H5Z_scaleoffset_modify_2(i, type, buf, d_nelmts, min, D_val) \ +#define H5Z_scaleoffset_modify_2(i, type, pow_fun, lround_fun, llround_fun, buf, d_nelmts, min, D_val) \ { \ - if(sizeof(type)==sizeof(int)) \ + if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ - else if(sizeof(type)==sizeof(long)) \ + *(int *)&buf[i] = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ - else if(sizeof(type)==sizeof(long long)) \ + *(long *)&buf[i] = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ + *(long long *)&buf[i] = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } /* Save the minimum value for floating-point type */ @@ -546,7 +542,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Precompress for floating-point type using variable-minimum-bits method */ -#define H5Z_scaleoffset_precompress_3(type, data, d_nelmts, filavail, cd_values, \ +#define H5Z_scaleoffset_precompress_3(type, pow_fun, abs_fun, round_fun, lround_fun, llround_fun, data, d_nelmts, filavail, cd_values, \ minbits, minval, D_val) \ { \ type *buf = (type *)data, min = 0, max = 0, filval = 0; \ @@ -557,18 +553,18 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ - H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long long)(span + 1)); \ + H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \ + span = (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) + 1); \ + *minbits = H5Z_scaleoffset_log2(span + 1); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - H5Z_scaleoffset_modify_1(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ + H5Z_scaleoffset_modify_1(i, type, pow_fun, abs_fun, lround_fun, llround_fun, buf, d_nelmts, filval, minbits, min, D_val) \ } else { /* fill value undefined */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ - H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ + H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \ + span = (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) + 1); \ + *minbits = H5Z_scaleoffset_log2(span); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - H5Z_scaleoffset_modify_2(i, type, buf, d_nelmts, min, D_val) \ + H5Z_scaleoffset_modify_2(i, type, pow_fun, lround_fun, llround_fun, buf, d_nelmts, min, D_val) \ } \ H5Z_scaleoffset_save_min(i, type, minval, min) \ } @@ -621,42 +617,42 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* Modify values of data in postdecompression if fill value defined for floating-point type */ -#define H5Z_scaleoffset_modify_3(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ +#define H5Z_scaleoffset_modify_3(i, type, pow_fun, buf, d_nelmts, filval, minbits, min, D_val) \ { \ - if(sizeof(type)==sizeof(int)) \ + if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(int *)&buf[i] == (int)(((unsigned int)1 << minbits) - 1)) ? \ - filval : (double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ - else if(sizeof(type)==sizeof(long)) \ + filval : (type)(*(int *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long *)&buf[i] == (long)(((unsigned long)1 << minbits) - 1)) ? \ - filval : (double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ - else if(sizeof(type)==sizeof(long long)) \ + filval : (type)(*(long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long long *)&buf[i] == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ - filval : (double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ + filval : (type)(*(long long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } /* Modify values of data in postdecompression if fill value undefined for floating-point type */ -#define H5Z_scaleoffset_modify_4(i, type, buf, d_nelmts, min, D_val) \ +#define H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ + buf[i] = ((type)(*(int *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ + buf[i] = ((type)(*(long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ + buf[i] = ((type)(*(long long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } /* Postdecompress for floating-point type using variable-minimum-bits method */ -#define H5Z_scaleoffset_postdecompress_3(type, data, d_nelmts, filavail, cd_values, \ +#define H5Z_scaleoffset_postdecompress_3(type, pow_fun, data, d_nelmts, filavail, cd_values, \ minbits, minval, D_val) \ { \ type *buf = (type *)data, filval = 0, min = 0; \ @@ -666,9 +662,9 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ - H5Z_scaleoffset_modify_3(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ + H5Z_scaleoffset_modify_3(i, type, pow_fun, buf, d_nelmts, filval, minbits, min, D_val) \ } else /* fill value undefined */ \ - H5Z_scaleoffset_modify_4(i, type, buf, d_nelmts, min, D_val) \ + H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \ } @@ -756,7 +752,9 @@ H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dty else if(dtype_size == sizeof(unsigned short)) type = t_ushort; else if(dtype_size == sizeof(unsigned int)) type = t_uint; else if(dtype_size == sizeof(unsigned long)) type = t_ulong; +#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG else if(dtype_size == sizeof(unsigned long long)) type = t_ulong_long; +#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype") } @@ -766,7 +764,9 @@ H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dty else if(dtype_size == sizeof(short)) type = t_short; else if(dtype_size == sizeof(int)) type = t_int; else if(dtype_size == sizeof(long)) type = t_long; +#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG else if(dtype_size == sizeof(long long)) type = t_long_long; +#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype") } @@ -935,7 +935,8 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for datatype size */ - cd_values[H5Z_SCALEOFFSET_PARM_SIZE] = dtype_size; + H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); + cd_values[H5Z_SCALEOFFSET_PARM_SIZE] = (unsigned)dtype_size; if(dtype_class == H5T_INTEGER) { /* Get datatype's sign */ @@ -1196,7 +1197,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value } /* before postprocess, get memory type */ - if((type = H5Z_scaleoffset_get_type(dtype_class, (unsigned)p.size, dtype_sign)) == 0) + if((type = H5Z_scaleoffset_get_type(dtype_class, p.size, dtype_sign)) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") /* postprocess after decompression */ @@ -1224,7 +1225,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value H5Z_scaleoffset_convert(*buf, d_nelmts, p.size); /* before preprocess, get memory type */ - if((type = H5Z_scaleoffset_get_type(dtype_class, (unsigned)p.size, dtype_sign))==0) + if((type = H5Z_scaleoffset_get_type(dtype_class, p.size, dtype_sign))==0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") /* preprocess before compression */ @@ -1316,10 +1317,10 @@ done: * or from big-endian to little-endian 2/21/2005 */ static void -H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, size_t dtype_size) +H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size) { if(dtype_size > 1) { - unsigned i, j; + size_t i, j; unsigned char *buffer, temp; buffer = (unsigned char *)buf; @@ -1333,32 +1334,6 @@ H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, size_t dtype_size) } /* end if */ } /* end H5Z_scaleoffset_convert() */ -/* Round a floating-point value to the nearest integer value 4/19/05 */ -/* rounding to the bigger absolute value if val is in the middle, - 0.5 -> 1, -0.5 ->-1 -5/9/05, KY */ -static double -H5Z_scaleoffset_rnd(double val) -{ - double u_val, l_val; - - u_val = HDceil(val); - l_val = HDfloor(val); - - if(val > 0) { - if((u_val - val) <= (val - l_val)) - return u_val; - else - return l_val; - } /* end if */ - else { - if((val - l_val) <= (u_val - val)) - return l_val; - else - return u_val; - } -} /* H5Z_scaleoffset_rnd() */ - /* return ceiling of floating-point log2 function * receive unsigned integer as argument 3/10/2005 */ @@ -1507,19 +1482,19 @@ H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffs unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval, double D_val) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT - if(type == t_float) - H5Z_scaleoffset_precompress_3(float, data, d_nelmts, - filavail, cd_values, minbits, minval, D_val) - else if(type == t_double) - H5Z_scaleoffset_precompress_3(double, data, d_nelmts, - filavail, cd_values, minbits, minval, D_val) + if(type == t_float) + H5Z_scaleoffset_precompress_3(float, HDpowf, HDfabsf, HDroundf, HDlroundf, HDllroundf, data, d_nelmts, + filavail, cd_values, minbits, minval, D_val) + else if(type == t_double) + H5Z_scaleoffset_precompress_3(double, HDpow, HDfabs, HDround, HDlround, HDllround, data, d_nelmts, + filavail, cd_values, minbits, minval, D_val) done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* postdecompress for floating-point type, variable-minimum-bits method @@ -1535,10 +1510,10 @@ H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleo FUNC_ENTER_NOAPI_NOINIT if(type == t_float) - H5Z_scaleoffset_postdecompress_3(float, data, d_nelmts, filavail, + H5Z_scaleoffset_postdecompress_3(float, HDpowf, data, d_nelmts, filavail, cd_values, minbits, sminval, D_val) else if(type == t_double) - H5Z_scaleoffset_postdecompress_3(double, data, d_nelmts, filavail, + H5Z_scaleoffset_postdecompress_3(double, HDpow, data, d_nelmts, filavail, cd_values, minbits, sminval, D_val) done: @@ -1568,18 +1543,18 @@ H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, dat_len = 8; if(*buf_len > dat_len) { - data[data_offset + k] = (unsigned char)((val >> (*buf_len - dat_len)) & ~(~0 << dat_len)); + data[data_offset + k] = (unsigned char)((unsigned)(val >> (*buf_len - dat_len)) & (unsigned)(~((unsigned)~0 << dat_len))); *buf_len -= dat_len; } /* end if */ else { - data[data_offset + k] = (unsigned char)((val & ~(~0 << *buf_len)) << (dat_len - *buf_len)); + data[data_offset + k] = (unsigned char)((val & ~((unsigned)(~0) << *buf_len)) << (dat_len - *buf_len)); dat_len -= *buf_len; H5Z_scaleoffset_next_byte(j, buf_len); if(dat_len == 0) return; val = buffer[*j]; - data[data_offset + k] |= (unsigned char)((val >> (*buf_len - dat_len)) & ~(~0 << dat_len)); + data[data_offset + k] |= (unsigned char)((unsigned)(val >> (*buf_len - dat_len)) & ~((unsigned)(~0) << dat_len)); *buf_len -= dat_len; } /* end else */ } @@ -1625,7 +1600,7 @@ H5Z_scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned buf_len; /* must initialize to zeros */ - for(i = 0; i < d_nelmts*p.size; i++) + for(i = 0; i < d_nelmts * p.size; i++) data[i] = 0; /* initialization before the loop */ @@ -1653,16 +1628,16 @@ H5Z_scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, dat_len = 8; if(*buf_len > dat_len) { - buffer[*j] |= (unsigned char)((val & ~(~0 << dat_len)) << (*buf_len - dat_len)); + buffer[*j] |= (unsigned char)((val & ~((unsigned)(~0) << dat_len)) << (*buf_len - dat_len)); *buf_len -= dat_len; } else { - buffer[*j] |= (unsigned char)((val >> (dat_len - *buf_len)) & ~(~0 << *buf_len)); + buffer[*j] |= (unsigned char)((unsigned)(val >> (dat_len - *buf_len)) & ~((unsigned)(~0) << *buf_len)); dat_len -= *buf_len; H5Z_scaleoffset_next_byte(j, buf_len); if(dat_len == 0) return; - buffer[*j] = (unsigned char)((val & ~(~0 << dat_len)) << (*buf_len - dat_len)); + buffer[*j] = (unsigned char)((val & ~((unsigned)(~0) << dat_len)) << (*buf_len - dat_len)); *buf_len -= dat_len; } /* end else */ } diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 2627a29..f30f0b2 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -124,8 +124,8 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (double)(RESR).value.int_val : (RESR).value.float_val); \ p = (TYPE*)(RESL).value.dat_val; \ \ - for(u=0; u<(SIZE); u++) { \ - *p = *p OP tree_val; \ + for(u = 0; u < (SIZE); u++) { \ + *p = (TYPE)((double)*p OP tree_val); \ p++; \ } \ } \ @@ -141,32 +141,31 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); tree_val = ((RESL).type==H5Z_XFORM_INTEGER ? (double)(RESL).value.int_val : (RESL).value.float_val); \ \ p = (TYPE*)(RESR).value.dat_val; \ - for(u=0; u<(SIZE); u++) { \ - *p = tree_val OP *p; \ + for(u = 0; u < (SIZE); u++) { \ + *p = (TYPE)(tree_val OP (double)*p); \ p++; \ } \ } \ - else if( ((RESL).type == H5Z_XFORM_SYMBOL) && ((RESR).type==H5Z_XFORM_SYMBOL)) \ - { \ - TYPE* pl = (TYPE*)(RESL).value.dat_val; \ - TYPE* pr = (TYPE*)(RESR).value.dat_val; \ - \ - for(u=0; u<(SIZE); u++) { \ - *pl = *pl OP *pr; \ - pl++; pr++; \ - } \ - } \ - else \ + else if( ((RESL).type == H5Z_XFORM_SYMBOL) && ((RESR).type == H5Z_XFORM_SYMBOL)) \ + { \ + TYPE* pl = (TYPE*)(RESL).value.dat_val; \ + TYPE* pr = (TYPE*)(RESR).value.dat_val; \ + \ + for(u = 0; u < (SIZE); u++) { \ + *pl = (TYPE)(*pl OP *pr); \ + pl++; pr++; \ + } \ + } \ + else \ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation") \ } -#if H5_SIZEOF_LONG_DOUBLE !=0 +#if H5_SIZEOF_LONG_DOUBLE != 0 +#if CHAR_MIN >= 0 #define H5Z_XFORM_TYPE_OP(RESL,RESR,TYPE,OP,SIZE) \ { \ if((TYPE) == H5T_NATIVE_CHAR) \ H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \ - else if((TYPE) == H5T_NATIVE_UCHAR) \ - H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned char, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_SCHAR) \ H5Z_XFORM_DO_OP1((RESL), (RESR), signed char, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_SHORT) \ @@ -182,7 +181,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); else if((TYPE) == H5T_NATIVE_ULONG) \ H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_LLONG) \ - H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_ULLONG) \ H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_FLOAT) \ @@ -192,13 +191,43 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); else if((TYPE) == H5T_NATIVE_LDOUBLE) \ H5Z_XFORM_DO_OP1((RESL), (RESR), long double, OP, (SIZE)) \ } -#else +#else /* CHAR_MIN >= 0 */ #define H5Z_XFORM_TYPE_OP(RESL,RESR,TYPE,OP,SIZE) \ { \ if((TYPE) == H5T_NATIVE_CHAR) \ H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_UCHAR) \ H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned char, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_SHORT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), short, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_USHORT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned short, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_INT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), int, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_UINT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned int, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_LONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_ULONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_LLONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_ULLONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_FLOAT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_DOUBLE) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), double, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_LDOUBLE) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), long double, OP, (SIZE)) \ +} +#endif /* CHAR_MIN >= 0 */ +#else +#if CHAR_MIN >= 0 +#define H5Z_XFORM_TYPE_OP(RESL,RESR,TYPE,OP,SIZE) \ +{ \ + if((TYPE) == H5T_NATIVE_CHAR) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_SCHAR) \ H5Z_XFORM_DO_OP1((RESL), (RESR), signed char, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_SHORT) \ @@ -222,6 +251,35 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); else if((TYPE) == H5T_NATIVE_DOUBLE) \ H5Z_XFORM_DO_OP1((RESL), (RESR), double, OP, (SIZE)) \ } +#else /* CHAR_MIN >= 0 */ +#define H5Z_XFORM_TYPE_OP(RESL,RESR,TYPE,OP,SIZE) \ +{ \ + if((TYPE) == H5T_NATIVE_CHAR) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_UCHAR) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned char, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_SHORT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), short, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_USHORT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned short, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_INT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), int, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_UINT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned int, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_LONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_ULONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_LLONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_ULLONG) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_FLOAT) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \ + else if((TYPE) == H5T_NATIVE_DOUBLE) \ + H5Z_XFORM_DO_OP1((RESL), (RESR), double, OP, (SIZE)) \ +} +#endif /* CHAR_MIN >= 0 */ #endif /*H5_SIZEOF_LONG_DOUBLE */ #define H5Z_XFORM_DO_OP3(OP) \ @@ -977,17 +1035,20 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size if(tree->type == H5Z_XFORM_INTEGER || tree->type == H5Z_XFORM_FLOAT) { if(array_type == H5T_NATIVE_CHAR) H5Z_XFORM_DO_OP5(char, array_size) - else if(array_type == H5T_NATIVE_UCHAR) - H5Z_XFORM_DO_OP5(unsigned char, array_size) +#if CHAR_MIN >= 0 else if(array_type == H5T_NATIVE_SCHAR) H5Z_XFORM_DO_OP5(signed char, array_size) +#else /* CHAR_MIN >= 0 */ + else if(array_type == H5T_NATIVE_UCHAR) + H5Z_XFORM_DO_OP5(unsigned char, array_size) +#endif /* CHAR_MIN >= 0 */ else if(array_type == H5T_NATIVE_SHORT) H5Z_XFORM_DO_OP5(short, array_size) else if(array_type == H5T_NATIVE_USHORT) H5Z_XFORM_DO_OP5(unsigned short, array_size) else if(array_type == H5T_NATIVE_INT) H5Z_XFORM_DO_OP5(int, array_size) - else if(array_type == H5T_NATIVE_UINT) + else if(array_type == H5T_NATIVE_UINT) H5Z_XFORM_DO_OP5(unsigned int, array_size) else if(array_type == H5T_NATIVE_LONG) H5Z_XFORM_DO_OP5(long, array_size) @@ -1106,34 +1167,32 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ * 1. See if "x" is on left hand side, right hand side, or if both sides are "x" * 2. Figure out what type of data we're going to be manipulating * 3. Do the operation on the data. */ - - switch (tree->type) { case H5Z_XFORM_PLUS: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size) + break; case H5Z_XFORM_MINUS: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, -, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, -, array_size) + break; case H5Z_XFORM_MULT: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, *, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, *, array_size) + break; case H5Z_XFORM_DIVIDE: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, /, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, /, array_size) + break; - case H5Z_XFORM_ERROR: - case H5Z_XFORM_INTEGER: - case H5Z_XFORM_FLOAT: - case H5Z_XFORM_SYMBOL: - case H5Z_XFORM_LPAREN: - case H5Z_XFORM_RPAREN: - case H5Z_XFORM_END: + case H5Z_XFORM_ERROR: + case H5Z_XFORM_INTEGER: + case H5Z_XFORM_FLOAT: + case H5Z_XFORM_SYMBOL: + case H5Z_XFORM_LPAREN: + case H5Z_XFORM_RPAREN: + case H5Z_XFORM_END: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") } /* end switch */ /* The result stores a pointer to the new data */ diff --git a/src/H5detect.c b/src/H5detect.c index ee02c52..94e841e 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1177,7 +1177,7 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ * *------------------------------------------------------------------------- */ -static unsigned int +H5_ATTR_PURE static unsigned int find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) { unsigned char *a = (unsigned char *) _a; diff --git a/src/H5private.h b/src/H5private.h index d400469..6a677bb 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -657,6 +657,9 @@ typedef struct { #ifndef HDatol #define HDatol(S) atol(S) #endif /* HDatol */ +#ifndef HDatoll + #define HDatoll(S) atoll(S) +#endif /* HDatol */ #ifndef HDbsearch #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) #endif /* HDbsearch */ @@ -1029,6 +1032,15 @@ typedef off_t h5_stat_size_t; #ifndef HDlink #define HDlink(OLD,NEW) link(OLD,NEW) #endif /* HDlink */ +#ifndef HDllround + #define HDllround(V) llround(V) +#endif /* HDround */ +#ifndef HDllroundf + #define HDllroundf(V) llroundf(V) +#endif /* HDllroundf */ +#ifndef HDllroundl + #define HDllroundl(V) llroundl(V) +#endif /* HDllroundl */ #ifndef HDlocaleconv #define HDlocaleconv() localeconv() #endif /* HDlocaleconv */ @@ -1044,6 +1056,15 @@ typedef off_t h5_stat_size_t; #ifndef HDlongjmp #define HDlongjmp(J,N) longjmp(J,N) #endif /* HDlongjmp */ +#ifndef HDlround + #define HDlround(V) lround(V) +#endif /* HDround */ +#ifndef HDlroundf + #define HDlroundf(V) lroundf(V) +#endif /* HDlroundf */ +#ifndef HDlroundl + #define HDlroundl(V) lroundl(V) +#endif /* HDroundl */ #ifndef HDlseek #define HDlseek(F,O,W) lseek(F,O,W) #endif /* HDlseek */ @@ -1118,6 +1139,9 @@ typedef off_t h5_stat_size_t; #ifndef HDpow #define HDpow(X,Y) pow(X,Y) #endif /* HDpow */ +#ifndef HDpowf + #define HDpowf(X,Y) powf(X,Y) +#endif /* HDpowf */ /* printf() variable arguments */ #ifndef HDputc #define HDputc(C,F) putc(C,F) @@ -1180,6 +1204,15 @@ typedef off_t h5_stat_size_t; #ifndef HDrewinddir #define HDrewinddir(D) rewinddir(D) #endif /* HDrewinddir */ +#ifndef HDround + #define HDround(V) round(V) +#endif /* HDround */ +#ifndef HDroundf + #define HDroundf(V) roundf(V) +#endif /* HDroundf */ +#ifndef HDroundl + #define HDroundl(V) roundl(V) +#endif /* HDroundl */ #ifndef HDrmdir #define HDrmdir(S) rmdir(S) #endif /* HDrmdir */ diff --git a/src/H5public.h b/src/H5public.h index 554ad26..2f21648 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -194,28 +194,21 @@ H5_GCC_DIAG_ON(long-long) /* * File addresses have their own types. */ -#if H5_SIZEOF_INT64_T>=8 - typedef uint64_t haddr_t; -# define HADDR_UNDEF ((haddr_t)(int64_t)(-1)) -# define H5_SIZEOF_HADDR_T H5_SIZEOF_INT64_T -# ifdef H5_HAVE_PARALLEL -# define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT -# endif /* H5_HAVE_PARALLEL */ -#elif H5_SIZEOF_INT>=8 +#if H5_SIZEOF_INT >= 8 typedef unsigned haddr_t; # define HADDR_UNDEF ((haddr_t)(-1)) # define H5_SIZEOF_HADDR_T H5_SIZEOF_INT # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_UNSIGNED # endif /* H5_HAVE_PARALLEL */ -#elif H5_SIZEOF_LONG>=8 +#elif H5_SIZEOF_LONG >= 8 typedef unsigned long haddr_t; # define HADDR_UNDEF ((haddr_t)(long)(-1)) # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG # endif /* H5_HAVE_PARALLEL */ -#elif H5_SIZEOF_LONG_LONG>=8 +#elif H5_SIZEOF_LONG_LONG >= 8 typedef unsigned long long haddr_t; # define HADDR_UNDEF ((haddr_t)(long long)(-1)) # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG @@ -225,11 +218,11 @@ H5_GCC_DIAG_ON(long-long) #else # error "nothing appropriate for haddr_t" #endif -#if H5_SIZEOF_HADDR_T ==H5_SIZEOF_INT +#if H5_SIZEOF_HADDR_T == H5_SIZEOF_INT # define H5_PRINTF_HADDR_FMT "%u" -#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG +#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG # define H5_PRINTF_HADDR_FMT "%lu" -#elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG_LONG +#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG_LONG # define H5_PRINTF_HADDR_FMT "%" H5_PRINTF_LL_WIDTH "u" #else # error "nothing appropriate for H5_PRINTF_HADDR_FMT" diff --git a/test/cache.c b/test/cache.c index 3cddb4c..361d598 100644 --- a/test/cache.c +++ b/test/cache.c @@ -9531,63 +9531,63 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par idx: dep ref.count: dep height: order: corked: */ - { VARIABLE_ENTRY_TYPE, 0, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 2, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 4, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 6, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 8, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 9, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 0, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 1, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 2, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 3, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 4, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 5, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 6, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 7, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 8, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 9, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 10, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 11, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 12, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 13, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { VARIABLE_ENTRY_TYPE, 0, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 2, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 4, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 6, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 8, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 9, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 0, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 1, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 2, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 3, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 4, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 5, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 6, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 7, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 8, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 9, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 10, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 11, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 12, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 13, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; if ( pass ) { @@ -27934,158 +27934,158 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) */ struct expected_entry_status expected[150] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type: par idx: dep ref.count: dep height: order: corked: */ - { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 4, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 5, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 6, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 7, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 8, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 9, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 10, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 11, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 12, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 13, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 14, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 15, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 16, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 17, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 18, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 19, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 20, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 21, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 22, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 23, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 24, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 25, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 26, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 27, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 28, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 29, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 30, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 31, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 32, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 33, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 34, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 35, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 36, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 37, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 38, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 39, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 40, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 41, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 42, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 43, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 44, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 45, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 46, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 47, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 48, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 49, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 50, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 51, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 52, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 53, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 54, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 55, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 56, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 57, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 58, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 59, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 60, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 61, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 62, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 63, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 64, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 65, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 66, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 67, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 68, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 69, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 70, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 71, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 72, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 73, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 74, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 75, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 76, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 77, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 78, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 79, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 80, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 81, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 82, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 83, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 84, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 85, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 86, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 87, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 88, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 89, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 90, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 91, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 92, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 93, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 94, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 95, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 96, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 97, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 98, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 99, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 100, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 101, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 102, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 103, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 104, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 105, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 106, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 107, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 108, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 109, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 110, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 111, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 112, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 113, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 114, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 115, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 116, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 117, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 118, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 119, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 120, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 121, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 122, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 123, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 124, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 125, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 126, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 127, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 128, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 129, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 130, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 131, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 132, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 133, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 134, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 135, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 136, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 137, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 138, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 139, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 140, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 141, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 142, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 143, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 144, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 145, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 146, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 147, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 148, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 149, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 4, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 5, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 6, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 7, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 8, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 9, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 10, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 11, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 12, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 13, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 14, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 15, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 16, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 17, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 18, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 19, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 20, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 21, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 22, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 23, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 24, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 25, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 26, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 27, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 28, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 29, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 30, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 31, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 32, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 33, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 34, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 35, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 36, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 37, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 38, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 39, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 40, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 41, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 42, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 43, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 44, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 45, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 46, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 47, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 48, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 49, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 50, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 51, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 52, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 53, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 54, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 55, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 56, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 57, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 58, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 59, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 60, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 61, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 62, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 63, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 64, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 65, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 66, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 67, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 68, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 69, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 70, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 71, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 72, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 73, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 74, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 75, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 76, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 77, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 78, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 79, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 80, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 81, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 82, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 83, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 84, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 85, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 86, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 87, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 88, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 89, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 90, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 91, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 92, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 93, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 94, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 95, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 96, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 97, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 98, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 99, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 100, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 101, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 102, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 103, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 104, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 105, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 106, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 107, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 108, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 109, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 110, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 111, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 112, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 113, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 114, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 115, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 116, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 117, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 118, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 119, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 120, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 121, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 122, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 123, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 124, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 125, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 126, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 127, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 128, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 129, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 130, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 131, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 132, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 133, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 134, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 135, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 136, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 137, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 138, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 139, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 140, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 141, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 142, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 143, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 144, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 145, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 146, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 147, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 148, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 149, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; pass = TRUE; @@ -28767,12 +28767,12 @@ check_flush_deps(void) struct expected_entry_status expected[5] = { /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type: par idx: dep ref.count: dep height: order: corked: */ - { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; TESTING("flush dependencies"); @@ -28857,12 +28857,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28886,12 +28887,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroy flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd =0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28917,14 +28917,16 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 2; - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 2; + expected[0].flush_dep_npar = 1; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[0] = 2; - expected[2].flush_dep_height = 1; + expected[2].flush_dep_nchd = 2; + expected[2].flush_dep_ndirty_chd = 2; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28951,14 +28953,12 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroy flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; + expected[1].flush_dep_npar = 0; expected[2].is_protected = FALSE; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[0] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28983,12 +28983,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29006,12 +29007,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29029,12 +29031,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[2].flush_dep_par_type = entry_type; - expected[2].flush_dep_par_idx = 3; + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 3; + expected[2].flush_dep_npar = 1; expected[3].is_protected = TRUE; expected[3].is_pinned = TRUE; - expected[3].child_flush_dep_height_rc[2] = 1; - expected[3].flush_dep_height = 3; + expected[3].flush_dep_nchd = 1; + expected[3].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29058,12 +29061,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[2].flush_dep_par_type = -1; - expected[2].flush_dep_par_idx = -1; + expected[2].flush_dep_npar = 0; expected[3].is_protected = FALSE; expected[3].is_pinned = FALSE; - expected[3].child_flush_dep_height_rc[2] = 0; - expected[3].flush_dep_height = 0; + expected[3].flush_dep_nchd = 0; + expected[3].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29084,12 +29086,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_protected = FALSE; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29110,12 +29111,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29126,7 +29126,7 @@ check_flush_deps(void) } /* Test Case #3a2 - Single chain of flush dependencies, 4 entries tall - * created from the "bottom up" and destroyed from the "top down" + * created from the "bottom up" and destroyed from the "bottom up" */ /* Create flush dependency between entries (child) 0->1->2->3 (parent) */ @@ -29140,12 +29140,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29163,12 +29164,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29186,12 +29188,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[2].flush_dep_par_type = entry_type; - expected[2].flush_dep_par_idx = 3; + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 3; + expected[2].flush_dep_npar = 1; expected[3].is_protected = TRUE; expected[3].is_pinned = TRUE; - expected[3].child_flush_dep_height_rc[2] = 1; - expected[3].flush_dep_height = 3; + expected[3].flush_dep_nchd = 1; + expected[3].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29215,18 +29218,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; - expected[2].child_flush_dep_height_rc[0] = 1; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 1; - expected[3].child_flush_dep_height_rc[1] = 1; - expected[3].child_flush_dep_height_rc[2] = 0; - expected[3].flush_dep_height = 2; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29247,15 +29243,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_protected = FALSE; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[0] = 0; - expected[2].flush_dep_height = 0; - expected[3].child_flush_dep_height_rc[0] = 1; - expected[3].child_flush_dep_height_rc[1] = 0; - expected[3].flush_dep_height = 1; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29276,12 +29268,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[2].flush_dep_par_type = -1; - expected[2].flush_dep_par_idx = -1; + expected[2].flush_dep_npar = 0; expected[3].is_protected = FALSE; expected[3].is_pinned = FALSE; - expected[3].child_flush_dep_height_rc[0] = 0; - expected[3].flush_dep_height = 0; + expected[3].flush_dep_nchd = 0; + expected[3].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29306,12 +29297,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[2].flush_dep_par_type = entry_type; - expected[2].flush_dep_par_idx = 3; + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 3; + expected[2].flush_dep_npar = 1; expected[3].is_protected = TRUE; expected[3].is_pinned = TRUE; - expected[3].child_flush_dep_height_rc[0] = 1; - expected[3].flush_dep_height = 1; + expected[3].flush_dep_nchd = 1; + expected[3].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29329,15 +29321,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[0] = 1; - expected[2].flush_dep_height = 1; - expected[3].child_flush_dep_height_rc[0] = 0; - expected[3].child_flush_dep_height_rc[1] = 1; - expected[3].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29355,18 +29345,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; - expected[2].child_flush_dep_height_rc[0] = 0; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; - expected[3].child_flush_dep_height_rc[1] = 0; - expected[3].child_flush_dep_height_rc[2] = 1; - expected[3].flush_dep_height = 3; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29390,12 +29375,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[2].flush_dep_par_type = -1; - expected[2].flush_dep_par_idx = -1; + expected[2].flush_dep_npar = 0; expected[3].is_protected = FALSE; expected[3].is_pinned = FALSE; - expected[3].child_flush_dep_height_rc[2] = 0; - expected[3].flush_dep_height = 0; + expected[3].flush_dep_nchd = 0; + expected[3].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29416,12 +29400,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_protected = FALSE; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29442,12 +29425,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29472,12 +29454,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[2].flush_dep_par_type = entry_type; - expected[2].flush_dep_par_idx = 3; + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 3; + expected[2].flush_dep_npar = 1; expected[3].is_protected = TRUE; expected[3].is_pinned = TRUE; - expected[3].child_flush_dep_height_rc[0] = 1; - expected[3].flush_dep_height = 1; + expected[3].flush_dep_nchd = 1; + expected[3].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29495,15 +29478,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[0] = 1; - expected[2].flush_dep_height = 1; - expected[3].child_flush_dep_height_rc[0] = 0; - expected[3].child_flush_dep_height_rc[1] = 1; - expected[3].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29521,18 +29502,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; - expected[2].child_flush_dep_height_rc[0] = 0; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; - expected[3].child_flush_dep_height_rc[1] = 0; - expected[3].child_flush_dep_height_rc[2] = 1; - expected[3].flush_dep_height = 3; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29556,18 +29532,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; - expected[2].child_flush_dep_height_rc[0] = 1; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 1; - expected[3].child_flush_dep_height_rc[1] = 1; - expected[3].child_flush_dep_height_rc[2] = 0; - expected[3].flush_dep_height = 2; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29588,15 +29557,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_protected = FALSE; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[0] = 0; - expected[2].flush_dep_height = 0; - expected[3].child_flush_dep_height_rc[0] = 1; - expected[3].child_flush_dep_height_rc[1] = 0; - expected[3].flush_dep_height = 1; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29617,12 +29582,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[2].flush_dep_par_type = -1; - expected[2].flush_dep_par_idx = -1; + expected[2].flush_dep_npar = 0; expected[3].is_protected = FALSE; expected[3].is_pinned = FALSE; - expected[3].child_flush_dep_height_rc[0] = 0; - expected[3].flush_dep_height = 0; + expected[3].flush_dep_nchd = 0; + expected[3].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29646,12 +29610,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[u].flush_dep_par_type = entry_type; - expected[u].flush_dep_par_idx = 4; + expected[u].flush_dep_par_type[0] = entry_type; + expected[u].flush_dep_par_idx[0] = 4; + expected[u].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = u + 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd++; + expected[4].flush_dep_ndirty_chd++; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29671,9 +29636,9 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[u].flush_dep_par_type = -1; - expected[u].flush_dep_par_idx = -1; - expected[4].child_flush_dep_height_rc[0] = 3 - u; + expected[u].flush_dep_npar = 0; + expected[4].flush_dep_nchd--; + expected[4].flush_dep_ndirty_chd--; /* Check for destroying flush dependency on last entry */ if(3 == u) { @@ -29688,7 +29653,6 @@ check_flush_deps(void) */ expected[4].is_protected = FALSE; expected[4].is_pinned = FALSE; - expected[4].flush_dep_height = 0; } /* end if */ /* Verify the status */ @@ -29717,12 +29681,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29740,12 +29705,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[3].flush_dep_par_type = entry_type; - expected[3].flush_dep_par_idx = 4; + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 4; + expected[3].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd = 1; + expected[4].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29763,15 +29729,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[4].flush_dep_par_type = entry_type; - expected[4].flush_dep_par_idx = 0; + expected[4].flush_dep_par_type[0] = entry_type; + expected[4].flush_dep_par_idx[0] = 0; + expected[4].flush_dep_npar = 1; expected[0].is_protected = TRUE; expected[0].is_pinned = TRUE; - expected[0].child_flush_dep_height_rc[1] = 1; - expected[0].flush_dep_height = 2; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].child_flush_dep_height_rc[2] = 1; - expected[1].flush_dep_height = 3; + expected[0].flush_dep_nchd = 1; + expected[0].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29796,15 +29760,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[4].flush_dep_par_type = -1; - expected[4].flush_dep_par_idx = -1; + expected[4].flush_dep_npar = 0; expected[0].is_protected = FALSE; expected[0].is_pinned = FALSE; - expected[0].child_flush_dep_height_rc[1] = 0; - expected[0].flush_dep_height = 0; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].child_flush_dep_height_rc[2] = 0; - expected[1].flush_dep_height = 1; + expected[0].flush_dep_nchd = 0; + expected[0].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29825,12 +29785,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[3].flush_dep_par_type = -1; - expected[3].flush_dep_par_idx = -1; + expected[3].flush_dep_npar = 0; expected[4].is_protected = FALSE; expected[4].is_pinned = FALSE; - expected[4].child_flush_dep_height_rc[0] = 0; - expected[4].flush_dep_height = 0; + expected[4].flush_dep_nchd = 0; + expected[4].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29851,12 +29810,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29883,12 +29841,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5F_t * cache_ptr */ @@ -29906,12 +29865,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29929,12 +29889,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[3].flush_dep_par_type = entry_type; - expected[3].flush_dep_par_idx = 4; + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 4; + expected[3].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd = 1; + expected[4].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29949,13 +29910,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[4].flush_dep_par_type = entry_type; - expected[4].flush_dep_par_idx = 1; - expected[1].child_flush_dep_height_rc[1] = 1; - expected[1].flush_dep_height = 2; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].child_flush_dep_height_rc[2] = 1; - expected[2].flush_dep_height = 3; + expected[4].flush_dep_par_type[0] = entry_type; + expected[4].flush_dep_par_idx[0] = 1; + expected[4].flush_dep_npar = 1; + expected[1].flush_dep_nchd = 2; + expected[1].flush_dep_ndirty_chd = 2; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -29974,13 +29933,9 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[4].flush_dep_par_type = -1; - expected[4].flush_dep_par_idx = -1; - expected[1].child_flush_dep_height_rc[1] = 0; - expected[1].flush_dep_height = 1; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].child_flush_dep_height_rc[2] = 0; - expected[2].flush_dep_height = 2; + expected[4].flush_dep_npar = 0; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30001,12 +29956,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[3].flush_dep_par_type = -1; - expected[3].flush_dep_par_idx = -1; + expected[3].flush_dep_npar = 0; expected[4].is_protected = FALSE; expected[4].is_pinned = FALSE; - expected[4].child_flush_dep_height_rc[0] = 0; - expected[4].flush_dep_height = 0; + expected[4].flush_dep_nchd = 0; + expected[4].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30027,12 +29981,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_protected = FALSE; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30053,12 +30006,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30085,12 +30037,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30108,12 +30061,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30131,12 +30085,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[3].flush_dep_par_type = entry_type; - expected[3].flush_dep_par_idx = 4; + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 4; + expected[3].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd = 1; + expected[4].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30151,9 +30106,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[4].flush_dep_par_type = entry_type; - expected[4].flush_dep_par_idx = 2; - expected[2].child_flush_dep_height_rc[1] = 2; + expected[4].flush_dep_par_type[0] = entry_type; + expected[4].flush_dep_par_idx[0] = 2; + expected[4].flush_dep_npar = 1; + expected[2].flush_dep_nchd = 2; + expected[2].flush_dep_ndirty_chd = 2; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30172,9 +30129,9 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[4].flush_dep_par_type = -1; - expected[4].flush_dep_par_idx = -1; - expected[2].child_flush_dep_height_rc[1] = 1; + expected[4].flush_dep_npar = 0; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30195,12 +30152,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[3].flush_dep_par_type = -1; - expected[3].flush_dep_par_idx = -1; + expected[3].flush_dep_npar = 0; expected[4].is_protected = FALSE; expected[4].is_pinned = FALSE; - expected[4].child_flush_dep_height_rc[0] = 0; - expected[4].flush_dep_height = 0; + expected[4].flush_dep_nchd = 0; + expected[4].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30221,12 +30177,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_protected = FALSE; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30247,12 +30202,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30280,12 +30234,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30312,12 +30267,11 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroy flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30345,12 +30299,13 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30384,12 +30339,121 @@ check_flush_deps(void) /* Change expected values, and verify the status of the entries * after destroy flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; + expected[1].is_protected = FALSE; + expected[1].is_pinned = FALSE; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + +/* Test Case #7 - Simple multiple parents + */ + + /* Create flush dependency between entries (child) 0 and 1, 2 (parents) + */ + { + protect_entry(file_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; + expected[1].is_protected = TRUE; + expected[1].is_pinned = TRUE; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + protect_entry(file_ptr, entry_type, 2); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 2, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type[1] = entry_type; + expected[0].flush_dep_par_idx[1] = 2; + expected[0].flush_dep_npar = 2; + expected[2].is_protected = TRUE; + expected[2].is_pinned = TRUE; + expected[2].flush_dep_nchd = 1; + expected[2].flush_dep_ndirty_chd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + + /* Destroy flush dependency between entries */ + { + destroy_flush_dependency(entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 1, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 2; + expected[0].flush_dep_npar = 1; expected[1].is_protected = FALSE; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + expected[1].flush_dep_ndirty_chd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 2, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 2, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[0].flush_dep_npar = 0; + expected[2].is_protected = FALSE; + expected[2].is_pinned = FALSE; + expected[2].flush_dep_nchd = 0; + expected[2].flush_dep_ndirty_chd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30442,7 +30506,7 @@ check_flush_deps_err(void) /* Loop over test cases, check for various errors in configuring flush * dependencies. Verify that all performs as expected. */ - for(test_count = 0; test_count < 9; test_count++) { + for(test_count = 0; test_count < 7; test_count++) { unsigned u; /* Local index variable */ herr_t result; /* Generic return value */ @@ -30480,161 +30544,14 @@ check_flush_deps_err(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") break; - /* Verify that a child entry can only have one flush dependency parent */ - case 2: - protect_entry(file_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(entry_type, 0, entry_type, 2); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - protect_entry(file_ptr, entry_type, 1); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - result = H5C_create_flush_dependency(&((entries[entry_type])[1]), &((entries[entry_type])[2])); - if( result != FAIL ) CACHE_ERROR("Creating second flush dependency for child") - - destroy_flush_dependency(entry_type, 0, entry_type, 2); - if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 1, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 0, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - break; - - /* Verify that a flush dependency chain can't be higher than (H5C__NUM_FLUSH_DEP_HEIGHTS - 1) */ - case 3: - protect_entry(file_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(entry_type, 0, entry_type, 1); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - protect_entry(file_ptr, entry_type, 1); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(entry_type, 1, entry_type, 2); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - protect_entry(file_ptr, entry_type, 2); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(entry_type, 2, entry_type, 3); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - protect_entry(file_ptr, entry_type, 3); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(entry_type, 3, entry_type, 4); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - protect_entry(file_ptr, entry_type, 4); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(entry_type, 4, entry_type, 5); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - protect_entry(file_ptr, entry_type, 5); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(entry_type, 5, entry_type, 6); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - protect_entry(file_ptr, entry_type, 6); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - result = H5C_create_flush_dependency(&((entries[entry_type])[6]), &((entries[entry_type])[7])); - if( result != FAIL ) CACHE_ERROR("Creating flush dependency that's too tall") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 6, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - protect_entry(file_ptr, entry_type, 7); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - result = H5C_create_flush_dependency(&((entries[entry_type])[7]), &((entries[entry_type])[0])); - if( result != FAIL ) CACHE_ERROR("Creating flush dependency that's too tall") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 7, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - destroy_flush_dependency(entry_type, 0, entry_type, 1); - if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 0, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - destroy_flush_dependency(entry_type, 1, entry_type, 2); - if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 1, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - destroy_flush_dependency(entry_type, 2, entry_type, 3); - if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 2, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - destroy_flush_dependency(entry_type, 3, entry_type, 4); - if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 3, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - destroy_flush_dependency(entry_type, 4, entry_type, 5); - if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 4, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - - destroy_flush_dependency(entry_type, 5, entry_type, 6); - if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") - - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 5, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - break; - /* Verify that parent entry must be protected */ - case 4: + case 2: result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1])); if( result != FAIL ) CACHE_ERROR("Destroying [non-existant] dependency when parent isn't protected") break; /* Verify that parent entry has flush dependency */ - case 5: + case 3: protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -30649,7 +30566,7 @@ check_flush_deps_err(void) break; /* Verify that child entry is in flush dependency relationship */ - case 6: + case 4: protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -30669,8 +30586,8 @@ check_flush_deps_err(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") break; - /* Verify that parent has child entries at this height */ - case 7: + /* Verify that parent has child as direct descendant */ + case 5: protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -30690,7 +30607,7 @@ check_flush_deps_err(void) if ( !pass ) CACHE_ERROR("create_flush_dependency failed") result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[4])); - if( result != FAIL ) CACHE_ERROR("Destroying dependency when parent has no children at child's height") + if( result != FAIL ) CACHE_ERROR("Destroying dependency when child is not a direct descendant has no children at child's height") destroy_flush_dependency(entry_type, 0, entry_type, 1); if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") @@ -30722,7 +30639,7 @@ check_flush_deps_err(void) /* Verify that child entry is child of parent */ - case 8: + case 6: protect_entry(file_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -30805,13 +30722,13 @@ check_flush_deps_order(void) unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type: par idx: dep ref.count: dep height: order: corked: */ - { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; unsigned flush_order; /* Index for tracking flush order */ @@ -30861,12 +30778,13 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; + expected[1].flush_dep_ndirty_chd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30907,6 +30825,7 @@ check_flush_deps_order(void) expected[1].serialized = TRUE; expected[1].flush_order = 1; expected[1].is_protected = FALSE; + expected[1].flush_dep_ndirty_chd =0; expected[2].is_dirty = FALSE; expected[2].serialized = TRUE; expected[3].is_dirty = FALSE; @@ -30930,11 +30849,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroy flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -30959,10 +30876,10 @@ check_flush_deps_order(void) */ expected[0].is_protected = TRUE; expected[0].is_pinned = TRUE; - expected[0].child_flush_dep_height_rc[0] = 1; - expected[0].flush_dep_height = 1; - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 0; + expected[0].flush_dep_nchd = 1; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 0; + expected[1].flush_dep_npar = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31032,10 +30949,8 @@ check_flush_deps_order(void) * after destroy flush dependency */ expected[0].is_pinned = FALSE; - expected[0].child_flush_dep_height_rc[0] = 0; - expected[0].flush_dep_height = 0; - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[0].flush_dep_nchd = 0; + expected[1].flush_dep_npar = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31063,14 +30978,15 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 2; - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 2; + expected[0].flush_dep_npar = 1; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[0] = 2; - expected[2].flush_dep_height = 1; + expected[2].flush_dep_nchd = 2; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31150,13 +31066,10 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroy flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; + expected[1].flush_dep_npar = 0; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[0] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31186,12 +31099,13 @@ check_flush_deps_order(void) */ expected[0].is_protected = TRUE; expected[0].is_pinned = TRUE; - expected[0].child_flush_dep_height_rc[0] = 2; - expected[0].flush_dep_height = 1; - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 0; - expected[2].flush_dep_par_type = entry_type; - expected[2].flush_dep_par_idx = 0; + expected[0].flush_dep_nchd = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 0; + expected[1].flush_dep_npar = 1; + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 0; + expected[2].flush_dep_npar = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31272,12 +31186,9 @@ check_flush_deps_order(void) * after destroy flush dependency */ expected[0].is_pinned = FALSE; - expected[0].child_flush_dep_height_rc[0] = 0; - expected[0].flush_dep_height = 0; - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; - expected[2].flush_dep_par_type = -1; - expected[2].flush_dep_par_idx = -1; + expected[0].flush_dep_nchd = 0; + expected[1].flush_dep_npar = 0; + expected[2].flush_dep_npar = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31302,12 +31213,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31325,12 +31236,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31348,12 +31259,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[2].flush_dep_par_type = entry_type; - expected[2].flush_dep_par_idx = 3; + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 3; + expected[2].flush_dep_npar = 1; expected[3].is_protected = TRUE; expected[3].is_pinned = TRUE; - expected[3].child_flush_dep_height_rc[2] = 1; - expected[3].flush_dep_height = 3; + expected[3].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31451,11 +31362,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[2].flush_dep_par_type = -1; - expected[2].flush_dep_par_idx = -1; + expected[2].flush_dep_npar = 0; expected[3].is_pinned = FALSE; - expected[3].child_flush_dep_height_rc[2] = 0; - expected[3].flush_dep_height = 0; + expected[3].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31470,11 +31379,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31489,11 +31396,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31520,10 +31425,10 @@ check_flush_deps_order(void) */ expected[0].is_protected = TRUE; expected[0].is_pinned = TRUE; - expected[0].child_flush_dep_height_rc[0] = 1; - expected[0].flush_dep_height = 1; - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 0; + expected[0].flush_dep_nchd = 1; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 0; + expected[1].flush_dep_npar = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31541,15 +31446,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].child_flush_dep_height_rc[0] = 0; - expected[0].child_flush_dep_height_rc[1] = 1; - expected[0].flush_dep_height = 2; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; - expected[2].flush_dep_par_type = entry_type; - expected[2].flush_dep_par_idx = 1; + expected[1].flush_dep_nchd = 1; + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 1; + expected[2].flush_dep_npar = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31567,18 +31469,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].child_flush_dep_height_rc[1] = 0; - expected[0].child_flush_dep_height_rc[2] = 1; - expected[0].flush_dep_height = 3; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].child_flush_dep_height_rc[1] = 1; - expected[1].flush_dep_height = 2; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[0] = 1; - expected[2].flush_dep_height = 1; - expected[3].flush_dep_par_type = entry_type; - expected[3].flush_dep_par_idx = 2; + expected[2].flush_dep_nchd = 1; + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 2; + expected[3].flush_dep_npar = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31677,17 +31573,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].child_flush_dep_height_rc[2] = 0; - expected[0].child_flush_dep_height_rc[1] = 1; - expected[0].flush_dep_height = 2; - expected[1].child_flush_dep_height_rc[1] = 0; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[0] = 0; - expected[2].flush_dep_height = 0; - expected[3].flush_dep_par_type = -1; - expected[3].flush_dep_par_idx = -1; + expected[2].flush_dep_nchd = 0; + expected[3].flush_dep_npar = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31702,14 +31590,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].child_flush_dep_height_rc[1] = 0; - expected[0].child_flush_dep_height_rc[0] = 1; - expected[0].flush_dep_height = 1; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; - expected[2].flush_dep_par_type = -1; - expected[2].flush_dep_par_idx = -1; + expected[1].flush_dep_nchd = 0; + expected[2].flush_dep_npar = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31725,10 +31608,8 @@ check_flush_deps_order(void) * after destroying flush dependency */ expected[0].is_pinned = FALSE; - expected[0].child_flush_dep_height_rc[0] = 0; - expected[0].flush_dep_height = 0; - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[0].flush_dep_nchd = 0; + expected[1].flush_dep_npar = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31752,12 +31633,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[u].flush_dep_par_type = entry_type; - expected[u].flush_dep_par_idx = 4; + expected[u].flush_dep_par_type[0] = entry_type; + expected[u].flush_dep_par_idx[0] = 4; + expected[u].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = u + 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd = u + 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31852,9 +31733,8 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[u].flush_dep_par_type = -1; - expected[u].flush_dep_par_idx = -1; - expected[4].child_flush_dep_height_rc[0] = 3 - u; + expected[u].flush_dep_npar = 0; + expected[4].flush_dep_nchd = 3 - u; /* Check for destroying flush dependency on last entry */ if(3 == u) { @@ -31862,7 +31742,6 @@ check_flush_deps_order(void) * after destroying flush dependency */ expected[4].is_pinned = FALSE; - expected[4].flush_dep_height = 0; } /* end if */ /* Verify the status */ @@ -31888,12 +31767,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[u].flush_dep_par_type = entry_type; - expected[u].flush_dep_par_idx = 0; + expected[u].flush_dep_par_type[0] = entry_type; + expected[u].flush_dep_par_idx[0] = 0; + expected[u].flush_dep_npar = 1; expected[0].is_protected = TRUE; expected[0].is_pinned = TRUE; - expected[0].child_flush_dep_height_rc[0] = u; - expected[0].flush_dep_height = 1; + expected[0].flush_dep_nchd = u; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -31988,9 +31867,8 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[u].flush_dep_par_type = -1; - expected[u].flush_dep_par_idx = -1; - expected[0].child_flush_dep_height_rc[0] = 4 - u; + expected[u].flush_dep_npar = 0; + expected[0].flush_dep_nchd = 4 - u; /* Check for destroying flush dependency on last entry */ if(4 == u) { @@ -31998,7 +31876,6 @@ check_flush_deps_order(void) * after destroying flush dependency */ expected[0].is_pinned = FALSE; - expected[0].flush_dep_height = 0; } /* end if */ /* Verify the status */ @@ -32027,12 +31904,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32050,12 +31927,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[3].flush_dep_par_type = entry_type; - expected[3].flush_dep_par_idx = 4; + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 4; + expected[3].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32073,15 +31950,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[4].flush_dep_par_type = entry_type; - expected[4].flush_dep_par_idx = 0; + expected[4].flush_dep_par_type[0] = entry_type; + expected[4].flush_dep_par_idx[0] = 0; + expected[4].flush_dep_npar = 1; expected[0].is_protected = TRUE; expected[0].is_pinned = TRUE; - expected[0].child_flush_dep_height_rc[1] = 1; - expected[0].flush_dep_height = 2; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].child_flush_dep_height_rc[2] = 1; - expected[1].flush_dep_height = 3; + expected[0].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32186,14 +32060,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[4].flush_dep_par_type = -1; - expected[4].flush_dep_par_idx = -1; + expected[4].flush_dep_npar = 0; expected[0].is_pinned = FALSE; - expected[0].child_flush_dep_height_rc[1] = 0; - expected[0].flush_dep_height = 0; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].child_flush_dep_height_rc[2] = 0; - expected[1].flush_dep_height = 1; + expected[0].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32208,11 +32077,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[3].flush_dep_par_type = -1; - expected[3].flush_dep_par_idx = -1; + expected[3].flush_dep_npar = 0; expected[4].is_pinned = FALSE; - expected[4].child_flush_dep_height_rc[0] = 0; - expected[4].flush_dep_height = 0; + expected[4].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32227,11 +32094,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32258,12 +32123,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32281,12 +32146,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32304,12 +32169,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[3].flush_dep_par_type = entry_type; - expected[3].flush_dep_par_idx = 4; + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 4; + expected[3].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32324,13 +32189,10 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[4].flush_dep_par_type = entry_type; - expected[4].flush_dep_par_idx = 1; - expected[1].child_flush_dep_height_rc[1] = 1; - expected[1].flush_dep_height = 2; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].child_flush_dep_height_rc[2] = 1; - expected[2].flush_dep_height = 3; + expected[4].flush_dep_par_type[0] = entry_type; + expected[4].flush_dep_par_idx[0] = 1; + expected[4].flush_dep_npar = 1; + expected[1].flush_dep_nchd = 2; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32439,13 +32301,8 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[4].flush_dep_par_type = -1; - expected[4].flush_dep_par_idx = -1; - expected[1].child_flush_dep_height_rc[1] = 0; - expected[1].flush_dep_height = 1; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].child_flush_dep_height_rc[2] = 0; - expected[2].flush_dep_height = 2; + expected[4].flush_dep_npar = 0; + expected[1].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32460,11 +32317,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[3].flush_dep_par_type = -1; - expected[3].flush_dep_par_idx = -1; + expected[3].flush_dep_npar = 0; expected[4].is_pinned = FALSE; - expected[4].child_flush_dep_height_rc[0] = 0; - expected[4].flush_dep_height = 0; + expected[4].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32479,11 +32334,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32498,11 +32351,9 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32529,12 +32380,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[0].flush_dep_par_type = entry_type; - expected[0].flush_dep_par_idx = 1; + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; expected[1].is_protected = TRUE; expected[1].is_pinned = TRUE; - expected[1].child_flush_dep_height_rc[0] = 1; - expected[1].flush_dep_height = 1; + expected[1].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32552,12 +32403,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[1].flush_dep_par_type = entry_type; - expected[1].flush_dep_par_idx = 2; + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; expected[2].is_protected = TRUE; expected[2].is_pinned = TRUE; - expected[2].child_flush_dep_height_rc[1] = 1; - expected[2].flush_dep_height = 2; + expected[2].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32575,12 +32426,12 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[3].flush_dep_par_type = entry_type; - expected[3].flush_dep_par_idx = 4; + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 4; + expected[3].flush_dep_npar = 1; expected[4].is_protected = TRUE; expected[4].is_pinned = TRUE; - expected[4].child_flush_dep_height_rc[0] = 1; - expected[4].flush_dep_height = 1; + expected[4].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32595,9 +32446,10 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after creating flush dependency */ - expected[4].flush_dep_par_type = entry_type; - expected[4].flush_dep_par_idx = 2; - expected[2].child_flush_dep_height_rc[1] = 2; + expected[4].flush_dep_par_type[0] = entry_type; + expected[4].flush_dep_par_idx[0] = 2; + expected[4].flush_dep_npar = 1; + expected[2].flush_dep_nchd = 2; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32676,7 +32528,7 @@ check_flush_deps_order(void) expected[0].is_protected = FALSE; expected[1].is_dirty = FALSE; expected[1].serialized = TRUE; - expected[1].flush_order = 2; + expected[1].flush_order = 1; expected[1].is_protected = FALSE; expected[2].is_dirty = FALSE; expected[2].serialized = TRUE; @@ -32684,7 +32536,7 @@ check_flush_deps_order(void) expected[2].is_protected = FALSE; expected[3].is_dirty = FALSE; expected[3].serialized = TRUE; - expected[3].flush_order = 1; + expected[3].flush_order = 2; expected[4].is_dirty = FALSE; expected[4].serialized = TRUE; expected[4].flush_order = 3; @@ -32706,9 +32558,8 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[4].flush_dep_par_type = -1; - expected[4].flush_dep_par_idx = -1; - expected[2].child_flush_dep_height_rc[1] = 1; + expected[4].flush_dep_npar = 0; + expected[2].flush_dep_nchd = 1; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32723,11 +32574,309 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[3].flush_dep_par_type = -1; - expected[3].flush_dep_par_idx = -1; + expected[3].flush_dep_npar = 0; expected[4].is_pinned = FALSE; - expected[4].child_flush_dep_height_rc[0] = 0; - expected[4].flush_dep_height = 0; + expected[4].flush_dep_nchd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 2, entry_type, 1); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[1].flush_dep_npar = 0; + expected[2].is_pinned = FALSE; + expected[2].flush_dep_nchd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[0].flush_dep_npar = 0; + expected[1].is_pinned = FALSE; + expected[1].flush_dep_nchd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + +/* Test Case #6a - Interlocked multiple parents, increasing addr order + */ + + /* Create flush dependencies between entries 0-3, with each entry a child + * of every entry with a higher number. + */ + { + protect_entry(file_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type[0] = entry_type; + expected[0].flush_dep_par_idx[0] = 1; + expected[0].flush_dep_npar = 1; + expected[1].is_protected = TRUE; + expected[1].is_pinned = TRUE; + expected[1].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + protect_entry(file_ptr, entry_type, 2); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 2, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type[1] = entry_type; + expected[0].flush_dep_par_idx[1] = 2; + expected[0].flush_dep_npar = 2; + expected[2].is_protected = TRUE; + expected[2].is_pinned = TRUE; + expected[2].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + create_flush_dependency(entry_type, 2, entry_type, 1); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 2; + expected[1].flush_dep_npar = 1; + expected[2].flush_dep_nchd = 2; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + protect_entry(file_ptr, entry_type, 3); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 3, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type[2] = entry_type; + expected[0].flush_dep_par_idx[2] = 3; + expected[0].flush_dep_npar = 3; + expected[3].is_protected = TRUE; + expected[3].is_pinned = TRUE; + expected[3].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + create_flush_dependency(entry_type, 3, entry_type, 1); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[1].flush_dep_par_type[1] = entry_type; + expected[1].flush_dep_par_idx[1] = 3; + expected[1].flush_dep_npar = 2; + expected[3].flush_dep_nchd = 2; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + create_flush_dependency(entry_type, 3, entry_type, 2); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 3; + expected[2].flush_dep_npar = 1; + expected[3].flush_dep_nchd = 3; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + } + + /* Flush the cache and verify that the entries were flushed in correct order */ + { + herr_t result; /* Generic return value */ + + add_flush_op(entry_type, 0, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + add_flush_op(entry_type, 1, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + add_flush_op(entry_type, 2, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + add_flush_op(entry_type, 3, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 1, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 2, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 3, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Mark entries 0-3 dirty, so they are flushed */ + dirty_entry(file_ptr, entry_type, 0, FALSE); + dirty_entry(file_ptr, entry_type, 1, TRUE); + dirty_entry(file_ptr, entry_type, 2, TRUE); + dirty_entry(file_ptr, entry_type, 3, FALSE); + if ( !pass ) CACHE_ERROR("dirty_entry failed") + + /* Reset 'flushed' flag & 'flush_order' value in expected array */ + expected[0].serialized = FALSE; + expected[0].flush_order = -1; + expected[1].serialized = FALSE; + expected[1].flush_order = -1; + expected[2].serialized = FALSE; + expected[2].flush_order = -1; + expected[3].serialized = FALSE; + expected[3].flush_order = -1; + + /* Reset index for tracking flush order */ + flush_order = 0; + + result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__NO_FLAGS_SET); + if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") + + /* Change expected values, and verify the status of the entries + * after destroy flush dependency + */ + expected[0].is_dirty = FALSE; + expected[0].serialized = TRUE; + expected[0].flush_order = 0; + expected[0].is_protected = FALSE; + expected[1].is_dirty = FALSE; + expected[1].serialized = TRUE; + expected[1].flush_order = 1; + expected[1].is_protected = FALSE; + expected[2].is_dirty = FALSE; + expected[2].serialized = TRUE; + expected[2].flush_order = 2; + expected[2].is_protected = FALSE; + expected[3].is_dirty = FALSE; + expected[3].serialized = TRUE; + expected[3].flush_order = 3; + expected[3].is_protected = FALSE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + + /* Destroy flush dependency between entries, in reverse order */ + { + destroy_flush_dependency(entry_type, 3, entry_type, 2); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[2].flush_dep_npar = 0; + expected[3].flush_dep_nchd = 2; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 3, entry_type, 1); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[1].flush_dep_npar = 1; + expected[3].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 3, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[0].flush_dep_npar = 2; + expected[3].is_pinned = FALSE; + expected[3].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32742,11 +32891,25 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[1].flush_dep_par_type = -1; - expected[1].flush_dep_par_idx = -1; + expected[1].flush_dep_npar = 0; + expected[2].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 2, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[0].flush_dep_npar = 1; expected[2].is_pinned = FALSE; - expected[2].child_flush_dep_height_rc[1] = 0; - expected[2].flush_dep_height = 0; + expected[2].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32761,11 +32924,325 @@ check_flush_deps_order(void) /* Change expected values, and verify the status of the entries * after destroying flush dependency */ - expected[0].flush_dep_par_type = -1; - expected[0].flush_dep_par_idx = -1; + expected[0].flush_dep_npar = 0; expected[1].is_pinned = FALSE; - expected[1].child_flush_dep_height_rc[0] = 0; - expected[1].flush_dep_height = 0; + expected[1].flush_dep_nchd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + +/* Test Case #6b - Interlocked multiple parents, decreasing addr order + */ + + /* Create flush dependencies between entries 0-3, with each entry a parent + * of every entry with a higher number. + */ + { + protect_entry(file_ptr, entry_type, 2); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 2, entry_type, 3); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[3].flush_dep_par_type[0] = entry_type; + expected[3].flush_dep_par_idx[0] = 2; + expected[3].flush_dep_npar = 1; + expected[2].is_protected = TRUE; + expected[2].is_pinned = TRUE; + expected[2].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + protect_entry(file_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 1, entry_type, 3); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[3].flush_dep_par_type[1] = entry_type; + expected[3].flush_dep_par_idx[1] = 1; + expected[3].flush_dep_npar = 2; + expected[1].is_protected = TRUE; + expected[1].is_pinned = TRUE; + expected[1].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + create_flush_dependency(entry_type, 1, entry_type, 2); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[2].flush_dep_par_type[0] = entry_type; + expected[2].flush_dep_par_idx[0] = 1; + expected[2].flush_dep_npar = 1; + expected[1].flush_dep_nchd = 2; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + protect_entry(file_ptr, entry_type, 0); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + create_flush_dependency(entry_type, 0, entry_type, 3); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[3].flush_dep_par_type[2] = entry_type; + expected[3].flush_dep_par_idx[2] = 0; + expected[3].flush_dep_npar = 3; + expected[0].is_protected = TRUE; + expected[0].is_pinned = TRUE; + expected[0].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + create_flush_dependency(entry_type, 0, entry_type, 2); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[2].flush_dep_par_type[1] = entry_type; + expected[2].flush_dep_par_idx[1] = 0; + expected[2].flush_dep_npar = 2; + expected[0].flush_dep_nchd = 2; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + create_flush_dependency(entry_type, 0, entry_type, 1); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[1].flush_dep_par_type[0] = entry_type; + expected[1].flush_dep_par_idx[0] = 0; + expected[1].flush_dep_npar = 1; + expected[0].flush_dep_nchd = 3; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + } + + /* Flush the cache and verify that the entries were flushed in correct order */ + { + herr_t result; /* Generic return value */ + + add_flush_op(entry_type, 0, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + add_flush_op(entry_type, 1, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + add_flush_op(entry_type, 2, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + add_flush_op(entry_type, 3, FLUSH_OP__ORDER, + entry_type, 0, FALSE, (size_t)0, &flush_order); + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 0, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 1, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 2, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Mark entries 0-3 dirty, so they are flushed */ + dirty_entry(file_ptr, entry_type, 0, FALSE); + dirty_entry(file_ptr, entry_type, 1, TRUE); + dirty_entry(file_ptr, entry_type, 2, TRUE); + dirty_entry(file_ptr, entry_type, 3, FALSE); + if ( !pass ) CACHE_ERROR("dirty_entry failed") + + /* Reset 'flushed' flag & 'flush_order' value in expected array */ + expected[0].serialized = FALSE; + expected[0].flush_order = -1; + expected[1].serialized = FALSE; + expected[1].flush_order = -1; + expected[2].serialized = FALSE; + expected[2].flush_order = -1; + expected[3].serialized = FALSE; + expected[3].flush_order = -1; + + /* Reset index for tracking flush order */ + flush_order = 0; + + result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, H5C__NO_FLAGS_SET); + if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") + + /* Change expected values, and verify the status of the entries + * after destroy flush dependency + */ + expected[0].is_dirty = FALSE; + expected[0].serialized = TRUE; + expected[0].flush_order = 3; + expected[0].is_protected = FALSE; + expected[1].is_dirty = FALSE; + expected[1].serialized = TRUE; + expected[1].flush_order = 2; + expected[1].is_protected = FALSE; + expected[2].is_dirty = FALSE; + expected[2].serialized = TRUE; + expected[2].flush_order = 1; + expected[2].is_protected = FALSE; + expected[3].is_dirty = FALSE; + expected[3].serialized = TRUE; + expected[3].flush_order = 0; + expected[3].is_protected = FALSE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + + /* Destroy flush dependency between entries, in reverse order */ + { + destroy_flush_dependency(entry_type, 0, entry_type, 1); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[1].flush_dep_npar = 0; + expected[0].flush_dep_nchd = 2; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 0, entry_type, 2); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[2].flush_dep_npar = 1; + expected[0].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 0, entry_type, 3); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[3].flush_dep_npar = 2; + expected[0].is_pinned = FALSE; + expected[0].flush_dep_nchd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 1, entry_type, 2); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[2].flush_dep_npar = 0; + expected[1].flush_dep_nchd = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 1, entry_type, 3); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[3].flush_dep_npar = 1; + expected[1].is_pinned = FALSE; + expected[1].flush_dep_nchd = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(entry_type, 2, entry_type, 3); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after destroying flush dependency + */ + expected[3].flush_dep_npar = 0; + expected[2].is_pinned = FALSE; + expected[2].flush_dep_nchd = 0; /* Verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -32815,13 +33292,13 @@ check_notify_cb(void) unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type: par idx: dep ref.count: dep height: order: corked:*/ - { NOTIFY_ENTRY_TYPE, 0, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 1, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 2, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 3, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 4, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { NOTIFY_ENTRY_TYPE, 0, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 1, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 2, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 3, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 4, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; TESTING("'notify' callback"); @@ -32992,6 +33469,740 @@ done: /*------------------------------------------------------------------------- + * Function: check_metadata_cork + * + * Purpose: To verify that dirty corked entries are not evicted from the cache + * but clean corked entries can be evicted from the cache. + * The min_clean_size does not have effect. + * NOTE: This is a modification of check_metadata_blizzard_absence(). + * + * Return: void + * + * Programmer: Vailin Choi + * + *------------------------------------------------------------------------- + */ +static unsigned +check_metadata_cork(hbool_t fill_via_insertion) +{ + const char * fcn_name = "check_metadata_cork"; + int entry_type = HUGE_ENTRY_TYPE; + size_t entry_size = HUGE_ENTRY_SIZE; /* 16 KB */ + H5F_t * file_ptr = NULL; + H5C_t * cache_ptr = NULL; + hbool_t show_progress = FALSE; + int32_t checkpoint = 0; + int32_t entry_idx = 0; + int32_t i; + + /* Expected deserialized status of entries depends on how they get into + * the cache. Insertions = not deserialized, protect/unprotect = deserialized. + */ + hbool_t deserialized = (hbool_t)!(fill_via_insertion); + + /* Set up the expected array. This is used to maintain a table of the + * expected status of every entry used in this test. + */ + struct expected_entry_status expected[150] = + { + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 4, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 5, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 6, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 7, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 8, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 9, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 10, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 11, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 12, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 13, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 14, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 15, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 16, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 17, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 18, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 19, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 20, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 21, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 22, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 23, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 24, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 25, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 26, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 27, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 28, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 29, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 30, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 31, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 32, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 33, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 34, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 35, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 36, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 37, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 38, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 39, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 40, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 41, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 42, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 43, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 44, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 45, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 46, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 47, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 48, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 49, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 50, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 51, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 52, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 53, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 54, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 55, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 56, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 57, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 58, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 59, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 60, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 61, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 62, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 63, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 64, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 65, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 66, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 67, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 68, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 69, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 70, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 71, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 72, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 73, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 74, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 75, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 76, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 77, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 78, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 79, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 80, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 81, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 82, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 83, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 84, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 85, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 86, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 87, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 88, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 89, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 90, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 91, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 92, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 93, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 94, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 95, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 96, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 97, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 98, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 99, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 100, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 101, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 102, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 103, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 104, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 105, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 106, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 107, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 108, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 109, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 110, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 111, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 112, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 113, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 114, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 115, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 116, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 117, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 118, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 119, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 120, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 121, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 122, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 123, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 124, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 125, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 126, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 127, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 128, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 129, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 130, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 131, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 132, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 133, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 134, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 135, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 136, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 137, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 138, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 139, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 140, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 141, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 142, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 143, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 144, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 145, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 146, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 147, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 148, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 149, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} + } ; + + pass = TRUE; + + reset_entries(); + + if (fill_via_insertion) { + + TESTING("to ensure cork/uncork metadata when inserting"); + + } else { + + TESTING("to ensure cork/uncork metadata on protect/unprotect"); + } + + if ( show_progress) /* 0 */ + HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Set up the cache. + * + * The max_cache_size should have room for 50 entries. + * The min_clean_size is half of that, or 25 entries. + */ + file_ptr = setup_cache((size_t)(50 * entry_size), /* max_cache_size */ + (size_t)(25 * entry_size)); /* min_clean_size */ + + if ( file_ptr == NULL) { + + pass = FALSE; + failure_mssg = "bad return from cache intialization.\n"; + + } + else + cache_ptr = file_ptr->shared->cache; + } + + /* Cork the cache entry type */ + cork_entry_type(file_ptr, entry_type); + + if ( show_progress) /* 1 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + /* ======================================================================== + * ======================================================================== + * Phase 1: + * + * Inserting dirty corked entries into an empty cache, until the cache + * violates the min_clean_size requirement. + * Since entries are all dirty and corked, no entry will get flushed or + * evicted. + * + * ======================================================================== + * ======================================================================== + */ + + if ( pass ) { + + /* Insert 26 entries (indexes 0 through 25) into the cache. */ + for (entry_idx = 0; entry_idx < 26; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* Change expected values, and verify the status of the entries + * after each insertion + */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; + + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + } + } + + if ( show_progress) /* 2 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + /* ======================================================================== + * ======================================================================== + * Phase 2: + * + * Inserting entries into a cache that violates the min_clean_size, + * until the cache is full. + * Since entries are all dirty and corked, no entry during this phase + * will get flushed or evicted. + * + * ======================================================================== + * ======================================================================== + */ + + if ( pass ) { + + /* Insert the 27th entry (index = 26) into the cache. */ + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* Verify the status of the entries. + * + * Expected status is that there are 27 entries in the cache, and + * all entries remain the same as before since they are all corked + * and dirty + */ + + /* entry w/ index 26 is now in the cache and dirty. */ + expected[26].in_cache = TRUE; + expected[26].is_dirty = TRUE; + expected[26].deserialized = (unsigned char)deserialized; + expected[26].is_corked = TRUE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 26, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + + if ( show_progress) /* 3 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Insert the 28th entry (index = 27) into the cache. */ + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx++, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* Verify the status of the entries. + * + * Expected status is that there are 28 entries in the cache, and + * all entries are dirty corked entries. + * + */ + expected[27].in_cache = TRUE; + expected[27].is_dirty = TRUE; + expected[27].deserialized = (unsigned char)deserialized; + expected[27].is_corked = TRUE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 27, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + + if ( show_progress) /* 4 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Fill out the rest of the cache with entries */ + /* Verify expected status of entries after each insertion */ + for (entry_idx = entry_idx; entry_idx < 50; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* + * Expected status: all entries are dirty corked entries. + */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + /* Verify that the cache is now full */ + if ( cache_ptr->cache_full != TRUE ) { + + pass = FALSE; + failure_mssg = "cache not completely filled.\n"; + } + } + + if ( show_progress) /* 5 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + /* ======================================================================== + * ======================================================================== + * Phase 3: + * Inserting entries into a cache that is completely full. + * No entry is flushed or evicted because all entries are dirty & corked. + * + * ======================================================================== + * ======================================================================== + */ + + if ( show_progress) /* 6 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Insert 50 more entries (indices 50-99) into the cache. */ + for (entry_idx = entry_idx; entry_idx < 100; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* This past inserted entry is now in the cache: dirty and corked */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; + + /* Verify this expected status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + } + + if ( show_progress) /* 7 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + + /* ======================================================================== + * ======================================================================== + * Phase 4: + * + * Flushing the entire cache, and then inserting entries into a cache + * that is completely full, but all clean. + * + * ======================================================================== + * ======================================================================== + */ + + if ( pass ) { + + /* Flush the cache. + * + * We're doing this so we can repeat the above insertions, but + * starting from a cache filled with clean entries as opposed + * to an empty cache. + */ + + flush_cache(file_ptr, /* H5F_t * file_ptr */ + FALSE, /* hbool_t destory_entries */ + FALSE, /* hbool_t dump_stats */ + FALSE); /* hbool_t dump_detailed_stats */ + + /* Verify that the cache is clean */ + verify_clean(); + + /* Verify the status of the entries. */ + /* All entries are flushed, clean but still corked */ + for (i = 0; i < 100; i++) { + expected[i].serialized = TRUE; + expected[i].is_dirty = FALSE; + expected[i].is_corked = TRUE; + } + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 0, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + if ( show_progress) /* 8 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + + if ( pass ) { + + /* Will evict 50 clean "corked" entries all at once when inserting the 100th entry */ + for(i = 0; i < 51; i++) { + expected[i].in_cache = FALSE; + expected[i].destroyed = TRUE; + expected[i].is_corked = TRUE; + } + + /* Insert the 100th entry */ + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 100, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 100); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 100, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* The 100th inserted entry is now in the cache and dirty */ + expected[100].in_cache = TRUE; + expected[100].is_dirty = TRUE; + expected[100].deserialized = (unsigned char)deserialized; + expected[100].is_corked = TRUE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 100, /* int tag */ + 150, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + + } + + if ( show_progress) /* 9 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { + + /* Insert 25 more corked entries (indexes 101 through 125) into the cache. */ + /* Clean entry will be evicted one a time */ + for (entry_idx = 101; entry_idx < 126; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* The inserted entry is now in the cache and dirty */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; + + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; + expected[entry_idx - 50].is_corked = TRUE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + } /* end for */ + + } + + + if ( show_progress) /* 10 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + + if ( pass ) { + + /* Insert the 127th entry (index = 126) into the cache. */ + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 126, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 126); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 126, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* Verify the status of the entries. */ + expected[126].in_cache = TRUE; + expected[126].is_dirty = TRUE; + expected[126].deserialized = (unsigned char)deserialized; + expected[126].is_corked = TRUE; + + expected[126 - 50].in_cache = FALSE; + expected[126 - 50].destroyed = TRUE; + expected[126 - 50].is_corked = TRUE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + 126, /* int tag */ + 150, /* int num_entries */ + expected); /* expected */ + } + + + if ( show_progress) /* 11 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + + if ( pass ) { + + /* Insert entries w/ indices 127 through 149 into the cache */ + for (entry_idx = 127; entry_idx < 150; entry_idx++) { + + if (fill_via_insertion) { + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + + } else { + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx); /* int32-t idx */ + + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + entry_idx, /* int32_t idx */ + H5C__DIRTIED_FLAG); /* unsigned int flags */ + } + + /* This past inserted entry is now in the cache, dirty and corked */ + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; + + /* Entry that is 50 entries away will be evicted since it is clean even though corked */ + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; + expected[entry_idx - 50].is_corked = TRUE; + + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + entry_idx, /* int tag */ + 150, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + } + + } + + if ( show_progress) /* 12 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + + /* We're done with testing. We can take down the cache. */ + takedown_cache(file_ptr, FALSE, FALSE); + reset_entries(); + + if ( show_progress) /* 13 */ + HDfprintf(stdout, "%s: check point %d -- pass %d\n", + fcn_name, checkpoint++, pass); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + return (unsigned)!pass; + +} /* check_metadata_cork() */ + + +/*------------------------------------------------------------------------- * Function: check_entry_deletions_during_scans() * * Purpose: With the addition of the H5C__TAKE_OWNERSHIP_FLAG, it is @@ -33070,10 +34281,8 @@ check_entry_deletions_during_scans(void) } - if ( pass ) { - takedown_cache(file_ptr, FALSE, FALSE); - } + takedown_cache(file_ptr, FALSE, FALSE); if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -33130,12 +34339,12 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par idx: dep ref.count: dep height: order: corked: */ - { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE} }; if ( pass ) { @@ -33368,44 +34577,44 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par idx: dep ref.count: dep height: order: corked: */ - { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, }; if ( pass ) { @@ -33754,40 +34963,40 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par idx: dep ref.count: dep height: order: corked: */ - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, }; H5C_auto_size_ctl_t saved_auto_size_ctl; H5C_auto_size_ctl_t test_auto_size_ctl = @@ -34218,13 +35427,13 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type: par idx: dep ref.count: dep height: order: corked: */ - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, -1, -1, {1,0,0,0,0,0}, 1, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, -1, {0,0,0,0,0,0}, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, MONSTER_ENTRY_TYPE, 0, {0,0,0,0,0,0}, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 1, 1, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {MONSTER_ENTRY_TYPE,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 1, 0, 0, -1, FALSE}, }; if ( pass ) { @@ -35132,6 +36341,8 @@ main(void) nerrs += check_flush_deps_err(); nerrs += check_flush_deps_order(); nerrs += check_notify_cb(); + nerrs += check_metadata_cork(TRUE); + nerrs += check_metadata_cork(FALSE); nerrs += check_entry_deletions_during_scans(); nerrs += check_stats(); diff --git a/test/cache_common.c b/test/cache_common.c index bfaf0b7..21f0366 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -206,6 +206,9 @@ static herr_t notify_free_icr(void *thing); static herr_t notify_notify(H5C_notify_action_t action, void *thing); +static void mark_flush_dep_dirty(test_entry_t * entry_ptr); +static void mark_flush_dep_clean(test_entry_t * entry_ptr); + /* Generic callback routines */ static herr_t get_load_size(const void *udata_ptr, size_t *image_len_ptr, int32_t entry_type); @@ -738,6 +741,8 @@ deserialize(const void *image, size_t len, void *udata, hbool_t *dirty, HDassert(entry->size == len); HDassert((entry->type == VARIABLE_ENTRY_TYPE) || (entry->size == entry_sizes[type])); HDassert(dirty != NULL); + HDassert( entry->flush_dep_npar == 0 ); + HDassert( entry->flush_dep_nchd == 0 ); /* for now *dirty will always be FALSE */ *dirty = FALSE; @@ -1334,6 +1339,11 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin */ entry->is_dirty = FALSE; + if(entry->flush_dep_npar > 0) { + HDassert(entry->flush_dep_ndirty_chd == 0); + mark_flush_dep_clean(entry); + } /* end if */ + /* since the entry is about to be written to disk, we can mark it * as initialized. */ @@ -2369,11 +2379,9 @@ reset_entries(void) base_addr[j].destroyed = FALSE; base_addr[j].expunged = FALSE; - base_addr[j].flush_dep_par_type = -1; - base_addr[j].flush_dep_par_idx = -1; - for ( k = 0; k < H5C__NUM_FLUSH_DEP_HEIGHTS; k++ ) - base_addr[j].child_flush_dep_height_rc[k] = 0; - base_addr[j].flush_dep_height = 0; + base_addr[j].flush_dep_npar = 0; + base_addr[j].flush_dep_nchd = 0; + base_addr[j].flush_dep_ndirty_chd = 0; base_addr[j].pinned_from_client = FALSE; base_addr[j].pinned_from_cache = FALSE; @@ -2473,12 +2481,16 @@ resize_entry(H5F_t * file_ptr, failure_mssg = "entry to be resized is not pinned or protected."; } else { + hbool_t was_dirty = entry_ptr->is_dirty; entry_ptr->size = new_size; result = H5C_resize_entry((void *)entry_ptr, new_size); entry_ptr->is_dirty = TRUE; + if(entry_ptr->flush_dep_npar > 0 && !was_dirty) + mark_flush_dep_dirty(entry_ptr); + if ( result != SUCCEED ) { pass = FALSE; @@ -2817,105 +2829,119 @@ verify_entry_status(H5C_t * cache_ptr, /* Check flush dependency fields */ - /* Flush dependency parent type & index */ - if ( pass ) { - if ( entry_ptr->flush_dep_par_type != expected[i].flush_dep_par_type ) { - pass = FALSE; - sprintf(msg, - "%d entry (%d, %d) flush_dep_par_type actual/expected = %d/%d.\n", - tag, - expected[i].entry_type, - expected[i].entry_index, - entry_ptr->flush_dep_par_type, - expected[i].flush_dep_par_type); - failure_mssg = msg; - } /* end if */ - } /* end if */ - if ( pass ) { - if ( entry_ptr->flush_dep_par_idx != expected[i].flush_dep_par_idx ) { - pass = FALSE; - sprintf(msg, - "%d entry (%d, %d) flush_dep_par_idx actual/expected = %d/%d.\n", - tag, - expected[i].entry_type, - expected[i].entry_index, - entry_ptr->flush_dep_par_idx, - expected[i].flush_dep_par_idx); - failure_mssg = msg; - } /* end if */ - } /* end if */ - if ( ( pass ) && ( in_cache ) && expected[i].flush_dep_par_idx >= 0 ) { - test_entry_t * par_base_addr = entries[expected[i].flush_dep_par_type]; - - if ( entry_ptr->header.flush_dep_parent != (H5C_cache_entry_t *)&(par_base_addr[expected[i].flush_dep_par_idx]) ) { - pass = FALSE; - sprintf(msg, - "%d entry (%d, %d) header flush_dep_parent actual/expected = %p/%p.\n", - tag, - expected[i].entry_type, - expected[i].entry_index, - (void *)entry_ptr->header.flush_dep_parent, - (void *)&(par_base_addr[expected[i].flush_dep_par_idx])); - failure_mssg = msg; - } /* end if */ - } /* end if */ + /* # of flush dependency parents */ + if ( pass ) { + if ( entry_ptr->flush_dep_npar != expected[i].flush_dep_npar ) { + pass = FALSE; + sprintf(msg, + "%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n", + tag, + expected[i].entry_type, + expected[i].entry_index, + entry_ptr->flush_dep_npar, + expected[i].flush_dep_npar); + failure_mssg = msg; + } /* end if */ + } /* end if */ + if ( ( pass ) && ( in_cache ) ) { + if ( entry_ptr->header.flush_dep_nparents != expected[i].flush_dep_npar ) { + pass = FALSE; + sprintf(msg, + "%d entry (%d, %d) header flush_dep_nparents actual/expected = %u/%u.\n", + tag, + expected[i].entry_type, + expected[i].entry_index, + entry_ptr->header.flush_dep_nparents, + expected[i].flush_dep_npar); + failure_mssg = msg; + } /* end if */ + } /* end if */ - /* Flush dependency child ref. counts */ - for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) { - if ( pass ) { - if ( entry_ptr->child_flush_dep_height_rc[u] != expected[i].child_flush_dep_height_rc[u] ) { + /* Flush dependency parent type & index. Note this algorithm assumes + * that the parents in both arrays are in the same order. */ + if ( pass ) { + for ( u = 0; u < entry_ptr->flush_dep_npar; u++ ) { + if ( entry_ptr->flush_dep_par_type[u] != expected[i].flush_dep_par_type[u] ) { pass = FALSE; sprintf(msg, - "%d entry (%d, %d) child_flush_dep_height_rc[%u] actual/expected = %llu/%llu.\n", + "%d entry (%d, %d) flush_dep_par_type[%u] actual/expected = %d/%d.\n", tag, expected[i].entry_type, expected[i].entry_index, u, - (unsigned long long)(entry_ptr->child_flush_dep_height_rc[u]), - (unsigned long long)expected[i].child_flush_dep_height_rc[u]); + entry_ptr->flush_dep_par_type[u], + expected[i].flush_dep_par_type[u]); failure_mssg = msg; } /* end if */ - } /* end if */ - if ( ( pass ) && ( in_cache ) ) { - if ( entry_ptr->header.child_flush_dep_height_rc[u] != expected[i].child_flush_dep_height_rc[u] ) { + } /* end for */ + } /* end if */ + if ( pass ) { + for ( u = 0; u < entry_ptr->flush_dep_npar; u++ ) { + if ( entry_ptr->flush_dep_par_idx[u] != expected[i].flush_dep_par_idx[u] ) { pass = FALSE; sprintf(msg, - "%d entry (%d, %d) header child_flush_dep_height_rc[%u] actual/expected = %llu/%llu.\n", + "%d entry (%d, %d) flush_dep_par_idx[%u] actual/expected = %d/%d.\n", + tag, + expected[i].entry_type, + expected[i].entry_index, + u, + entry_ptr->flush_dep_par_idx[u], + expected[i].flush_dep_par_idx[u]); + failure_mssg = msg; + } /* end if */ + } /* end for */ + } /* end if */ + + /* # of flush dependency children and dirty children */ + if ( pass ) { + if ( entry_ptr->flush_dep_nchd != expected[i].flush_dep_nchd ) { + pass = FALSE; + sprintf(msg, + "%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n", tag, expected[i].entry_type, expected[i].entry_index, - u, - (unsigned long long)entry_ptr->header.child_flush_dep_height_rc[u], - (unsigned long long)expected[i].child_flush_dep_height_rc[u]); - failure_mssg = msg; - } /* end if */ + entry_ptr->flush_dep_nchd, + expected[i].flush_dep_nchd); + failure_mssg = msg; } /* end if */ - } /* end for */ - - /* Flush dependency height */ + } /* end if */ + if ( ( pass ) && ( in_cache ) ) { + if ( entry_ptr->header.flush_dep_nchildren != expected[i].flush_dep_nchd ) { + pass = FALSE; + sprintf(msg, + "%d entry (%d, %d) header flush_dep_nchildren actual/expected = %u/%u.\n", + tag, + expected[i].entry_type, + expected[i].entry_index, + entry_ptr->header.flush_dep_nchildren, + expected[i].flush_dep_nchd); + failure_mssg = msg; + } /* end if */ + } /* end if */ if ( pass ) { - if ( entry_ptr->flush_dep_height != expected[i].flush_dep_height ) { + if ( entry_ptr->flush_dep_ndirty_chd != expected[i].flush_dep_ndirty_chd ) { pass = FALSE; sprintf(msg, - "%d entry (%d, %d) flush_dep_height actual/expected = %u/%u.\n", + "%d entry (%d, %d) flush_dep_ndirty_chd actual/expected = %u/%u.\n", tag, expected[i].entry_type, expected[i].entry_index, - entry_ptr->flush_dep_height, - expected[i].flush_dep_height); + entry_ptr->flush_dep_ndirty_chd, + expected[i].flush_dep_ndirty_chd); failure_mssg = msg; } /* end if */ } /* end if */ if ( ( pass ) && ( in_cache ) ) { - if ( entry_ptr->header.flush_dep_height != expected[i].flush_dep_height ) { + if ( entry_ptr->header.flush_dep_ndirty_children != expected[i].flush_dep_ndirty_chd ) { pass = FALSE; sprintf(msg, - "%d entry (%d, %d) header flush_dep_height actual/expected = %u/%u.\n", - tag, - expected[i].entry_type, - expected[i].entry_index, - entry_ptr->header.flush_dep_height, - expected[i].flush_dep_height); + "%d entry (%d, %d) header flush_dep_ndirty_children actual/expected = %u/%u.\n", + tag, + expected[i].entry_type, + expected[i].entry_index, + entry_ptr->header.flush_dep_ndirty_children, + expected[i].flush_dep_ndirty_chd); failure_mssg = msg; } /* end if */ } /* end if */ @@ -3656,6 +3682,8 @@ insert_entry(H5F_t * file_ptr, HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); HDassert( !(entry_ptr->is_protected) ); + HDassert( entry_ptr->flush_dep_npar == 0 ); + HDassert( entry_ptr->flush_dep_nchd == 0 ); insert_pinned = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0 ); @@ -3742,6 +3770,7 @@ mark_entry_dirty(int32_t type, herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr; + hbool_t was_dirty; if ( pass ) { @@ -3757,8 +3786,12 @@ mark_entry_dirty(int32_t type, HDassert( entry_ptr->header.is_protected || entry_ptr->header.is_pinned ); + was_dirty = entry_ptr->is_dirty; entry_ptr->is_dirty = TRUE; + if(entry_ptr->flush_dep_npar > 0 && !was_dirty) + mark_flush_dep_dirty(entry_ptr); + result = H5C_mark_entry_dirty((void *)entry_ptr); if ( ( result < 0 ) || @@ -3850,11 +3883,14 @@ move_entry(H5C_t * cache_ptr, } if ( ! done ) { + hbool_t was_dirty = entry_ptr->is_dirty; entry_ptr->is_dirty = TRUE; - result = H5C_move_entry(cache_ptr, &(types[type]), - old_addr, new_addr); + if(entry_ptr->flush_dep_npar > 0 && !was_dirty) + mark_flush_dep_dirty(entry_ptr); + + result = H5C_move_entry(cache_ptr, &(types[type]), old_addr, new_addr); } if ( ! done ) { @@ -4243,9 +4279,15 @@ unprotect_entry(H5F_t * file_ptr, HDassert ( ( ! pin_flag_set ) || ( ! (entry_ptr->is_pinned) ) ); HDassert ( ( ! unpin_flag_set ) || ( entry_ptr->is_pinned ) ); - if(flags & H5C__DIRTIED_FLAG) + if(flags & H5C__DIRTIED_FLAG) { + hbool_t was_dirty = entry_ptr->is_dirty; + entry_ptr->is_dirty = TRUE; + if(entry_ptr->flush_dep_npar > 0 && !was_dirty) + mark_flush_dep_dirty(entry_ptr); + } /* end if */ + result = H5C_unprotect(file_ptr, H5AC_ind_read_dxpl_id, entry_ptr->addr, (void *)entry_ptr, flags); @@ -5722,43 +5764,26 @@ create_flush_dependency(int32_t par_type, if ( ( result < 0 ) || ( !par_entry_ptr->header.is_pinned ) || - ( !(par_entry_ptr->header.flush_dep_height > 0) ) ) { + ( !(par_entry_ptr->header.flush_dep_nchildren > 0) ) ) { pass = FALSE; failure_mssg = "error in H5C_create_flush_dependency()."; } /* end if */ /* Update information about entries */ - chd_entry_ptr->flush_dep_par_type = par_type; - chd_entry_ptr->flush_dep_par_idx = par_idx; - par_entry_ptr->child_flush_dep_height_rc[chd_entry_ptr->flush_dep_height]++; + HDassert( chd_entry_ptr->flush_dep_npar < MAX_FLUSH_DEP_PARS ); + chd_entry_ptr->flush_dep_par_type[chd_entry_ptr->flush_dep_npar] = par_type; + chd_entry_ptr->flush_dep_par_idx[chd_entry_ptr->flush_dep_npar] = par_idx; + chd_entry_ptr->flush_dep_npar++; + par_entry_ptr->flush_dep_nchd++; + if(chd_entry_ptr->is_dirty || chd_entry_ptr->flush_dep_ndirty_chd > 0) { + HDassert(par_entry_ptr->flush_dep_ndirty_chd < par_entry_ptr->flush_dep_nchd); + par_entry_ptr->flush_dep_ndirty_chd++; + } /* end if */ par_entry_ptr->pinned_from_cache = TRUE; if( !par_is_pinned ) par_entry_ptr->is_pinned = TRUE; - - /* Check flush dependency heights */ - while(chd_entry_ptr->flush_dep_height >= par_entry_ptr->flush_dep_height) { - unsigned prev_par_flush_dep_height = par_entry_ptr->flush_dep_height; /* Save the previous height */ - - par_entry_ptr->flush_dep_height = chd_entry_ptr->flush_dep_height + 1; - - /* Check for parent entry being in flush dependency relationship */ - if(par_entry_ptr->flush_dep_par_idx >= 0) { - /* Move parent & child entries up the flushd dependency 'chain' */ - chd_entry_ptr = par_entry_ptr; - par_base_addr = entries[chd_entry_ptr->flush_dep_par_type]; - par_entry_ptr = &(par_base_addr[chd_entry_ptr->flush_dep_par_idx]); - - /* Adjust the ref. counts in new parent */ - HDassert(par_entry_ptr->child_flush_dep_height_rc[prev_par_flush_dep_height] > 0); - par_entry_ptr->child_flush_dep_height_rc[prev_par_flush_dep_height]--; - par_entry_ptr->child_flush_dep_height_rc[chd_entry_ptr->flush_dep_height]++; - } /* end if */ - } /* end if */ } /* end if */ - - return; - } /* create_flush_dependency() */ @@ -5793,18 +5818,16 @@ destroy_flush_dependency(int32_t par_type, test_entry_t * par_entry_ptr; /* Parent entry */ test_entry_t * chd_base_addr; /* Base entry of child's entry array */ test_entry_t * chd_entry_ptr; /* Child entry */ - unsigned chd_flush_dep_height; /* Child flush dep. height */ + unsigned i; /* Local index variable */ /* Get parent entry */ par_base_addr = entries[par_type]; par_entry_ptr = &(par_base_addr[par_idx]); /* Sanity check parent entry */ - HDassert( par_entry_ptr->index == par_idx ); - HDassert( par_entry_ptr->type == par_type ); HDassert( par_entry_ptr->is_pinned ); HDassert( par_entry_ptr->pinned_from_cache ); - HDassert( par_entry_ptr->flush_dep_height > 0 ); + HDassert( par_entry_ptr->flush_dep_nchd > 0 ); HDassert( par_entry_ptr == par_entry_ptr->self ); /* Get parent entry */ @@ -5814,7 +5837,7 @@ destroy_flush_dependency(int32_t par_type, /* Sanity check child entry */ HDassert( chd_entry_ptr->index == chd_idx ); HDassert( chd_entry_ptr->type == chd_type ); - HDassert( chd_entry_ptr->flush_dep_height < par_entry_ptr->flush_dep_height ); + HDassert( chd_entry_ptr->flush_dep_npar > 0 ); HDassert( chd_entry_ptr == chd_entry_ptr->self ); if ( H5C_destroy_flush_dependency(par_entry_ptr, chd_entry_ptr) < 0 ) { @@ -5823,54 +5846,122 @@ destroy_flush_dependency(int32_t par_type, } /* end if */ /* Update information about entries */ - chd_entry_ptr->flush_dep_par_type = -1; - chd_entry_ptr->flush_dep_par_idx = -1; - par_entry_ptr->child_flush_dep_height_rc[chd_entry_ptr->flush_dep_height]--; - - /* Check flush dependency heights */ - chd_flush_dep_height = chd_entry_ptr->flush_dep_height; - while( 0 == par_entry_ptr->child_flush_dep_height_rc[chd_flush_dep_height] ) { - unsigned prev_par_flush_dep_height = par_entry_ptr->flush_dep_height; /* Save the previous height */ - int i; /* Local index variable */ - - /* Check for new flush dependency height of parent */ - for(i = (H5C__NUM_FLUSH_DEP_HEIGHTS - 1); i >= 0; i--) - if(par_entry_ptr->child_flush_dep_height_rc[i] > 0) - break; - - HDassert((i + 1) <= (int)prev_par_flush_dep_height); - - if((unsigned)(i + 1) < prev_par_flush_dep_height) { - par_entry_ptr->flush_dep_height = (unsigned)(i + 1); - if(i < 0) { - par_entry_ptr->pinned_from_cache = FALSE; - par_entry_ptr->is_pinned = par_entry_ptr->pinned_from_client; - } /* end if */ - - /* Check for parent entry being in flush dependency relationship */ - if(par_entry_ptr->flush_dep_par_idx >= 0) { - /* Move parent & child entries up the flushd dependency 'chain' */ - chd_entry_ptr = par_entry_ptr; - par_base_addr = entries[chd_entry_ptr->flush_dep_par_type]; - par_entry_ptr = &(par_base_addr[chd_entry_ptr->flush_dep_par_idx]); - - /* Adjust the ref. counts in new parent */ - HDassert(par_entry_ptr->child_flush_dep_height_rc[prev_par_flush_dep_height] > 0); - par_entry_ptr->child_flush_dep_height_rc[prev_par_flush_dep_height]--; - par_entry_ptr->child_flush_dep_height_rc[chd_entry_ptr->flush_dep_height]++; - chd_flush_dep_height = prev_par_flush_dep_height; - } /* end if */ - else - break; - } /* end if */ - else + for(i=0; i<chd_entry_ptr->flush_dep_npar; i++) + if(chd_entry_ptr->flush_dep_par_type[i] == par_type + && chd_entry_ptr->flush_dep_par_idx[i] == par_idx) break; - } /* end while */ + HDassert(i < chd_entry_ptr->flush_dep_npar); + if(i < chd_entry_ptr->flush_dep_npar - 1) + HDmemmove(&chd_entry_ptr->flush_dep_par_type[i], + &chd_entry_ptr->flush_dep_par_type[i+1], + (chd_entry_ptr->flush_dep_npar - i - 1) + * sizeof(chd_entry_ptr->flush_dep_par_type[0])); + if(i < chd_entry_ptr->flush_dep_npar - 1) + HDmemmove(&chd_entry_ptr->flush_dep_par_idx[i], + &chd_entry_ptr->flush_dep_par_idx[i+1], + (chd_entry_ptr->flush_dep_npar - i - 1) + * sizeof(chd_entry_ptr->flush_dep_par_idx[0])); + chd_entry_ptr->flush_dep_npar--; + par_entry_ptr->flush_dep_nchd--; + if(par_entry_ptr->flush_dep_nchd == 0) { + par_entry_ptr->pinned_from_cache = FALSE; + par_entry_ptr->is_pinned = par_entry_ptr->pinned_from_client; + } /* end if */ + if(chd_entry_ptr->is_dirty || chd_entry_ptr->flush_dep_ndirty_chd > 0) { + HDassert(par_entry_ptr->flush_dep_ndirty_chd > 0); + par_entry_ptr->flush_dep_ndirty_chd--; + if(!par_entry_ptr->is_dirty + && par_entry_ptr->flush_dep_ndirty_chd == 0) + mark_flush_dep_clean(par_entry_ptr); + } /* end if */ } /* end if */ +} /* destroy_flush_dependency() */ - return; + +/*------------------------------------------------------------------------- + * Function: mark_flush_dep_dirty() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming dirty or having its flush_dep_ndirty_children + * increased from 0. + * + * Return: <none> + * + * Programmer: Neil Fortner + * 12/4/12 + * + *------------------------------------------------------------------------- + */ +static void +mark_flush_dep_dirty(test_entry_t * entry_ptr) +{ + /* Sanity checks */ + HDassert(entry_ptr); + + /* Iterate over the parent entries */ + if(entry_ptr->flush_dep_npar) { + test_entry_t *par_base_addr; /* Base entry of parent's entry array */ + test_entry_t *par_entry_ptr; /* Parent entry */ + unsigned u; /* Local index variable */ + + for(u = 0; u < entry_ptr->flush_dep_npar; u++) { + /* Get parent entry */ + par_base_addr = entries[entry_ptr->flush_dep_par_type[u]]; + par_entry_ptr = &(par_base_addr[entry_ptr->flush_dep_par_idx[u]]); + + /* Sanity check */ + HDassert(par_entry_ptr->flush_dep_ndirty_chd + < par_entry_ptr->flush_dep_nchd); + + /* Adjust the parent's number of dirty children */ + par_entry_ptr->flush_dep_ndirty_chd++; + } /* end for */ + } /* end if */ +} /* end mark_flush_dep_dirty() */ -} /* destroy_flush_dependency() */ + +/*------------------------------------------------------------------------- + * Function: mark_flush_dep_clean() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming clean or having its flush_dep_ndirty_children + * reduced to 0. + * + * Return: <none> + * + * Programmer: Neil Fortner + * 12/4/12 + * + *------------------------------------------------------------------------- + */ +static void +mark_flush_dep_clean(test_entry_t * entry_ptr) +{ + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(!entry_ptr->is_dirty && entry_ptr->flush_dep_ndirty_chd == 0); + + /* Iterate over the parent entries */ + if(entry_ptr->flush_dep_npar) { + test_entry_t *par_base_addr; /* Base entry of parent's entry array */ + test_entry_t *par_entry_ptr; /* Parent entry */ + unsigned u; /* Local index variable */ + + for(u = 0; u < entry_ptr->flush_dep_npar; u++) { + /* Get parent entry */ + par_base_addr = entries[entry_ptr->flush_dep_par_type[u]]; + par_entry_ptr = &(par_base_addr[entry_ptr->flush_dep_par_idx[u]]); + + /* Sanity check */ + HDassert(par_entry_ptr->flush_dep_ndirty_chd > 0); + + /* Adjust the parent's number of dirty children */ + par_entry_ptr->flush_dep_ndirty_chd--; + } /* end for */ + } /* end if */ +} /* end mark_flush_dep_clean() */ /*** H5AC level utility functions ***/ @@ -6146,7 +6237,7 @@ check_and_validate_cache_size(hid_t file_id, } /* check_and_validate_cache_size() */ -hbool_t +H5_ATTR_PURE hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a, const H5C_auto_size_ctl_t *b, hbool_t compare_init) diff --git a/test/cache_common.h b/test/cache_common.h index 1d20c29..0e4966c 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -152,6 +152,9 @@ * cache entry. */ +#define MAX_FLUSH_DEP_PARS 8 /* Maximum number of flush dependency + * parents in the test */ + typedef struct flush_op { int op_code; /* integer op code indicating the @@ -340,13 +343,11 @@ typedef struct test_entry_t hbool_t expunged; /* entry has been expunged since the * last time it was reset. */ - int flush_dep_par_type; /* Entry type of flush dependency parent */ - int flush_dep_par_idx; /* Index of flush dependency parent */ - uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; - /* flush dependency heights of flush - * dependency children - */ - unsigned flush_dep_height; /* flush dependency height of entry */ + int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */ + int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */ + unsigned flush_dep_npar; /* Number of flush dependency parents */ + unsigned flush_dep_nchd; /* Number of flush dependency children */ + unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children (including granchildren, etc.) */ hbool_t pinned_from_client; /* entry was pinned by client call */ hbool_t pinned_from_cache; /* entry was pinned by cache internally */ unsigned flush_order; /* Order that entry was flushed in */ @@ -520,13 +521,11 @@ struct expected_entry_status hbool_t deserialized; hbool_t serialized; hbool_t destroyed; - int flush_dep_par_type; /* Entry type of flush dependency parent */ - int flush_dep_par_idx; /* Index of flush dependency parent */ - uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; - /* flush dependency heights of flush - * dependency children - */ - unsigned flush_dep_height; /* flush dependency height of entry */ + int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */ + int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */ + unsigned flush_dep_npar; /* Number of flush dependency parents */ + unsigned flush_dep_nchd; /* Number of flush dependency children */ + unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children */ int flush_order; /* flush order of entry */ unsigned char is_corked; /* cork status of entry */ }; diff --git a/test/dsets.c b/test/dsets.c index 2bc162c..bca57e5 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -666,7 +666,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl) f = HDopen(filename, O_RDONLY, 0); HDlseek(f, (off_t)offset, SEEK_SET); - HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2); + if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) + goto error; /* Check that the values read are the same as the values written */ for(i = 0; i < DSET_DIM1; i++) { diff --git a/test/dt_arith.c b/test/dt_arith.c index bd8babe..639ad52 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -127,39 +127,39 @@ static int without_hardware_g = 0; /*positive values, ascending order. VALUE1 starts from 00000001, to 00000010, until 10000000*/ \ /*VALUE2 ascends from 00000000, to 00000011, 00000111,..., until 11111111.*/ \ for(n=0; n<SRC_PREC; n++) { \ - if(value1<=SRC_MAX && value1>=SRC_MIN) { \ - memcpy(buf_p, &value1, SRC_SIZE); \ - memcpy(saved_p, &value1, SRC_SIZE); \ + { \ + HDmemcpy(buf_p, &value1, SRC_SIZE); \ + HDmemcpy(saved_p, &value1, SRC_SIZE); \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } \ - if(value2<=SRC_MAX && value2>=SRC_MIN) { \ - memcpy(buf_p, &value2, SRC_SIZE); \ - memcpy(saved_p, &value2, SRC_SIZE); \ + { \ + HDmemcpy(buf_p, &value2, SRC_SIZE); \ + HDmemcpy(saved_p, &value2, SRC_SIZE); \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } \ \ if(n<SRC_PREC-2) { \ - value1 <<= 1; \ - value2 = (value1 - 1) | value1; \ + value1 = (TYPE)(value1 << 1); \ + value2 = (TYPE)((value1 - 1) | value1); \ } else if(n==SRC_PREC-2) { /*to avoid overflow of negative values for signed integer*/ \ - value1 <<= 1; \ - value2 = (~value1) | value1; \ + value1 = (TYPE)(value1 << 1); \ + value2 = (TYPE)((~value1) | value1); \ } \ } \ \ /* negative values for signed; descending positive values for unsigned */ \ /* VALUE2 descends from 11111111 to 11111110, 11111100, ..., until 10000000. */ \ for(n=0; n<SRC_PREC-1; n++) { \ - if(value2<=SRC_MAX && value2>=SRC_MIN) { \ - memcpy(buf_p, &value2, SRC_SIZE); \ - memcpy(saved_p, &value2, SRC_SIZE); \ + { \ + HDmemcpy(buf_p, &value2, SRC_SIZE); \ + HDmemcpy(saved_p, &value2, SRC_SIZE); \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } \ if(n<SRC_PREC-1) \ - value2 <<= 1; \ + value2 = (TYPE)(value2 << 1); \ } \ } @@ -242,15 +242,15 @@ static int without_hardware_g = 0; value2 = -SRC_MIN; \ for(n=0; n<num_norm; n++) { \ if(value1<SRC_MAX) { /*positive*/ \ - memcpy(buf_p, &value1, SRC_SIZE); \ - memcpy(saved_p, &value1, SRC_SIZE); \ + HDmemcpy(buf_p, &value1, SRC_SIZE); \ + HDmemcpy(saved_p, &value1, SRC_SIZE); \ value1 *= multiply; \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } \ if(value2>-SRC_MAX) { /*negative*/ \ - memcpy(buf_p, &value2, SRC_SIZE); \ - memcpy(saved_p, &value2, SRC_SIZE); \ + HDmemcpy(buf_p, &value2, SRC_SIZE); \ + HDmemcpy(saved_p, &value2, SRC_SIZE); \ value2 *= multiply; \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ @@ -258,14 +258,14 @@ static int without_hardware_g = 0; } \ \ value1 = SRC_MAX; /*maximal value*/ \ - memcpy(buf_p, &value1, SRC_SIZE); \ - memcpy(saved_p, &value1, SRC_SIZE); \ + HDmemcpy(buf_p, &value1, SRC_SIZE); \ + HDmemcpy(saved_p, &value1, SRC_SIZE); \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ \ value2 = -SRC_MAX; /*negative value*/ \ - memcpy(buf_p, &value2, SRC_SIZE); \ - memcpy(saved_p, &value2, SRC_SIZE); \ + HDmemcpy(buf_p, &value2, SRC_SIZE); \ + HDmemcpy(saved_p, &value2, SRC_SIZE); \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } @@ -290,37 +290,37 @@ static int without_hardware_g = 0; HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ \ - tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ - tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ + tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ + tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ \ buf_p = BUF; \ saved_p = SAVED; \ \ /*Denormalized values. Exponent is 0. Let mantissa starts from 00000001, 00000011, \ *00000111,..., until 11111111.*/ \ - memset(tmp1, 0, SRC_SIZE); \ - memset(tmp2, 0, SRC_SIZE); \ - H5T__bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \ + HDmemset(tmp1, 0, SRC_SIZE); \ + HDmemset(tmp2, 0, SRC_SIZE); \ + H5T__bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \ for(n=0; n<SRC_MANT_DIG-1; n++) { \ - H5T__bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \ + H5T__bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \ CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \ - memcpy(buf_p, tmp1, SRC_SIZE); \ - memcpy(saved_p, tmp1, SRC_SIZE); \ + HDmemcpy(buf_p, tmp1, SRC_SIZE); \ + HDmemcpy(saved_p, tmp1, SRC_SIZE); \ CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ \ /*negative values*/ \ - H5T__bit_set (tmp2, n, (size_t)1, TRUE); \ + H5T__bit_set (tmp2, n, (size_t)1, TRUE); \ CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \ - memcpy(buf_p, tmp2, SRC_SIZE); \ - memcpy(saved_p, tmp2, SRC_SIZE); \ + HDmemcpy(buf_p, tmp2, SRC_SIZE); \ + HDmemcpy(saved_p, tmp2, SRC_SIZE); \ CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } \ - HDfree(tmp1); \ - HDfree(tmp2); \ + HDfree(tmp1); \ + HDfree(tmp2); \ } /* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity, @@ -342,50 +342,50 @@ static int without_hardware_g = 0; SAVED = (unsigned char*)aligned_malloc( NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ - value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \ + value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \ \ buf_p = BUF; \ \ /* +0 */ \ - H5T__bit_set(value, (size_t)0, SRC_PREC, FALSE); \ - memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ + H5T__bit_set(value, (size_t)0, SRC_PREC, FALSE); \ + HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ buf_p += SRC_SIZE; \ \ for(n=0; n<2; n++) { \ if(n==1) { \ memset(value, 0, SRC_SIZE*sizeof(unsigned char)); \ /* -0 */ \ - H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \ + H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change order for big endian*/ \ - HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ + HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change back the order for bit operation*/ \ buf_p += SRC_SIZE; \ } \ \ /* +/-infinity */ \ - H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \ + H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \ - HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ + HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \ buf_p += SRC_SIZE; \ \ /* +/-SNaN */ \ - H5T__bit_set(value, (size_t)0, (size_t)1, TRUE); \ + H5T__bit_set(value, (size_t)0, (size_t)1, TRUE); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \ - HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \ + HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \ buf_p += SRC_SIZE; \ \ /* +/-QNaN */ \ - H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \ + H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \ - HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ + HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \ buf_p += SRC_SIZE; \ } \ \ - HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ - HDfree(value); \ + HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ + HDfree(value); \ } void some_dummy_func(float x); diff --git a/test/fheap.c b/test/fheap.c index 558cb44..a59c27f 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -498,7 +498,7 @@ get_del_string(const fheap_test_param_t *tparam) * *------------------------------------------------------------------------- */ -static size_t +H5_ATTR_PURE static size_t get_fill_size(const fheap_test_param_t *tparam) { switch(tparam->fill) { diff --git a/test/freespace.c b/test/freespace.c index 2023724..6e680c3 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -221,7 +221,7 @@ TEST_sect_init_cls(H5FS_section_class_t *cls, void *_udata) * Check if the two sections can be merged: * true if second section adjoins the first section */ -static herr_t +H5_ATTR_PURE static herr_t TEST_sect_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata) { diff --git a/test/h5test.c b/test/h5test.c index 39731a2..6267137 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -767,15 +767,15 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, * *------------------------------------------------------------------------- */ -const char * +H5_ATTR_PURE const char * h5_rmprefix(const char *filename) { const char *ret_ptr; if ((ret_ptr = HDstrstr(filename, ":")) == NULL) - ret_ptr = filename; + ret_ptr = filename; else - ret_ptr++; + ret_ptr++; return(ret_ptr); } diff --git a/test/tcheck_version.c b/test/tcheck_version.c index a75d642..1abab69 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -104,7 +104,7 @@ parse(int ac, char **av) * some systems may produce extra messages and/or produce core dump. * This tries to eliminate those side effects. */ -void +H5_ATTR_NORETURN void abort_intercept (int H5_ATTR_UNUSED sig) { HDexit(6); diff --git a/test/tchecksum.c b/test/tchecksum.c index 350a218..cb7c023 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -247,7 +247,7 @@ test_checksum(void) * *------------------------------------------------------------------------- */ -void +H5_ATTR_PURE void cleanup_checksum(void) { /* no file to clean */ diff --git a/test/tconfig.c b/test/tconfig.c index 3ae26c2..1604c61 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -86,7 +86,7 @@ test_configure(void) * *------------------------------------------------------------------------- */ -void +H5_ATTR_PURE void cleanup_configure(void) { /* no file to clean */ @@ -109,7 +109,7 @@ cleanup_configure(void) * *------------------------------------------------------------------------- */ -void +H5_ATTR_PURE void test_config_ctypes(void) { /* standard C89 basic types */ @@ -218,7 +218,7 @@ test_config_ctypes(void) * *------------------------------------------------------------------------- */ -void +H5_ATTR_PURE void test_exit_definitions(void) { /* Verify the EXIT_SUCCESS and EXIT_FAILURE are 0 and 1 respectively. */ diff --git a/test/testframe.c b/test/testframe.c index daa27c5..1c56f88 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -365,7 +365,7 @@ void TestCleanup(void) /* * Retrieve the verbosity level for the testing framework */ -int GetTestVerbosity(void) +H5_ATTR_PURE int GetTestVerbosity(void) { return(TestVerbosity); } @@ -452,7 +452,7 @@ int SetTestExpress(int newval) * Retrieve Summary request value. * 0 means no summary, 1 means yes. */ -int GetTestSummary(void) +H5_ATTR_PURE int GetTestSummary(void) { return(Summary); } @@ -461,7 +461,7 @@ int GetTestSummary(void) * Retrieve Cleanup request value. * 0 means no Cleanup, 1 means yes. */ -int GetTestCleanup(void) +H5_ATTR_PURE int GetTestCleanup(void) { return(CleanUp); } @@ -498,7 +498,7 @@ void ParseTestVerbosity(char *argv) /* * Retrieve the number of testing errors for the testing framework */ -int GetTestNumErrs(void) +H5_ATTR_PURE int GetTestNumErrs(void) { return(num_errs); } @@ -516,7 +516,7 @@ void IncTestNumErrs(void) /* * Retrieve the current Test Parameters pointer. */ -const void *GetTestParameters(void) +H5_ATTR_PURE const void *GetTestParameters(void) { return(Test_parameters); } diff --git a/test/titerate.c b/test/titerate.c index 20a3940..f61842a 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -72,7 +72,7 @@ herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo, ** iter_strcmp(): String comparison routine for qsort ** ****************************************************************/ -int iter_strcmp(const void *s1, const void *s2) +H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2) { return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2)); } @@ -527,7 +527,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) ** iter_strcmp2(): String comparison routine for qsort ** ****************************************************************/ -int iter_strcmp2(const void *s1, const void *s2) +H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2) { return(HDstrcmp((const char *)s1, (const char *)s2)); } /* end iter_strcmp2() */ diff --git a/test/tmeta.c b/test/tmeta.c index a7fd688..e69c057 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -123,7 +123,7 @@ test_metadata(void) * *------------------------------------------------------------------------- */ -void +H5_ATTR_PURE void cleanup_metadata(void) { /* no file to clean */ diff --git a/test/tselect.c b/test/tselect.c index 670406d..73b8015 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -2630,7 +2630,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, ** a selected or an unselected checker. ** ****************************************************************/ -static hbool_t +H5_ATTR_PURE static hbool_t test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr, unsigned rank, unsigned edge_size, unsigned checker_edge_size, uint16_t first_expected_val, hbool_t buf_starts_in_checker) diff --git a/test/ttsafe.c b/test/ttsafe.c index d3c5cfb..1fb9446 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -45,7 +45,7 @@ #define NAME_OFFSET 6 /* offset for "name<num>" */ /* pre-condition: num must be a non-negative number */ -static unsigned +H5_ATTR_PURE static unsigned num_digits(int num) { unsigned u; diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index dec2eee..cc3f405 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -113,7 +113,7 @@ void tts_acreate(void) * with the dataset */ for(i = 0; i < NUM_THREADS; i++) { - attrib_data = HDmalloc(sizeof(ttsafe_name_data_t)); + attrib_data = (ttsafe_name_data_t *)HDmalloc(sizeof(ttsafe_name_data_t)); attrib_data->dataset = dataset; attrib_data->datatype = datatype; attrib_data->dataspace = dataspace; @@ -170,7 +170,7 @@ void *tts_acreate_thread(void *client_data) H5P_DEFAULT, H5P_DEFAULT); /* Write data to the attribute */ - attribute_data = HDmalloc(sizeof(int)); + attribute_data = (int *)HDmalloc(sizeof(int)); *attribute_data = attrib_data->current_index; H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); H5Aclose(attribute); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 8cf29f3..aaf18de 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -88,7 +88,7 @@ void pause_proc(void) } printf("waiting(%ds) for file %s ...\n", time_int, greenlight); fflush(stdout); - HDsleep(time_int); + HDsleep(time_int); } MPI_Barrier(MPI_COMM_WORLD); } diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index 9947168..f3a0d7a 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -90,7 +90,7 @@ leave(int ret) *------------------------------------------------------------------------- */ static void -usage (const char *prog) +usage (void) { FLUSHSTREAM(rawoutstream); PRINTVALSTREAM(rawoutstream, "\n"); @@ -253,7 +253,7 @@ main (int argc, const char *argv[]) /* Check for no command line parameters */ if(argc == 1) { - usage(h5tools_getprogname()); + usage(); leave(EXIT_FAILURE); } /* end if */ @@ -270,14 +270,14 @@ main (int argc, const char *argv[]) /* validate flag */ if (parse_flag(opt_arg,&flag)<0) { - usage(h5tools_getprogname()); + usage(); leave(EXIT_FAILURE); } str_flag = HDstrdup(opt_arg); break; case 'h': - usage(h5tools_getprogname()); + usage(); leave(EXIT_SUCCESS); break; @@ -311,7 +311,7 @@ main (int argc, const char *argv[]) break; default: - usage(h5tools_getprogname()); + usage(); leave(EXIT_FAILURE); } } /* end of while */ @@ -323,28 +323,28 @@ main (int argc, const char *argv[]) if (fname_src==NULL) { error_msg("Input file name missing\n"); - usage(h5tools_getprogname()); + usage(); leave(EXIT_FAILURE); } if (fname_dst==NULL) { error_msg("Output file name missing\n"); - usage(h5tools_getprogname()); + usage(); leave(EXIT_FAILURE); } if (oname_src==NULL) { error_msg("Source object name missing\n"); - usage(h5tools_getprogname()); + usage(); leave(EXIT_FAILURE); } if (oname_dst==NULL) { error_msg("Destination object name missing\n"); - usage(h5tools_getprogname()); + usage(); leave(EXIT_FAILURE); } diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index a371cc0..8a996d9 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -358,7 +358,7 @@ void parse_command_line(int argc, * *------------------------------------------------------------------------- */ -static int +H5_ATTR_PURE static int check_n_input( const char *str ) { unsigned i; diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index a916ec5..7b4bc39 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -136,7 +136,8 @@ int main(int argc, const char *argv[]) * *------------------------------------------------------------------------- */ -void h5diff_exit(int status) +void +h5diff_exit(int status) { exit(status); } diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 553db93..3b46912 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -438,7 +438,7 @@ table_list_add(hid_t oid, unsigned long file_no) * *------------------------------------------------------------------------- */ -ssize_t +H5_ATTR_PURE ssize_t table_list_visited(unsigned long file_no) { size_t u; /* Local index variable */ @@ -625,9 +625,8 @@ parse_hsize_list(const char *h_list, subset_d *d) last_digit = 1; } - else { + else last_digit = 0; - } if (size_count == 0) /* there aren't any integers to read */ @@ -639,7 +638,7 @@ parse_hsize_list(const char *h_list, subset_d *d) for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) if(HDisdigit(*ptr)) { /* we should have an integer now */ - p_list[i++] = (hsize_t)HDatof(ptr); + p_list[i++] = (hsize_t)HDatoll(ptr); while (HDisdigit(*ptr)) /* scroll to end of integer */ @@ -647,8 +646,6 @@ parse_hsize_list(const char *h_list, subset_d *d) } d->data = p_list; d->len = size_count; - - return; } /*------------------------------------------------------------------------- @@ -671,7 +668,7 @@ static struct subset_t * parse_subset_params(char *dset) { struct subset_t *s = NULL; - register char *brace; + char *brace; if (!disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) { *brace++ = '\0'; @@ -715,14 +712,15 @@ parse_subset_params(char *dset) * * Failure: FAIL * - * *------------------------------------------------------------------------- */ static int parse_mask_list(const char *h_list) { - int offset_value; - int length_value; + int soffset_value; + unsigned offset_value; + int slength_value; + unsigned length_value; unsigned long long temp_mask; const char *ptr = NULL; @@ -740,10 +738,11 @@ parse_mask_list(const char *h_list) error_msg("Bad mask list(%s)\n", h_list); return FAIL; } - offset_value = HDatoi(ptr); - if (offset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) { - error_msg("Packed Bit offset value(%d) must be between 0 and %d\n", - offset_value, PACKED_BITS_SIZE_MAX - 1); + soffset_value = HDatoi(ptr); + offset_value = (unsigned)soffset_value; + if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) { + error_msg("Packed Bit offset value(%d) must be between 0 and %u\n", + soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1)); return FAIL; } @@ -761,14 +760,15 @@ parse_mask_list(const char *h_list) error_msg("Bad mask list(%s)\n", h_list); return FAIL; } - length_value = HDatoi(ptr); - if (length_value <= 0) { - error_msg("Packed Bit length value(%d) must be positive.\n", length_value); + slength_value = HDatoi(ptr); + if (slength_value <= 0) { + error_msg("Packed Bit length value(%d) must be positive.\n", slength_value); return FAIL; } - if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX){ - error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", - offset_value+length_value, PACKED_BITS_SIZE_MAX); + length_value = (unsigned)slength_value; + if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) { + error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n", + offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX); return FAIL; } @@ -787,8 +787,8 @@ parse_mask_list(const char *h_list) /* create the bit mask by left shift 1's by length, then negate it. */ /* After packed_mask is calculated, packed_length is not needed but */ /* keep it for debug purpose. */ - temp_mask = ~0L; - if(length_value<8*sizeof(unsigned long long)) { + temp_mask = ~0ULL; + if(length_value < (int)(8 *sizeof(unsigned long long))) { temp_mask = temp_mask << length_value; packed_mask[packed_bits_num] = ~temp_mask; } @@ -960,11 +960,15 @@ parse_start: goto done; break; case 'w': - h5tools_nCols = HDatoi(opt_arg); - if (h5tools_nCols <= 0) { - h5tools_nCols = 65535; + { + int sh5tools_nCols = HDatoi(opt_arg); + + if (sh5tools_nCols <= 0) + h5tools_nCols = 65535; + else + h5tools_nCols = (unsigned)sh5tools_nCols; + last_was_dset = FALSE; } - last_was_dset = FALSE; break; case 'N': display_all = 0; @@ -1173,12 +1177,10 @@ parse_start: usage(h5tools_getprogname()); goto error; } - if (HDstrcmp(opt_arg,":") == 0) { + if (HDstrcmp(opt_arg,":") == 0) xmlnsprefix = ""; - } - else { + else xmlnsprefix = opt_arg; - } h5tools_nCols = 0; break; /** end XML parameters **/ @@ -1716,7 +1718,7 @@ h5_fileaccess(void) memb_map[mt] = mt; sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; - memb_addr[mt] = MAX(mt-1,0)*(HADDR_MAX/10); + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 8f86567..8224c02 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -53,7 +53,7 @@ typedef struct h5dump_table_list_t { h5dump_table_list_t table_list = {0, 0, NULL}; table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; -int dump_indent = 0; /*how far in to indent the line */ +unsigned dump_indent = 0; /*how far in to indent the line */ int unamedtype = 0; /* shared datatype with no name */ hbool_t hit_elink = FALSE; /* whether we have traversed an external link */ @@ -85,13 +85,13 @@ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | descending] */ #define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ -#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */ +#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */ /* mask list for packed bits */ unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ /* packed bits display parameters */ -int packed_offset[PACKED_BITS_MAX]; -int packed_length[PACKED_BITS_MAX]; +unsigned packed_offset[PACKED_BITS_MAX]; +unsigned packed_length[PACKED_BITS_MAX]; /* * The global table is set to either ddl_function_table or diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 09751ab..182d570 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -26,12 +26,12 @@ typedef struct { hid_t fid; /* File ID being traversed */ - char *op_name; /* Object name wanted */ + const char *op_name; /* Object name wanted */ } trav_handle_udata_t; typedef struct { - char *path; /* Path of object being searched */ - char *op_name; /* Object name wanted */ + const char *path; /* Path of object being searched */ + const char *op_name; /* Object name wanted */ } trav_attr_udata_t; /* callback function used by H5Literate() */ @@ -59,7 +59,7 @@ dump_datatype(hid_t type) h5tool_format_t *outputformat = &h5tools_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; h5dump_type_table = type_table; @@ -88,7 +88,7 @@ dump_dataspace(hid_t space) h5tool_format_t *outputformat = &h5tools_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); @@ -122,7 +122,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * herr_t ret = SUCCEED; HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); @@ -137,7 +137,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -198,7 +198,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -208,7 +208,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -379,8 +379,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR H5Dclose(obj); } else { - if (dapl_id) - H5Pclose(dapl_id && dapl_id != H5P_DEFAULT); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); error_msg("unable to dump dataset \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -670,7 +670,7 @@ dump_named_datatype(hid_t tid, const char *name) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -680,7 +680,7 @@ dump_named_datatype(hid_t tid, const char *name) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -833,7 +833,7 @@ dump_group(hid_t gid, const char *name) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -843,7 +843,7 @@ dump_group(hid_t gid, const char *name) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -880,9 +880,8 @@ dump_group(hid_t gid, const char *name) } } /* end if */ - if(display_oid) { + if(display_oid) h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid); - } h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid); @@ -968,7 +967,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) hsize_t curr_pos = 0; /* total data element position */ HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -978,7 +977,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1038,20 +1037,20 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) H5Pclose(dcpl_id); if(display_data) { - int data_loop = 1; - int i; + unsigned data_loop = 1; + unsigned u; if(display_packed_bits) data_loop = packed_bits_num; - for(i=0; i<data_loop; i++) { + for(u = 0; u < data_loop; u++) { if(display_packed_bits) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); - packed_data_mask = packed_mask[i]; - packed_data_offset = packed_offset[i]; - packed_data_length = packed_length[i]; + packed_data_mask = packed_mask[u]; + packed_data_offset = packed_offset[u]; + packed_data_length = packed_length[u]; h5tools_print_packed_bits(&buffer, type); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } @@ -1090,7 +1089,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDassert(0); break; } /* end switch */ - } /* for(i=0;i<data_loop;i++) */ + } /* for(u=0; u<data_loop; u++) */ } H5Tclose(type); @@ -1147,7 +1146,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1158,7 +1157,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) outputformat = &string_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; if(obj_data == DATASET_DATA) @@ -1331,19 +1330,17 @@ static herr_t attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data) { herr_t ret = SUCCEED; - int i; int j; - int k; char *obj_op_name; char *obj_name; trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; - char *buf = attr_data->path; - char *op_name = attr_data->op_name; + const char *buf = attr_data->path; + const char *op_name = attr_data->op_name; j = (int)HDstrlen(op_name) - 1; /* find the last / */ while(j >= 0) { - if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) + if(op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\'))) break; j--; } @@ -1356,23 +1353,25 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a } else { if(HDstrcmp(attr_name, obj_op_name)==0) { + size_t u, v, w; + /* object name */ - i = (int)HDstrlen(buf); - j = (int)HDstrlen(op_name); - k = (size_t)i + 1 + (size_t)j + 1 + 2; - obj_name = (char *)HDmalloc((size_t)k); + u = HDstrlen(buf); + v = HDstrlen(op_name); + w = u + 1 + v + 1 + 2; + obj_name = (char *)HDmalloc(w); if(obj_name == NULL) { h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } else { - HDmemset(obj_name, '\0', (size_t)k); + HDmemset(obj_name, '\0', w); if(op_name[0] != '/') { - HDstrncat(obj_name, buf, (size_t)i + 1); - if(buf[i-1] != '/') + HDstrncat(obj_name, buf, u + 1); + if(buf[u - 1] != '/') HDstrncat(obj_name, "/", (size_t)2); } - HDstrncat(obj_name, op_name, (size_t)j + 1); + HDstrncat(obj_name, op_name, v + 1); handle_attributes(oid, obj_name, NULL, 0, NULL); HDfree(obj_name); @@ -1387,29 +1386,32 @@ static herr_t obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data) { trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; - char *op_name = (char*)handle_data->op_name; - + const char *op_name = handle_data->op_name; trav_attr_udata_t attr_data; - attr_data.path = (char*)path; + + attr_data.path = path; attr_data.op_name = op_name; H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT); - if(HDstrcmp(path, op_name)==0) { + if(HDstrcmp(path, op_name) == 0) { switch(oi->type) { - case H5O_TYPE_GROUP: - handle_groups(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_DATASET: - handle_datasets(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_NAMED_DATATYPE: - handle_datatypes(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - error_msg("unknown object type value\n"); - h5tools_setstatus(EXIT_FAILURE); + case H5O_TYPE_GROUP: + handle_groups(handle_data->fid, path, NULL, 0, NULL); + break; + + case H5O_TYPE_DATASET: + handle_datasets(handle_data->fid, path, NULL, 0, NULL); + break; + + case H5O_TYPE_NAMED_DATATYPE: + handle_datatypes(handle_data->fid, path, NULL, 0, NULL); + break; + + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + error_msg("unknown object type value\n"); + h5tools_setstatus(EXIT_FAILURE); } /* end switch */ } @@ -1419,19 +1421,18 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al static herr_t lnk_search(const char *path, const H5L_info_t *li, void *_op_data) { - int search_len; - int k; + size_t search_len; + size_t k; char *search_name; trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; - char *op_name = (char*)handle_data->op_name; + const char *op_name = handle_data->op_name; search_len = HDstrlen(op_name); - if(search_len > 0 && op_name[0] != '/') { + if(search_len > 0 && op_name[0] != '/') k = 2; - } else k = 1; - search_name = (char *)HDmalloc((size_t)(search_len + k)); + search_name = (char *)HDmalloc(search_len + k); if(search_name == NULL) { error_msg("creating temporary link\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1439,10 +1440,10 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data) else { if (k == 2) { HDstrcpy(search_name, "/"); - HDstrncat(search_name, op_name, (size_t)search_len + 1); + HDstrncat(search_name, op_name, search_len + 1); } else - HDstrncpy(search_name, op_name, (size_t)search_len + 1); + HDstrncpy(search_name, op_name, search_len + 1); search_name[search_len + k - 1] = '\0'; if(HDstrcmp(path, search_name) == 0) { @@ -1513,7 +1514,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H } handle_udata.fid = fid; - handle_udata.op_name = (char*)path_name; + handle_udata.op_name = path_name; if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { error_msg("error traversing information\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1574,7 +1575,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H dump_indent += COL; HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -1584,7 +1585,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1713,9 +1714,8 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis } } if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) { - if (pe) { + if (pe) handle_links(fid, dset, data, pe, display_name); - } return; } /* end if */ @@ -1731,8 +1731,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis h5tools_setstatus(EXIT_FAILURE); return; } - else - ndims = ndims_res; + ndims = (unsigned)ndims_res; if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) { /* they didn't specify a ``stride'' or ``block''. default to 1 in all @@ -2142,12 +2141,15 @@ dump_extlink(hid_t group, const char *linkname, const char *objname) case H5O_TYPE_GROUP: handle_groups(group, linkname, NULL, 0, objname); break; + case H5O_TYPE_DATASET: handle_datasets(group, linkname, NULL, 0, objname); break; + case H5O_TYPE_NAMED_DATATYPE: handle_datatypes(group, linkname, NULL, 0, objname); break; + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 262cef1..8fef1b9 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -52,7 +52,7 @@ typedef struct h5dump_table_list_t { extern h5dump_table_list_t table_list; extern table_t *group_table, *dset_table, *type_table; -extern int dump_indent; /*how far in to indent the line */ +extern unsigned dump_indent; /*how far in to indent the line */ extern int unamedtype; /* shared datatype with no name */ extern hbool_t hit_elink; /* whether we have traversed an external link */ @@ -89,8 +89,8 @@ extern H5_iter_order_t sort_order; /*sort_order [ascending | descending] */ extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ /* packed bits display parameters */ -extern int packed_offset[PACKED_BITS_MAX]; -extern int packed_length[PACKED_BITS_MAX]; +extern unsigned packed_offset[PACKED_BITS_MAX]; +extern unsigned packed_length[PACKED_BITS_MAX]; /* * The global table is set to either ddl_function_table or diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 5bc43eb..41f3914 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -156,7 +156,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -332,9 +332,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ H5Dclose(obj); goto done; } - else { + else found_obj->displayed = TRUE; - } } /* end if */ dump_function_table->dump_dataset_function(obj, name, NULL); @@ -756,7 +755,7 @@ xml_escape_the_string(const char *str, int slen) if (slen < 0) len = HDstrlen(str); else - len = slen; + len = (size_t)slen; extra = 0; @@ -878,7 +877,7 @@ xml_print_datatype(hid_t type, unsigned in_group) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -954,353 +953,370 @@ xml_print_datatype(hid_t type, unsigned in_group) } } else { - switch (H5Tget_class(type)) { - case H5T_INTEGER: - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; - - /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */ - ord = H5Tget_order(type); - sgn = H5Tget_sign(type); - - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix); - switch (ord) { - case H5T_ORDER_LE: - h5tools_str_append(&buffer, "LE"); - break; - case H5T_ORDER_BE: - h5tools_str_append(&buffer, "BE"); - break; - case H5T_ORDER_VAX: - case H5T_ORDER_MIXED: - case H5T_ORDER_NONE: - case H5T_ORDER_ERROR: - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - break; - } /* end switch */ - - h5tools_str_append(&buffer, "\" Sign=\""); - - switch (sgn) { - case H5T_SGN_NONE: - h5tools_str_append(&buffer, "false"); - break; - case H5T_SGN_2: - h5tools_str_append(&buffer, "true"); - break; - case H5T_SGN_ERROR: - case H5T_NSGN: - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - break; - } /* end switch */ - - h5tools_str_append(&buffer, "\" Size=\""); - sz = H5Tget_size(type); - h5tools_str_append(&buffer, "%lu", (unsigned long)sz); - h5tools_str_append(&buffer, "\" />"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level--; - - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + case H5T_INTEGER: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - case H5T_FLOAT: - /* <hdf5:FloatType ByteOrder="bo" Size="bytes" - SignBitLocation="bytes" - ExponentBits="eb" ExponentLocation="el" - MantissaBits="mb" MantissaLocation="ml" /> */ - ord = H5Tget_order(type); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */ + ord = H5Tget_order(type); + sgn = H5Tget_sign(type); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix); + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: + case H5T_ORDER_ERROR: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + break; + } /* end switch */ + + h5tools_str_append(&buffer, "\" Sign=\""); + + switch (sgn) { + case H5T_SGN_NONE: + h5tools_str_append(&buffer, "false"); + break; + case H5T_SGN_2: + h5tools_str_append(&buffer, "true"); + break; + case H5T_SGN_ERROR: + case H5T_NSGN: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + break; + } /* end switch */ + + h5tools_str_append(&buffer, "\" Size=\""); + sz = H5Tget_size(type); + h5tools_str_append(&buffer, "%lu", (unsigned long)sz); + h5tools_str_append(&buffer, "\" />"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix); - - switch (ord) { - case H5T_ORDER_LE: - h5tools_str_append(&buffer, "LE"); - break; - case H5T_ORDER_BE: - h5tools_str_append(&buffer, "BE"); - break; - case H5T_ORDER_VAX: - h5tools_str_append(&buffer, "VAX"); - break; - case H5T_ORDER_MIXED: - case H5T_ORDER_NONE: - case H5T_ORDER_ERROR: - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - } /* end switch */ - - h5tools_str_append(&buffer, "\" Size=\""); - sz = H5Tget_size(type); - h5tools_str_append(&buffer, "%lu", (unsigned long)sz); - H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); - h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); - h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); - h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level--; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + case H5T_FLOAT: + /* <hdf5:FloatType ByteOrder="bo" Size="bytes" + SignBitLocation="bytes" + ExponentBits="eb" ExponentLocation="el" + MantissaBits="mb" MantissaLocation="ml" /> */ + ord = H5Tget_order(type); - case H5T_TIME: - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->"); - ctx.indent_level--; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix); + + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + h5tools_str_append(&buffer, "VAX"); + break; + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: + case H5T_ORDER_ERROR: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } /* end switch */ + + h5tools_str_append(&buffer, "\" Size=\""); + sz = H5Tget_size(type); + h5tools_str_append(&buffer, "%lu", (unsigned long)sz); + H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); + h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); + h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); + h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - case H5T_STRING: - /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */ - size = H5Tget_size(type); - str_pad = H5Tget_strpad(type); - cset = H5Tget_cset(type); - is_vlstr = H5Tis_variable_str(type); + case H5T_TIME: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.indent_level++; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->"); + ctx.indent_level--; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix); - if (cset == H5T_CSET_ASCII) { - h5tools_str_append(&buffer, "H5T_CSET_ASCII\" "); - } - else { - h5tools_str_append(&buffer, "unknown_cset\" "); - } - if(is_vlstr) - h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\""); - else - h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size); - if (str_pad == H5T_STR_NULLTERM) { - h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>"); - } - else if (str_pad == H5T_STR_NULLPAD) { - h5tools_str_append(&buffer, "H5T_STR_NULLPAD\"/>"); - } - else if (str_pad == H5T_STR_SPACEPAD) { - h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>"); - } - else { - h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); - } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level--; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + case H5T_STRING: + /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */ + size = H5Tget_size(type); + str_pad = H5Tget_strpad(type); + cset = H5Tget_cset(type); + is_vlstr = H5Tis_variable_str(type); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - case H5T_BITFIELD: - /* <hdf5:BitfieldType ByteOrder="bo" Size="bytes"/> */ - ord = H5Tget_order(type); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.indent_level++; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); - - switch (ord) { - case H5T_ORDER_LE: - h5tools_str_append(&buffer, "LE"); - break; - case H5T_ORDER_BE: - h5tools_str_append(&buffer, "BE"); - break; - case H5T_ORDER_VAX: - case H5T_ORDER_MIXED: - case H5T_ORDER_NONE: - case H5T_ORDER_ERROR: - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - } /* end switch */ - - size = H5Tget_size(type); - h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level--; + if (cset == H5T_CSET_ASCII) + h5tools_str_append(&buffer, "H5T_CSET_ASCII\" "); + else + h5tools_str_append(&buffer, "unknown_cset\" "); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + if(is_vlstr) + h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\""); + else + h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size); + + if (str_pad == H5T_STR_NULLTERM) + h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>"); + else if (str_pad == H5T_STR_NULLPAD) + h5tools_str_append(&buffer, "H5T_STR_NULLPAD\"/>"); + else if (str_pad == H5T_STR_SPACEPAD) + h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>"); + else + h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - case H5T_OPAQUE: - /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */ + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + case H5T_BITFIELD: + /* <hdf5:BitfieldType ByteOrder="bo" Size="bytes"/> */ + ord = H5Tget_order(type); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; - mname = H5Tget_tag(type); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); - H5free_memory(mname); - size = H5Tget_size(type); - h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level--; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); + + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: + case H5T_ORDER_ERROR: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } /* end switch */ + + size = H5Tget_size(type); + h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - case H5T_COMPOUND: - /* recursively describe the components of a compound datatype */ + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - /* type of a dataset */ - nmembers = H5Tget_nmembers(type); + case H5T_OPAQUE: + /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */ - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; + mname = H5Tget_tag(type); - /* List each member Field of the type */ - /* <hdf5:Field FieldName="name" > */ - /* <hdf5:DataType > */ - ctx.indent_level++; - dump_indent += COL; - for (i = 0; i < nmembers; i++) { - char *t_fname; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - mname = H5Tget_member_name(type, i); - mtype = H5Tget_member_type(type, i); - t_fname = xml_escape_the_name(mname); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); + H5free_memory(mname); + size = H5Tget_size(type); + h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - H5free_memory(mname); - HDfree(t_fname); - dump_indent += COL; - ctx.indent_level++; + case H5T_COMPOUND: + /* recursively describe the components of a compound datatype */ + + /* type of a dataset */ + nmembers = (unsigned)H5Tget_nmembers(type); ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + /* List each member Field of the type */ + /* <hdf5:Field FieldName="name" > */ + /* <hdf5:DataType > */ ctx.indent_level++; dump_indent += COL; - xml_print_datatype(mtype,0); + for (i = 0; i < nmembers; i++) { + char *t_fname; + + mname = H5Tget_member_name(type, i); + mtype = H5Tget_member_type(type, i); + t_fname = xml_escape_the_name(mname); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + H5free_memory(mname); + HDfree(t_fname); + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; + dump_indent += COL; + xml_print_datatype(mtype,0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sField>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } dump_indent -= COL; ctx.indent_level--; @@ -1309,248 +1325,227 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); + h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_indent -= COL; - ctx.indent_level--; + break; + case H5T_REFERENCE: ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sField>",xmlnsprefix); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - dump_indent -= COL; - ctx.indent_level--; - - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.indent_level++; + /* Only Object references supported at this time */ - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - case H5T_REFERENCE: - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level++; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; - /* Only Object references supported at this time */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level--; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - ctx.indent_level--; + case H5T_ENUM: + /* <hdf5:EnumType Nelems="ne" > list Name, values of enum */ + nmembs = H5Tget_nmembers(type); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + dump_indent += COL; + ctx.indent_level++; - case H5T_ENUM: - /* <hdf5:EnumType Nelems="ne" > list Name, values of enum */ - nmembs = H5Tget_nmembers(type); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + xml_print_enum(type); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_indent += COL; - ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + dump_indent -= COL; + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - xml_print_enum(type); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + break; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_indent -= COL; - ctx.indent_level--; + case H5T_VLEN: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + super = H5Tget_super(type); + dump_indent += COL; + ctx.indent_level++; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - break; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - case H5T_VLEN: - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + dump_indent += COL; + ctx.indent_level++; + xml_print_datatype(super,0); + dump_indent -= COL; + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - super = H5Tget_super(type); - dump_indent += COL; - ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + dump_indent -= COL; + ctx.indent_level--; - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_indent += COL; - ctx.indent_level++; - xml_print_datatype(super,0); - dump_indent -= COL; - ctx.indent_level--; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + H5Tclose(super); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_indent -= COL; - ctx.indent_level--; + break; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + case H5T_ARRAY: + /* Get array base type */ + super = H5Tget_super(type); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - H5Tclose(super); + /* Print lead-in */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix); + ndims = (unsigned)H5Tget_array_ndims(type); + h5tools_str_append(&buffer, "%u\">", ndims); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - case H5T_ARRAY: - /* Get array base type */ - super = H5Tget_super(type); + /* Get array information */ + H5Tget_array_dims2(type, dims); - /* Print lead-in */ - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + /* list of dimensions */ + ctx.indent_level++; + for (i = 0; i < ndims; i++) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix); - ndims = H5Tget_array_ndims(type); - h5tools_str_append(&buffer, "%u\">", ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + } + ctx.indent_level--; - /* Get array information */ - H5Tget_array_dims2(type, dims); + dump_indent += COL; + ctx.indent_level++; - /* list of dimensions */ - ctx.indent_level++; - for (i = 0; i < ndims; i++) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - } - ctx.indent_level--; - - dump_indent += COL; - ctx.indent_level++; - - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_indent += COL; - ctx.indent_level++; - xml_print_datatype(super,0); - dump_indent -= COL; - ctx.indent_level--; + dump_indent += COL; + ctx.indent_level++; + xml_print_datatype(super,0); + dump_indent -= COL; + ctx.indent_level--; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - dump_indent -= COL; - ctx.indent_level--; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + dump_indent -= COL; + ctx.indent_level--; - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - /* Close array base type */ - H5Tclose(super); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + /* Close array base type */ + H5Tclose(super); + break; - case H5T_NO_CLASS: - case H5T_NCLASSES: - HDassert(0); - /* fall through */ - default: - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + case H5T_NO_CLASS: + case H5T_NCLASSES: + HDassert(0); + /* fall through */ + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<!-- unknown datatype -->"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - h5tools_setstatus(EXIT_FAILURE); - break; + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<!-- unknown datatype -->"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + h5tools_setstatus(EXIT_FAILURE); + break; } } /* end else */ @@ -1583,7 +1578,7 @@ xml_dump_datatype(hid_t type) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -1593,7 +1588,7 @@ xml_dump_datatype(hid_t type) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1722,7 +1717,7 @@ xml_dump_dataspace(hid_t space) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -1732,7 +1727,7 @@ xml_dump_dataspace(hid_t space) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1898,7 +1893,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, h5tool_format_t string_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; /* Print all the values. */ @@ -1912,7 +1907,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -1951,12 +1946,10 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, if (obj_data == DATASET_DATA) { type = H5Dget_type(obj_id); - if (H5Tget_class(type) == H5T_REFERENCE) { + if (H5Tget_class(type) == H5T_REFERENCE) status = xml_print_refs(obj_id, DATASET_DATA); - } - else if (H5Tget_class(type) == H5T_STRING) { + else if (H5Tget_class(type) == H5T_STRING) status = xml_print_strs(obj_id, DATASET_DATA); - } else { h5tools_context_t datactx; HDmemset(&datactx, 0, sizeof(datactx)); @@ -2096,7 +2089,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -2106,7 +2099,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -2426,7 +2419,7 @@ xml_dump_named_datatype(hid_t type, const char *name) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -2436,7 +2429,7 @@ xml_dump_named_datatype(hid_t type, const char *name) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -2651,7 +2644,7 @@ xml_dump_group(hid_t gid, const char *name) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -2661,7 +2654,7 @@ xml_dump_group(hid_t gid, const char *name) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3007,14 +3000,13 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char)); + buf = (char *) HDcalloc((size_t)ssiz, tsiz); if (buf == NULL) goto error; e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); /* need to check result here */ - if (e < 0) { + if (e < 0) goto error; - } } else if (source == ATTRIBUTE_DATA) { space = H5Aget_space(did); @@ -3023,15 +3015,13 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char)); - if (buf == NULL) { + buf = (char *) HDcalloc((size_t)ssiz, tsiz); + if (buf == NULL) goto error; - } e = H5Aread(did, H5T_STD_REF_OBJ, buf); /* need to check the result here */ - if (e < 0) { + if (e < 0) goto error; - } } refbuf = (hobj_ref_t *) buf; @@ -3040,7 +3030,7 @@ xml_print_refs(hid_t did, int source) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3050,7 +3040,7 @@ xml_print_refs(hid_t did, int source) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3130,7 +3120,7 @@ xml_print_strs(hid_t did, int source) hssize_t ssiz = -1; htri_t is_vlstr = FALSE; size_t tsiz = 0; - size_t i; + hsize_t i; size_t str_size = 0; char *bp = NULL; char *onestring = NULL; @@ -3141,20 +3131,16 @@ xml_print_strs(hid_t did, int source) h5tool_format_t string_dataformat; hsize_t curr_pos = 0; /* total data element position */ - if (source == DATASET_DATA) { + if (source == DATASET_DATA) type = H5Dget_type(did); - } - else if (source == ATTRIBUTE_DATA) { + else if (source == ATTRIBUTE_DATA) type = H5Aget_type(did); - } - else { + else /* return an error */ return FAIL; - } - if (H5Tget_class(type) != H5T_STRING) { + if (H5Tget_class(type) != H5T_STRING) /* return an error */ goto error; - } /* Check if we have VL data in the dataset's datatype */ is_vlstr = H5Tis_variable_str(type); @@ -3165,14 +3151,13 @@ xml_print_strs(hid_t did, int source) if((tsiz = H5Tget_size(type)) == 0) goto error; - buf = HDmalloc((size_t)(ssiz * tsiz)); + buf = HDmalloc((size_t)ssiz * tsiz); if (buf == NULL) goto error; e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - if (e < 0) { + if (e < 0) goto error; - } } else if (source == ATTRIBUTE_DATA) { space = H5Aget_space(did); @@ -3181,14 +3166,13 @@ xml_print_strs(hid_t did, int source) if((tsiz = H5Tget_size(type)) == 0) goto error; - buf = HDmalloc((size_t)(ssiz * tsiz)); + buf = HDmalloc((size_t)ssiz * tsiz); if (buf == NULL) goto error; e = H5Aread(did, type, buf); - if (e < 0) { + if (e < 0) goto error; - } } bp = (char*) buf; @@ -3199,7 +3183,7 @@ xml_print_strs(hid_t did, int source) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3209,7 +3193,7 @@ xml_print_strs(hid_t did, int source) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3219,11 +3203,11 @@ xml_print_strs(hid_t did, int source) string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - for (i = 0; i < ssiz; i++) { + for (i = 0; i < (hsize_t)ssiz; i++) { if (is_vlstr) { onestring = *(char **) bp; if (onestring) - str_size = (size_t) HDstrlen(onestring); + str_size = HDstrlen(onestring); } else { HDstrncpy(onestring, bp, tsiz); @@ -3240,7 +3224,7 @@ xml_print_strs(hid_t did, int source) h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { - char *t_onestring = xml_escape_the_string(onestring, (int) str_size); + char *t_onestring = xml_escape_the_string(onestring, (int)str_size); if (t_onestring) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -3315,7 +3299,7 @@ check_filters(hid_t dcpl) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3325,7 +3309,7 @@ check_filters(hid_t dcpl) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3455,7 +3439,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -3465,7 +3449,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -3825,7 +3809,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; t_name = xml_escape_the_name(name); @@ -3839,7 +3823,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } @@ -4419,7 +4403,7 @@ xml_print_enum(hid_t type) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); HDmemset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = dump_indent/COL; + ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; string_dataformat = *outputformat; @@ -4429,7 +4413,7 @@ xml_print_enum(hid_t type) string_dataformat.fmt_float = fp_format; } - if (h5tools_nCols==0) { + if (h5tools_nCols == 0) { string_dataformat.line_ncols = 65535; string_dataformat.line_per_line = 1; } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 46386a0..1cdf6cf 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -448,7 +448,7 @@ gent_dataset(void) for(i = 0; i < 30; i++) for(j = 0; j < 20; j++) - dset2[i][j] = 0.0001F * j + i; + dset2[i][j] = 0.0001F * (float)j + (float)i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); @@ -543,7 +543,7 @@ gent_attribute(void) space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT); - for(i = 0; i < 10; i++) d[i] = 0.1F * i; + for(i = 0; i < 10; i++) d[i] = 0.1F * (float)i; H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space); @@ -971,16 +971,16 @@ static void gent_compound_dt(void) { /* test compound data type */ for(i = 0; i < (int)sdim; i++) { dset1[i].a = i; dset1[i].b = (float)(i*i); - dset1[i].c = (float)(1.0F/(i+1)); + dset1[i].c = (float)(1.0F/(float)(i+1)); dset2[i].a = i; - dset2[i].b = (float)(i+ i*0.1F); + dset2[i].b = (float)((float)i+ (float)i*0.1F); dset4[i].a = i; dset4[i].b = (float)(i+3); dset5[i].a = i; - dset5[i].b = (float)(i*0.1F); + dset5[i].b = (float)((float)i*0.1F); } @@ -1156,16 +1156,16 @@ static void gent_compound_dt2(void) { /* test compound data type */ for(i = 0; i < (int)sdim; i++) { dset1[i].a = i; dset1[i].b = (float)(i*i); - dset1[i].c = (float)(1.0F/(i+1)); + dset1[i].c = (float)(1.0F / (float)(i+ 1)); dset2[i].a = i; - dset2[i].b = (float)(i+ i*0.1F); + dset2[i].b = (float)((float)i + (float)i * 0.1F); dset4[i].a = i; - dset4[i].b = (float)(i*1.0F); + dset4[i].b = (float)((float)i * 1.0F); dset5[i].a = i; - dset5[i].b = (float)(i*1.0F); + dset5[i].b = (float)((float)i * 1.0F); } fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1405,7 +1405,7 @@ static void gent_all(void) space = H5Screate_simple(1, dims, NULL); dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - dset2_1[i] = (float)(i * 0.1F + 1); + dset2_1[i] = (float)((float)i * 0.1F + 1); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); @@ -1416,7 +1416,7 @@ static void gent_all(void) dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 3; i++) for(j = 0; j < 5; j++) - dset2_2[i][j] = (float)((i + 1) * j * 0.1F); + dset2_2[i][j] = (float)((float)(i + 1) * (float)j * 0.1F); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2); H5Sclose(space); H5Dclose(dataset); @@ -1584,7 +1584,7 @@ gent_many(void) space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - d[i] = 0.1F * i; + d[i] = 0.1F * (float)i; H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space2); H5Aclose(attr); @@ -1594,9 +1594,9 @@ gent_many(void) for(i2 = 0; i2 < 2; i2++) { for(i1 = 0; i1 < 2; i1++) { for(i0 = 0; i0 < 2; i0++) { - dset1[j].a[i3][i2][i1][i0] = i0+j; - dset1[j].b[i3][i2][i1][i0] = (double)(i0+j); - dset1[j].c[i3][i2][i1][i0] = (double)(i0+j+sdim); + dset1[j].a[i3][i2][i1][i0] = i0 + j; + dset1[j].b[i3][i2][i1][i0] = (double)(i0 + j); + dset1[j].c[i3][i2][i1][i0] = (double)((hsize_t)i0 + (hsize_t)j + sdim); } } } @@ -1899,7 +1899,7 @@ static void gent_str2(void) block[0]=1; for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; + start[0] = (hsize_t)i; sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); @@ -1912,7 +1912,7 @@ static void gent_str2(void) dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; + start[0] = (hsize_t)i; sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); @@ -1932,7 +1932,7 @@ static void gent_str2(void) dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0;(hsize_t) i < sdim; i++) { - start[0] = i; + start[0] = (hsize_t)i; sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); @@ -1946,7 +1946,7 @@ static void gent_str2(void) dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; + start[0] = (hsize_t)i; sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); @@ -1965,7 +1965,7 @@ static void gent_str2(void) dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; + start[0] = (hsize_t)i; sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); @@ -1979,7 +1979,7 @@ static void gent_str2(void) dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; + start[0] = (hsize_t)i; sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); @@ -2065,7 +2065,7 @@ static void gent_objref(void) dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(tu32 = (uint32_t *)((void*)wbuf), i = 0; i < SPACE1_DIM1; i++) - *tu32++ = i * 3; + *tu32++ = (uint32_t)(i * 3); /* Write selection to disk */ H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -2170,7 +2170,7 @@ static void gent_datareg(void) dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++) - *tu8++=i*3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -2279,7 +2279,7 @@ static void gent_attrreg(void) dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++) - *tu8++=i*3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -2397,8 +2397,8 @@ static void gent_nestcomp(void) for(i = 0; i< 10; i++) { s1[i].a = i; s1[i].b = (float)(i*i); - s1[i].c = 1.0F/(i+1); - s1[i].d.a = 65 + i; + s1[i].c = 1.0F/(float)(i + 1); + s1[i].d.a = (char)(65 + i); s1[i].d.b[0] = -100.0F; s1[i].d.b[1] = 100.0F; } @@ -2469,8 +2469,8 @@ static void gent_opaque(void) hsize_t dim = 2; for(x = 0; x < 100; x++){ - test[x][0] = x; - test[x][1] = 99 - x; + test[x][0] = (char)x; + test[x][1] = (char)(99 - x); } /* @@ -2570,8 +2570,8 @@ static void gent_vldatatypes(void) for(i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = HDmalloc((i + 1) * sizeof(int)); - wdata[i].len = i + 1; + wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + wdata[i].len = (size_t)(i + 1); for(j = 0; j < i + 1; j++) ((int *)wdata[i].p)[j] = i * 10 + j; @@ -2597,12 +2597,12 @@ static void gent_vldatatypes(void) for(i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = HDmalloc((i + 1) * sizeof(float)); - wdata[i].len = i + 1; + wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float)); + wdata[i].len = (size_t)(i + 1); for(j = 0; j < i + 1; j++) - ((float *)wdata[i].p)[j] = (float)(i * 10 + ((float)j) / 10.0F); - } + ((float *)wdata[i].p)[j] = (float)((float)(i * 10) + ((float)j) / 10.0F); + } /* end for */ /* write out the floats in little-endian format */ space = H5Screate_simple(SPACE1_RANK, dims, NULL); @@ -2719,9 +2719,9 @@ gent_vldatatypes2(void) static void gent_vldatatypes3(void) { typedef struct { /* Struct that the VL sequences are composed of */ - int i; - float f; - hvl_t v; + int i; + float f; + hvl_t v; } s1; s1 wdata[SPACE1_DIM1]; /* Information to write */ hid_t fid1; /* HDF5 File IDs */ @@ -2734,12 +2734,12 @@ static void gent_vldatatypes3(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0F); - wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int)); - wdata[i].v.len=i+1; - for(j=0; j<(i+1); j++) - ((unsigned int *)wdata[i].v.p)[j]=i*10+j; + wdata[i].i = (int)(i * 10); + wdata[i].f = (float)((float)(i * 20)/3.0F); + wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int)); + wdata[i].v.len = (size_t)(i + 1); + for(j = 0; j < (i + 1); j++) + ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j; } /* end for */ /* Create file */ @@ -2789,8 +2789,8 @@ static void gent_vldatatypes3(void) static void gent_vldatatypes4(void) { typedef struct { /* Struct that the VL sequences are composed of */ - int i; - float f; + int i; + float f; } s1; hvl_t wdata[SPACE1_DIM1]; /* Information to write */ hid_t fid1; /* HDF5 File IDs */ @@ -2803,11 +2803,11 @@ static void gent_vldatatypes4(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].p=HDmalloc((i+1)*sizeof(s1)); - wdata[i].len=i+1; - for(j=0; j<(i+1); j++) { - ((s1 *)wdata[i].p)[j].i=i*10+j; - ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F); + wdata[i].p = HDmalloc((i + 1) * sizeof(s1)); + wdata[i].len = i + 1; + for(j = 0; j < (i + 1); j++) { + ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j); + ((s1 *)wdata[i].p)[j].f = (float)((float)(i * 20 + j) / 3.0F); } /* end for */ } /* end for */ @@ -2872,10 +2872,10 @@ static void gent_vldatatypes5(void) wdata[i].p=NULL; } /* end if */ else { - wdata[i].len=i+5; - wdata[i].p=HDmalloc(sizeof(unsigned)*(i+5)); - for(j=0; j<i+5; j++) - ((unsigned *)wdata[i].p)[j]=j*2; + wdata[i].len = (size_t)(i + 5); + wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5)); + for(j = 0; j < i + 5; j++) + ((unsigned *)wdata[i].p)[j] = (unsigned)(j * 2); } /* end else */ } /* end for */ @@ -3177,8 +3177,8 @@ static void gent_array4(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].i=i*10+j; - wdata[i][j].f=(float)(i*2.5F+j); + wdata[i][j].i = i * 10 + j; + wdata[i][j].f = (float)((float)i * 2.5F + (float)j); } /* end for */ /* Create file */ @@ -3244,9 +3244,9 @@ static void gent_array5(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].i=i*10+j; + wdata[i][j].i = i * 10 + j; for(k=0; k<ARRAY1_DIM1; k++) - wdata[i][j].f[k]=(float)(i*10+j*2.5F+k); + wdata[i][j].f[k] = (float)((float)i * 10 + (float)j * 2.5F + (float)k); } /* end for */ /* Create file */ @@ -3314,10 +3314,10 @@ static void gent_array6(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int)); - wdata[i][j].len=i+j+1; - for(k=0; k<(i+j+1); k++) - ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k; + wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int)); + wdata[i][j].len = (size_t)(i + j + 1); + for(k = 0; k < (i + j + 1); k++) + ((unsigned int *)wdata[i][j].p)[k] = (unsigned)(i * 100 + j * 10 + k); } /* end for */ /* Create file */ @@ -3375,11 +3375,11 @@ static void gent_array7(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1)); - wdata[i][j].len=i+j+1; - for(k=0; k<(i+j+1); k++) - for(l=0; l<ARRAY1_DIM1; l++) - ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l]=i*1000+j*100+k*10+l; + wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1)); + wdata[i][j].len = (size_t)(i + j + 1); + for(k = 0; k < (i + j + 1); k++) + for(l = 0; l<ARRAY1_DIM1; l++) + ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] = (unsigned)(i * 1000+j * 100+k * 10 + l); } /* end for */ /* Create file */ @@ -3437,15 +3437,15 @@ static void gent_array8(void) herr_t status = -1; hsize_t sdims[] = {F64_DIM0}; hsize_t tdims[] = {F64_DIM1}; - int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */ + int wdata[F64_DIM1]; /* Write buffer */ unsigned int i; /* * Initialize data. i is the element in the dataspace, j and k the * elements within the array datatype. */ - for (i=0; i<F64_DIM1; i++) - wdata[i] = i; + for (i = 0; i < F64_DIM1; i++) + wdata[i] = (int)i; /* * Create a new file using the default properties. @@ -3719,7 +3719,7 @@ void gent_multi(void) sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; /*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/ - memb_addr[mt] = MAX(mt - 1,0) * (HADDR_MAX / 10); + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER; @@ -4106,8 +4106,8 @@ static void write_attr_in(hid_t loc_id, for(j = 0; j < 2; j++) { int l; - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; + buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; } @@ -4163,7 +4163,7 @@ static void write_attr_in(hid_t loc_id, for(i = 0; i < 4; i++) { for(j = 0; j < 3; j++) { for(k = 0; k < 2; k++) { - buf23[i][j][k]=n++; + buf23[i][j][k] = (char)n++; } } } @@ -4189,7 +4189,7 @@ static void write_attr_in(hid_t loc_id, for(i = 0; i < 4; i++) { for(j = 0; j < 3; j++) { for(k = 0; k < 2; k++) { - buf33[i][j][k].a=n++; + buf33[i][j][k].a = (char)n++; buf33[i][j][k].b=n++; } } @@ -4238,8 +4238,8 @@ static void write_attr_in(hid_t loc_id, for(k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = i + 1; + buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) ((int *)buf53[i][j][k].p)[l] = n++; } @@ -4548,8 +4548,8 @@ static void write_dset_in(hid_t loc_id, for(j = 0; j < 2; j++) { int l; - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; + buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; } @@ -4614,13 +4614,10 @@ static void write_dset_in(hid_t loc_id, */ n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - buf23[i][j][k]=n++; - } - } - } + for(i = 0; i < 4; i++) + for(j = 0; j < 3; j++) + for(k = 0; k < 2; k++) + buf23[i][j][k] = (char)n++; tid = H5Tcopy(H5T_STD_B8LE); write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23); status = H5Tclose(tid); @@ -4640,14 +4637,12 @@ static void write_dset_in(hid_t loc_id, */ n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { + for(i = 0; i < 4; i++) + for(j = 0; j < 3; j++) for(k = 0; k < 2; k++) { - buf33[i][j][k].a=n++; - buf33[i][j][k].b=n++; + buf33[i][j][k].a = (char)n++; + buf33[i][j][k].b = n++; } - } - } tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); @@ -4692,8 +4687,8 @@ static void write_dset_in(hid_t loc_id, for(k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = i + 1; + buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int)); + buf53[i][j][k].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) ((int *)buf53[i][j][k].p)[l] = n++; } @@ -4938,25 +4933,20 @@ static void gent_compound_complex(void) for(m = 0; m< F41_LENGTH; m++) { Array1[m].a = m; - for(n = 0; n < F41_DIMb; n++) { + for(n = 0; n < F41_DIMb; n++) Array1[m].b[n] = quote[n]; - } - for(n = 0; n < F41_ARRAY_DIMc; n++) { + for(n = 0; n < F41_ARRAY_DIMc; n++) Array1[m].c[n] = chararray[n]; - } - for(n = 0; n < F41_ARRAY_DIMd1; n++) { - for(o = 0; o < F41_ARRAY_DIMd2; o++){ - Array1[m].d[n][o] = m + n + o; - } - } + for(n = 0; n < F41_ARRAY_DIMd1; n++) + for(o = 0; o < F41_ARRAY_DIMd2; o++) + Array1[m].d[n][o] = (short)(m + n + o); - Array1[m].e = (float)( m * 0.96F ); + Array1[m].e = (float)((float)m * 0.96F ); - for(n = 0; n < F41_ARRAY_DIMf; n++) { - Array1[m].f[n] = ( m * 1024.9637F ); - } + for(n = 0; n < F41_ARRAY_DIMf; n++) + Array1[m].f[n] = ((float)m * 1024.9637F ); Array1[m].g = 'm'; } @@ -7154,8 +7144,8 @@ gent_packedbits(void) for(i = 0; i < dims[0]; i++){ dsetu8[i][0] = valu8bits; for(j = 1; j < dims[1]; j++) - dsetu8[i][j] = dsetu8[i][j-1] << 1; - valu8bits <<= 1; + dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1); + valu8bits = (uint8_t)(valu8bits << 1); } H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -7171,8 +7161,8 @@ gent_packedbits(void) for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) - dsetu16[i][j] = dsetu16[i][j-1] << 1; - valu16bits <<= 1; + dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1); + valu16bits = (uint16_t)(valu16bits << 1); } H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -7222,8 +7212,8 @@ gent_packedbits(void) for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) - dset8[i][j] = dset8[i][j-1] << 1; - val8bits <<= 1; + dset8[i][j] = (int8_t)(dset8[i][j-1] << 1); + val8bits = (int8_t)(val8bits << 1); } H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -7239,8 +7229,8 @@ gent_packedbits(void) for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) - dset16[i][j] = dset16[i][j-1] << 1; - val16bits <<= 1; + dset16[i][j] = (int16_t)(dset16[i][j-1] << 1); + val16bits = (int16_t)(val16bits << 1); } H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -7288,7 +7278,7 @@ gent_packedbits(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * j + i; + dsetdbl[i][j] = 0.0001F * (float)j + (float)i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); @@ -7336,9 +7326,9 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dsetu8[i][0] = valu8bits; for(j = 1; j < dims[1]; j++) { - dsetu8[i][j] = dsetu8[i][j-1] << 1; + dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1); } - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8); @@ -7354,9 +7344,9 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) { - dsetu16[i][j] = dsetu16[i][j-1] << 1; + dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1); } - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16); @@ -7408,9 +7398,9 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) { - dset8[i][j] = dset8[i][j-1] << 1; + dset8[i][j] = (int8_t)(dset8[i][j-1] << 1); } - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } H5Awrite(attr, H5T_NATIVE_INT8, dset8); @@ -7426,9 +7416,9 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) { - dset16[i][j] = dset16[i][j-1] << 1; + dset16[i][j] = (int16_t)(dset16[i][j-1] << 1); } - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } H5Awrite(attr, H5T_NATIVE_INT16, dset16); @@ -7478,7 +7468,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * j + i; + dsetdbl[i][j] = 0.0001F * (float)j + (float)i; H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl); @@ -7589,33 +7579,33 @@ static void gent_compound_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM8; valu8bits = (uint8_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu8[n][0] = valu8bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1); } - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } /* Array of 16 bits unsigned int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM16; valu16bits = (uint16_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu16[n][0] = valu16bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1); } - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } /* Array of 32 bits unsigned int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM32; valu32bits = (uint32_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu32[n][0] = valu32bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1; } valu32bits <<= 1; @@ -7625,9 +7615,9 @@ static void gent_compound_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM64; valu64bits = (uint64_t) ~0Lu; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu64[n][0] = valu64bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1; } valu64bits <<= 1; @@ -7637,33 +7627,33 @@ static void gent_compound_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM8; val8bits = (int8_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset8[n][0] = val8bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1); } - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } /* Array of 16 bits signed int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM16; val16bits = (int16_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset16[n][0] = val16bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1); } - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } /* Array of 32 bits signed int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM32; val32bits = (int32_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset32[n][0] = val32bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1; } val32bits <<= 1; @@ -7673,9 +7663,9 @@ static void gent_compound_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM64; val64bits = (int64_t) ~0L; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset64[n][0] = val64bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1; } val64bits <<= 1; @@ -7684,9 +7674,9 @@ static void gent_compound_intsizes(void) { /* Double Dummy set for failure tests */ dims[0] = F70_XDIM; dims[1] = F70_YDIM8; - for(n = 0; n < dims[0]; n++) - for(o = 0; o < dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001F * o + n; + for(n = 0; n < (int)dims[0]; n++) + for(o = 0; o < (int)dims[1]; o++) + Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n; } /* Create the array data type for the 8 bits signed int array */ @@ -7864,33 +7854,33 @@ static void gent_compound_attr_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM8; valu8bits = (uint8_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu8[n][0] = valu8bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1); } - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } /* Array of 16 bits unsigned int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM16; valu16bits = (uint16_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu16[n][0] = valu16bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1); } - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } /* Array of 32 bits unsigned int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM32; valu32bits = (uint32_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu32[n][0] = valu32bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1; } valu32bits <<= 1; @@ -7900,9 +7890,9 @@ static void gent_compound_attr_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM64; valu64bits = (uint64_t) ~0Lu; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dsetu64[n][0] = valu64bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1; } valu64bits <<= 1; @@ -7912,33 +7902,33 @@ static void gent_compound_attr_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM8; val8bits = (int8_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset8[n][0] = val8bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1); } - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } /* Array of 16 bits signed int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM16; val16bits = (int16_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset16[n][0] = val16bits; - for(o = 1; o < dims[1]; o++) { - Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1; + for(o = 1; o < (int)dims[1]; o++) { + Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1); } - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } /* Array of 32 bits signed int */ dims[0] = F70_XDIM; dims[1] = F70_YDIM32; val32bits = (int32_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset32[n][0] = val32bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1; } val32bits <<= 1; @@ -7948,9 +7938,9 @@ static void gent_compound_attr_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM64; val64bits = (int64_t) ~0L; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Array1[m].dset64[n][0] = val64bits; - for(o = 1; o < dims[1]; o++) { + for(o = 1; o < (int)dims[1]; o++) { Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1; } val64bits <<= 1; @@ -7959,9 +7949,9 @@ static void gent_compound_attr_intsizes(void) { /* Double Dummy set for failure tests */ dims[0] = F70_XDIM; dims[1] = F70_YDIM8; - for(n = 0; n < dims[0]; n++) - for(o = 0; o < dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001F * o + n; + for(n = 0; n < (int)dims[0]; n++) + for(o = 0; o < (int)dims[1]; o++) + Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n; } /* Create the array data type for the 8 bits signed int array */ @@ -8129,17 +8119,17 @@ static void gent_nested_compound_dt(void) { /* test nested data type */ dset1[i].b = (float)(i*i); dset2[i].a = i; - dset2[i].b = (float)(i+i*0.1F); + dset2[i].b = (float)((float)i + (float)i * 0.1F); dset2[i].c = GREEN; for(j = 0; j < 5; j++) { - dset3[i].a[j] = i*j; + dset3[i].a[j] = i * j; for(k = 0; k < 6; k++) { - dset3[i].b[j][k] = (float)(i*j*k*1.0F); + dset3[i].b[j][k] = (float)((float)i * (float)j * (float)k * 1.0F); } } dset3[i].c.a = i; - dset3[i].c.b = (float)(i*1.0F); + dset3[i].c.b = (float)((float)i * 1.0F); } fid = H5Fcreate(FILE72, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -8277,9 +8267,9 @@ gent_intscalars(void) for(i = 0; i < dims[0]; i++){ dsetu8[i][0] = valu8bits; for(j = 1; j < dims[1]; j++) { - dsetu8[i][j] = dsetu8[i][j-1] << 1; + dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1); } - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -8296,9 +8286,9 @@ gent_intscalars(void) for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) { - dsetu16[i][j] = dsetu16[i][j-1] << 1; + dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1); } - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -8353,9 +8343,9 @@ gent_intscalars(void) for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) { - dset8[i][j] = dset8[i][j-1] << 1; + dset8[i][j] = (int8_t)(dset8[i][j-1] << 1); } - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -8372,9 +8362,9 @@ gent_intscalars(void) for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) { - dset16[i][j] = dset16[i][j-1] << 1; + dset16[i][j] = (int16_t)(dset16[i][j-1] << 1); } - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -8427,7 +8417,7 @@ gent_intscalars(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * j + i; + dsetdbl[i][j] = 0.0001F * (float)j + (float)i; H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); @@ -8476,9 +8466,9 @@ gent_attr_intscalars(void) for(i = 0; i < dims[0]; i++){ dsetu8[i][0] = valu8bits; for(j = 1; j < dims[1]; j++) { - dsetu8[i][j] = dsetu8[i][j-1] << 1; + dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1); } - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } H5Awrite(attr, tid, dsetu8); @@ -8495,9 +8485,9 @@ gent_attr_intscalars(void) for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) { - dsetu16[i][j] = dsetu16[i][j-1] << 1; + dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1); } - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } H5Awrite(attr, tid, dsetu16); @@ -8552,9 +8542,9 @@ gent_attr_intscalars(void) for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) { - dset8[i][j] = dset8[i][j-1] << 1; + dset8[i][j] = (int8_t)(dset8[i][j-1] << 1); } - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } H5Awrite(attr, tid, dset8); @@ -8571,9 +8561,9 @@ gent_attr_intscalars(void) for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) { - dset16[i][j] = dset16[i][j-1] << 1; + dset16[i][j] = (int16_t)(dset16[i][j-1] << 1); } - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } H5Awrite(attr, tid, dset16); @@ -8626,7 +8616,7 @@ gent_attr_intscalars(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * j + i; + dsetdbl[i][j] = 0.0001F * (float)j + (float)i; H5Awrite(attr, tid, dsetdbl); @@ -8665,9 +8655,9 @@ gent_string_scalars(void) memset(string, ' ', F73_XDIM * F73_YDIM8); for(i = 0; i < dims[0]; i++) { - string[i][0] = 'A' + i; + string[i][0] = (char)('A' + i); for(j = 1; j < dims[1]; j++) { - string[i][j] = string[i][j-1] + 1; + string[i][j] = (char)(string[i][j-1] + 1); } } string[dims[0]-1][dims[1]-1] = 0; @@ -8740,25 +8730,25 @@ static void gent_compound_int_array(void) { dims[0] = F76_DIM8; valu8bits = (uint8_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dsetu8[n] = valu8bits; - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } /* Array of 16 bits unsigned int */ dims[0] = F76_DIM16; valu16bits = (uint16_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dsetu16[n] = valu16bits; - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } /* Array of 32 bits unsigned int */ dims[0] = F76_DIM32; valu32bits = (uint32_t) ~0u; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dsetu32[n] = valu32bits; valu32bits <<= 1; } @@ -8767,7 +8757,7 @@ static void gent_compound_int_array(void) { dims[0] = F76_DIM64; valu64bits = (uint64_t) ~0Lu; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dsetu64[n] = valu64bits; valu64bits <<= 1; } @@ -8776,25 +8766,25 @@ static void gent_compound_int_array(void) { dims[0] = F76_DIM8; val8bits = (int8_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dset8[n] = val8bits; - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } /* Array of 16 bits signed int */ dims[0] = F76_DIM16; val16bits = (int16_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dset16[n] = val16bits; - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } /* Array of 32 bits signed int */ dims[0] = F76_DIM32; val32bits = (int32_t) ~0; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dset32[n] = val32bits; val32bits <<= 1; } @@ -8803,7 +8793,7 @@ static void gent_compound_int_array(void) { dims[0] = F76_DIM64; val64bits = (int64_t) ~0L; /* all 1s */ - for(n = 0; n < dims[0]; n++){ + for(n = 0; n < (int)dims[0]; n++){ Cmpd1[m].dset64[n] = val64bits; val64bits <<= 1; } @@ -8811,8 +8801,8 @@ static void gent_compound_int_array(void) { /* Double Dummy set for failure tests */ dims[0] = F76_DIM8; - for(n = 0; n < dims[0]; n++) - Cmpd1[m].dsetdbl[n] = 0.0001F + n; + for(n = 0; n < (int)dims[0]; n++) + Cmpd1[m].dsetdbl[n] = 0.0001F + (float)n; } /* Create the array data type for the 8 bits signed int array */ @@ -8991,14 +8981,14 @@ static void gent_compound_ints(void) { valu8bits = (uint8_t) ~0u; /* all 1s */ Cmpd1[m].dsetu8 = valu8bits; Cmpd2[m].dsetu8 = valu8bits; - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); /* Array of 16 bits unsigned int */ if((m % F76_DIM16) == 0) valu16bits = (uint16_t) ~0u; /* all 1s */ Cmpd1[m].dsetu16 = valu16bits; Cmpd2[m].dsetu16 = valu16bits; - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); /* Array of 32 bits unsigned int */ if((m % F76_DIM32) == 0) @@ -9019,14 +9009,14 @@ static void gent_compound_ints(void) { val8bits = (int8_t) ~0; /* all 1s */ Cmpd1[m].dset8 = val8bits; Cmpd2[m].dset8 = val8bits; - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); /* Array of 16 bits signed int */ if((m % F76_DIM16) == 0) val16bits = (int16_t) ~0; /* all 1s */ Cmpd1[m].dset16 = val16bits; Cmpd2[m].dset16 = val16bits; - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); /* Array of 32 bits signed int */ if((m % F76_DIM32) == 0) @@ -9043,8 +9033,8 @@ static void gent_compound_ints(void) { val64bits <<= 1; /* Double Dummy set for failure tests */ - Cmpd1[m].dsetdbl = 0.0001F + m; - Cmpd2[m].dsetdbl = 0.0001F + m; + Cmpd1[m].dsetdbl = 0.0001F + (float)m; + Cmpd2[m].dsetdbl = 0.0001F + (float)m; } /* Create the dataspace */ @@ -9199,9 +9189,9 @@ gent_intattrscalars(void) for(i = 0; i < dims[0]; i++){ dsetu8[i][0] = valu8bits; for(j = 1; j < dims[1]; j++) { - dsetu8[i][j] = dsetu8[i][j-1] << 1; + dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1); } - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -9222,9 +9212,9 @@ gent_intattrscalars(void) for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) { - dsetu16[i][j] = dsetu16[i][j-1] << 1; + dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1); } - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -9291,9 +9281,9 @@ gent_intattrscalars(void) for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) { - dset8[i][j] = dset8[i][j-1] << 1; + dset8[i][j] = (int8_t)(dset8[i][j-1] << 1); } - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -9314,9 +9304,9 @@ gent_intattrscalars(void) for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) { - dset16[i][j] = dset16[i][j-1] << 1; + dset16[i][j] = (int16_t)(dset16[i][j-1] << 1); } - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -9381,7 +9371,7 @@ gent_intattrscalars(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001F * j + i; + dsetdbl[i][j] = 0.0001F * (float)j + (float)i; H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); /* Attribute of double */ @@ -9433,10 +9423,10 @@ gent_intsattrs(void) dsetu8[i][0] = valu8bits; asetu8[i*dims[1]] = dsetu8[i][0]; for(j = 1; j < dims[1]; j++) { - dsetu8[i][j] = dsetu8[i][j-1] << 1; + dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1); asetu8[i*dims[1]+j] = dsetu8[i][j]; } - valu8bits <<= 1; + valu8bits = (uint8_t)(valu8bits << 1); } H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -9460,10 +9450,10 @@ gent_intsattrs(void) dsetu16[i][0] = valu16bits; asetu16[i*dims[1]] = dsetu16[i][0]; for(j = 1; j < dims[1]; j++) { - dsetu16[i][j] = dsetu16[i][j-1] << 1; + dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1); asetu16[i*dims[1]+j] = dsetu16[i][j]; } - valu16bits <<= 1; + valu16bits = (uint16_t)(valu16bits << 1); } H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -9541,10 +9531,10 @@ gent_intsattrs(void) dset8[i][0] = val8bits; aset8[i*dims[1]] = dset8[i][0]; for(j = 1; j < dims[1]; j++) { - dset8[i][j] = dset8[i][j-1] << 1; + dset8[i][j] = (int8_t)(dset8[i][j-1] << 1); aset8[i*dims[1]+j] = dset8[i][j]; } - val8bits <<= 1; + val8bits = (int8_t)(val8bits << 1); } H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -9568,10 +9558,10 @@ gent_intsattrs(void) dset16[i][0] = val16bits; aset16[i*dims[1]] = dset16[i][0]; for(j = 1; j < dims[1]; j++) { - dset16[i][j] = dset16[i][j-1] << 1; + dset16[i][j] = (int16_t)(dset16[i][j-1] << 1); aset16[i*dims[1]+j] = dset16[i][j]; } - val16bits <<= 1; + val16bits = (int16_t)(val16bits << 1); } H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -9646,7 +9636,7 @@ gent_intsattrs(void) for(i = 0; i < dims[0]; i++) for(j = 0; j < dims[1]; j++) { - dsetdbl[i][j] = 0.0001F * j + i; + dsetdbl[i][j] = 0.0001F * (float)j + (float)i; asetdbl[i*dims[1]+j] = dsetdbl[i][j]; } @@ -9823,7 +9813,7 @@ static void gent_bitnopaquefields(void) static void gent_intsfourdims(void) { - hid_t fid, dataset, space, tid; + hid_t fid, dataset, space; hsize_t dims[F81_RANK]; uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM]; unsigned int i, j, k, l; diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 9c01b7e..547f61a 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -36,7 +36,7 @@ #define USERBLOCK_XFER_SIZE 512 /* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */ -#define CHECK_H5DRW_ERROR(_fun, _did, _mtid, _msid, _fsid, _pid, _buf) { \ +#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \ H5E_BEGIN_TRY { \ if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \ hid_t _err_num = 0; \ @@ -44,7 +44,7 @@ H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \ - goto done; \ + HGOTO_DONE(_fail) \ } \ } H5E_END_TRY; \ } @@ -97,170 +97,166 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *------------------------------------------------------------------------- */ -int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { +int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) +{ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t fidin; - hid_t fidout = -1; - trav_table_t *travt = NULL; - hsize_t ub_size = 0; /* size of user block */ - hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ - hid_t fapl = H5P_DEFAULT; /* file access property list ID */ - - /*------------------------------------------------------------------------- - * open input file - *------------------------------------------------------------------------- - */ - if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, - (size_t) 0)) < 0) { - error_msg("<%s>: %s\n", fnamein, H5FOPENERROR); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + hid_t fidout = -1; + trav_table_t *travt = NULL; + hsize_t ub_size = 0; /* size of user block */ + hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ + hid_t fapl = H5P_DEFAULT; /* file access property list ID */ + + /*------------------------------------------------------------------------- + * open input file + *------------------------------------------------------------------------- + */ + if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) { + error_msg("<%s>: %s\n", fnamein, H5FOPENERROR); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - /* get user block size and file space strategy/threshold */ - { - hid_t fcpl_in; /* file creation property list ID for input file */ + /* get user block size and file space strategy/threshold */ + { + hid_t fcpl_in; /* file creation property list ID for input file */ - if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) { + error_msg("failed to retrieve file creation property list\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - if (H5Pget_userblock(fcpl_in, &ub_size) < 0) { - error_msg("failed to retrieve userblock size\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Pget_userblock(fcpl_in, &ub_size) < 0) { + error_msg("failed to retrieve userblock size\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - if (!options->fs_strategy) { - if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) { - error_msg("failed to retrieve file space strategy\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + if (!options->fs_strategy) { + if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) { + error_msg("failed to retrieve file space strategy\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - } + } - if (!options->fs_threshold) { - if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) { - error_msg("failed to retrieve file space threshold\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + if (!options->fs_threshold) { + if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) { + error_msg("failed to retrieve file space threshold\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - } + } - if (H5Pclose(fcpl_in) < 0) { - error_msg("failed to close property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Pclose(fcpl_in) < 0) { + error_msg("failed to close property list\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - } + } - /* Check if we need to create a non-default file creation property list */ - if (options->latest || ub_size > 0) { - /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /* Check if we need to create a non-default file creation property list */ + if (options->latest || ub_size > 0) { + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - if (ub_size > 0) { - if (H5Pset_userblock(fcpl, ub_size) < 0) { - error_msg("failed to set non-default userblock size\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + if (ub_size > 0) { + if (H5Pset_userblock(fcpl, ub_size) < 0) { + error_msg("failed to set non-default userblock size\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - } + } - if (options->latest) { - unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; + if (options->latest) { + unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; - /* Adjust group creation parameters for root group */ - /* (So that it is created in "dense storage" form) */ - if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, - (unsigned) options->grp_indexed) < 0) { - error_msg( - "fail to adjust group creation parameters for root group\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /* Adjust group creation parameters for root group */ + /* (So that it is created in "dense storage" form) */ + if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, + (unsigned) options->grp_indexed) < 0) { + error_msg("fail to adjust group creation parameters for root group\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - for (i = 0; i < 5; i++) { - if (options->msg_size[i] > 0) { - switch (i) { - case 0: - mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; - break; - - case 1: - mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; - break; - - case 2: - mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; - break; - - case 3: - mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; - break; - - case 4: - mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; - break; - default: - break; - } /* end switch */ - min_mesg_sizes[nindex] = (unsigned) options->msg_size[i]; - - nindex++; - } /* end if */ - } /* end for */ - - if (nindex > 0) { - if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { - error_msg( - "fail to set the number of shared object header message indexes\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + for (i = 0; i < 5; i++) { + if (options->msg_size[i] > 0) { + switch (i) { + case 0: + mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; + break; + + case 1: + mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; + break; + + case 2: + mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; + break; + + case 3: + mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; + break; + + case 4: + mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; + break; + + default: + break; + } /* end switch */ + min_mesg_sizes[nindex] = (unsigned) options->msg_size[i]; + + nindex++; + } /* end if */ + } /* end for */ + + if (nindex > 0) { + if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { + error_msg("fail to set the number of shared object header message indexes\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ - for (i = 0; i < (nindex - 1); i++) { - if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], - min_mesg_sizes[i]) < 0) { - error_msg( - "fail to configure the specified shared object header message index\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ + for (i = 0; i < (nindex - 1); i++) { + if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) { + error_msg("fail to configure the specified shared object header message index\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } /* end if */ - } /* end for */ - } /* if (nindex>0) */ + } /* end for */ + } /* if (nindex>0) */ - /* Create file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /* Create file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + error_msg("Could not create file access property list\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } /* end if */ - if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - error_msg( - "Could not set property for using latest version of the format\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + error_msg("Could not set property for using latest version of the format\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } /* end if */ - } /* end if */ - } /* end if */ + } /* end if */ + } /* end if */ #if defined (H5REPACK_DEBUG_USER_BLOCK) - print_user_block(fnamein, fidin); +print_user_block(fnamein, fidin); #endif - /*------------------------------------------------------------------------- - * set the new user userblock options in the FCPL (before H5Fcreate ) - *------------------------------------------------------------------------- - */ - if (options->ublock_size > 0) { - /* either use the FCPL already created or create a new one */ - if (fcpl == H5P_DEFAULT) { - /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /*------------------------------------------------------------------------- + * set the new user userblock options in the FCPL (before H5Fcreate ) + *------------------------------------------------------------------------- + */ + if (options->ublock_size > 0) { + /* either use the FCPL already created or create a new one */ + if (fcpl == H5P_DEFAULT) { + /* create a file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - } + } /* set user block size */ if (H5Pset_userblock(fcpl, options->ublock_size) < 0) { error_msg("failed to set userblock size\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } } @@ -274,13 +270,13 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg("Could not create file access property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } } if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { error_msg("failed to set alignment\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } } @@ -294,13 +290,13 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg("Could not create file access property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } } if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) { error_msg("failed to set metadata block size\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } } @@ -314,14 +310,14 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* create a file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } } /* set file space strategy and free space threshold */ if (H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { error_msg("failed to set file space strategy & threshold \n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } /*------------------------------------------------------------------------- @@ -333,7 +329,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { error_msg("<%s>: Could not create file\n", fnameout); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } /*------------------------------------------------------------------------- @@ -341,95 +337,91 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) *------------------------------------------------------------------------- */ if (options->ublock_size > 0) { - if (copy_user_block(options->ublock_filename, fnameout, - options->ublock_size) < 0) { + if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) { error_msg("Could not copy user block. Exiting...\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } } - /*------------------------------------------------------------------------- - * get list of objects - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * get list of objects + *------------------------------------------------------------------------- + */ - /* init table */ - trav_table_init(&travt); + /* init table */ + trav_table_init(&travt); - /* get the list of objects in the file */ - if (h5trav_gettable(fidin, travt) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /* get the list of objects in the file */ + if (h5trav_gettable(fidin, travt) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - if (do_copy_objects(fidin, fidout, travt, options) < 0) { - error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + if (do_copy_objects(fidin, fidout, travt, options) < 0) { + error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } /* end if */ - /*------------------------------------------------------------------------- - * do the copy of referenced objects - * and create hard links - *------------------------------------------------------------------------- - */ - if (do_copy_refobjs(fidin, fidout, travt, options) < 0) { - printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, - fnameout); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /*------------------------------------------------------------------------- + * do the copy of referenced objects + * and create hard links + *------------------------------------------------------------------------- + */ + if (do_copy_refobjs(fidin, fidout, travt, options) < 0) { + printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (fapl > 0) - H5Pclose(fapl); + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ - if (fcpl > 0) - H5Pclose(fcpl); + if (fapl > 0) + H5Pclose(fapl); - H5Fclose(fidin); - H5Fclose(fidout); + if (fcpl > 0) + H5Pclose(fcpl); - /* free table */ - trav_table_free(travt); - travt = NULL; + H5Fclose(fidin); + H5Fclose(fidout); - /*------------------------------------------------------------------------- - * write only the input file user block if there is no user block file input - *------------------------------------------------------------------------- - */ + /* free table */ + trav_table_free(travt); + travt = NULL; - if (ub_size > 0 && options->ublock_size == 0) { - if (copy_user_block(fnamein, fnameout, ub_size) < 0) { - error_msg("Could not copy user block. Exiting...\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /*------------------------------------------------------------------------- + * write only the input file user block if there is no user block file input + *------------------------------------------------------------------------- + */ - } - } + if (ub_size > 0 && options->ublock_size == 0) { + if (copy_user_block(fnamein, fnameout, ub_size) < 0) { + error_msg("Could not copy user block. Exiting...\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + } + } - return 0; + return 0; - /*------------------------------------------------------------------------- - * out - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * out + *------------------------------------------------------------------------- + */ done: - H5E_BEGIN_TRY - { - H5Pclose(fapl); - H5Pclose(fcpl); - H5Fclose(fidin); - H5Fclose(fidout); - }H5E_END_TRY; - if (travt) - trav_table_free(travt); - - return -1; + H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Pclose(fcpl); + H5Fclose(fidin); + H5Fclose(fidout); + } H5E_END_TRY; + if (travt) + trav_table_free(travt); + + return ret_value; } /*------------------------------------------------------------------------- @@ -470,133 +462,126 @@ done: *-----------------------------------------*/ int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], - size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) { + size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) +{ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - int status = 0; - int k; - H5D_layout_t dset_layout; - int rank_chunk; - hsize_t dims_chunk[H5S_MAX_RANK]; - hsize_t size_chunk = 1; - hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ - hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ - hsize_t hslab_nbytes; /* size of hyperslab in byte */ - - /* init to set as size of a data element */ - hslab_nbytes = size_datum; - - /* get layout of dataset */ - dset_layout = H5Pget_layout(dcpl_id); - - /* if dataset is chunked */ - if (dset_layout == H5D_CHUNKED) { - /* get chunk dims */ - rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); - if (rank_chunk < 0) { - status = -1; - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + int k; + H5D_layout_t dset_layout; + int rank_chunk; + hsize_t dims_chunk[H5S_MAX_RANK]; + hsize_t size_chunk = 1; + hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ + hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ + hsize_t hslab_nbytes; /* size of hyperslab in byte */ + + /* init to set as size of a data element */ + hslab_nbytes = size_datum; + + /* get layout of dataset */ + dset_layout = H5Pget_layout(dcpl_id); + + /* if dataset is chunked */ + if (dset_layout == H5D_CHUNKED) { + /* get chunk dims */ + rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); + if (rank_chunk < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + + for (k = rank_dset; k > 0; --k) + size_chunk *= dims_chunk[k - 1]; + + /* figure out how many chunks can fit in the hyperslab buffer */ + nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; + + /* 1. if a chunk fit in hyperslab buffer */ + if (nchunk_fit >= 1) { + /* Calulate a hyperslab that contains as many chunks that can fit + * in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + * In the loop, used mapping from a datum to a chunk to figure out + * chunk based hyperslab. + */ + for (k = rank_dset; k > 0; --k) { + /* map dataset dimentions with a chunk dims */ + chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1]; + + /* if reminder exist, increse by 1 to cover partial edge chunks */ + if (dims_dset[k - 1] % dims_chunk[k - 1] > 0) + chunk_dims_map[k - 1]++; + + /* get mapped hyperslab dims */ + hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]); + + /* prepare next round */ + nchunk_fit = nchunk_fit / chunk_dims_map[k - 1]; + /* if a chunk is bigger than the rest of buffer */ + if (nchunk_fit == 0) + nchunk_fit = 1; + + /* get hyperslab dimentions as unmapping to actual size */ + dims_hslab[k - 1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + } } - - for (k = rank_dset; k > 0; --k) - size_chunk *= dims_chunk[k - 1]; - - /* figure out how many chunks can fit in the hyperslab buffer */ - nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; - - /* 1. if a chunk fit in hyperslab buffer */ - if (nchunk_fit >= 1) { - /* Calulate a hyperslab that contains as many chunks that can fit - * in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - * In the loop, used mapping from a datum to a chunk to figure out - * chunk based hyperslab. - */ - for (k = rank_dset; k > 0; --k) { - /* map dataset dimentions with a chunk dims */ - chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1]; - - /* if reminder exist, increse by 1 to cover partial edge chunks */ - if (dims_dset[k - 1] % dims_chunk[k - 1] > 0) - chunk_dims_map[k - 1]++; - - /* get mapped hyperslab dims */ - hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]); - - /* prepare next round */ - nchunk_fit = nchunk_fit / chunk_dims_map[k - 1]; - /* if a chunk is bigger than the rest of buffer */ - if (nchunk_fit == 0) - nchunk_fit = 1; - - /* get hyperslab dimentions as unmapping to actual size */ - dims_hslab[k - 1] = - MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - } - } - /* 2. if a chunk is bigger than hyperslab buffer */ - else { - /* Calulate a hyperslab that contains as many data elements that - * can fit in hyperslab buffer. Hyperslab will be increased - * starting from the last dimention of the chunk (see h5dump's dims - * output). - * The calculation boundary is a chunk dims. - */ - for (k = rank_dset; k > 0; --k) { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if (ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within a chunk boundary */ - dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) { - status = -1; - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - } - } - /* 3. if dataset is not chunked */ - else { - /* Calulate a hyperslab that contains as many data elements that can - * fit in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - */ - for (k = rank_dset; k > 0; --k) { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if (ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within dataset boundary */ - dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) { - status = -1; - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + /* 2. if a chunk is bigger than hyperslab buffer */ + else { + /* Calulate a hyperslab that contains as many data elements that + * can fit in hyperslab buffer. Hyperslab will be increased + * starting from the last dimention of the chunk (see h5dump's dims + * output). + * The calculation boundary is a chunk dims. + */ + for (k = rank_dset; k > 0; --k) { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if (ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within a chunk boundary */ + dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); } - } - } + } + } + /* 3. if dataset is not chunked */ + else { + /* Calulate a hyperslab that contains as many data elements that can + * fit in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + */ + for (k = rank_dset; k > 0; --k) { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if (ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within dataset boundary */ + dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + } + } - /* pass out the hyperslab size*/ - *hslab_nbytes_p = hslab_nbytes; + /* pass out the hyperslab size*/ + *hslab_nbytes_p = hslab_nbytes; done: - return status; + return ret_value; } /*------------------------------------------------------------------------- @@ -698,709 +683,637 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, { int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t grp_in = -1; /* group ID */ - hid_t grp_out = -1; /* group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t gcpl_in = -1; /* group creation property list */ - hid_t gcpl_out = -1; /* group creation property list */ - hid_t type_in = -1; /* named type ID */ - hid_t type_out = -1; /* named type ID */ - hid_t dcpl_in = -1; /* dataset creation property list ID */ - hid_t dcpl_out = -1; /* dataset creation property list ID */ - hid_t f_space_id = -1; /* file space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ - named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ - size_t msize; /* size of type */ - hsize_t nelmts; /* number of elements in dataset */ - H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */ - int rank; /* rank of dataset */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - hsize_t dsize_in; /* input dataset size before filter */ - hsize_t dsize_out; /* output dataset size after filter */ - int apply_s; /* flag for apply filter to small dataset sizes */ - int apply_f; /* flag for apply filter to return error on H5Dcreate */ - void *buf = NULL; /* buffer for raw data */ - void *hslab_buf = NULL; /* hyperslab buffer for raw data */ - int has_filter; /* current object has a filter */ - int req_filter; /* there was a request for a filter */ - int req_obj_layout = 0; /* request layout to current object */ - unsigned crt_order_flags; /* group creation order flag */ - unsigned i; - unsigned u; - int is_ref = 0; - htri_t is_named; - hbool_t limit_maxdims; - hsize_t size_dset; - - /*------------------------------------------------------------------------- - * copy the suppplied object list - *------------------------------------------------------------------------- - */ - - if (options->verbose) { - printf("-----------------------------------------\n"); - printf(" Type Filter (Compression) Name\n"); - printf("-----------------------------------------\n"); - } - - for (i = 0; i < travt->nobjs; i++) { - /* init variables per obj */ - buf = NULL; - limit_maxdims = FALSE; - - switch (travt->objs[i].type) { - - case H5TRAV_TYPE_UNKNOWN: - HDassert(0); - break; - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_GROUP: - - if (options->verbose) { - printf(FORMAT_OBJ, "group", travt->objs[i].name); - } - - /* open input group */ - if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) - < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed"); - - /* get input group creation property list */ - if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gget_create_plist failed"); - - /* query and set the group creation properties */ - if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); - - /* set up group creation property list */ - if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pcreate failed"); - - if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); - - /*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group - * and copy its attributes using that ID - *------------------------------------------------------------------------- - */ - if (HDstrcmp(travt->objs[i].name, "/") == 0) { - if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed"); - } - else { - - if (options->grp_compact > 0 || options->grp_indexed > 0) { - if (H5Pset_link_phase_change(gcpl_out, - (unsigned) options->grp_compact, - (unsigned) options->grp_indexed) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pset_link_phase_change failed"); - } - - if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, - H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gcreate2 failed"); - - } - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed"); - - if (H5Pclose(gcpl_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Pclose(gcpl_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Gclose(grp_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed"); - if (H5Gclose(grp_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed"); - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_DATASET: - - has_filter = 0; - req_filter = 0; - - /* check if global filters were requested */ - if (options->n_filter_g) - req_filter = 1; - - /* check if filters were requested for individual objects */ - for (u = 0; u < options->op_tbl->nelems; u++) { - - if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) { - if (options->op_tbl->objs[u].filter->filtn > 0) { - req_filter = 1; - } - } - } - - /* check if layout change requested individual object */ - if (options->layout_g != H5D_LAYOUT_ERROR) { - pack_info_t *pckinfo; - /* any dataset is specified */ - if (options->op_tbl->nelems > 0) { - /* check if object exist */ - pckinfo = options_get_object(travt->objs[i].name, - options->op_tbl); - if (pckinfo) { - req_obj_layout = 1; - } - } - } - - /* early detection of references */ - if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) - < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); - if ((ftype_id = H5Dget_type(dset_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed"); - if (H5T_REFERENCE == H5Tget_class(ftype_id)) - is_ref = 1; - - /* Check if the datatype is committed */ - if ((is_named = H5Tcommitted(ftype_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tcommitted failed"); - if (is_named) - if ((wtype_id = copy_named_datatype(ftype_id, fidout, - &named_dt_head, travt, options)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_named_datatype failed"); - - if (H5Tclose(ftype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Dclose(dset_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); - - /*------------------------------------------------------------------------- - * check if we should use H5Ocopy or not - * if there is a request for filters/layout, we read/write the object - * otherwise we do a copy using H5Ocopy - *------------------------------------------------------------------------- - */ - if (options->op_tbl->nelems || options->all_filter == 1 - || options->all_layout == 1 || is_ref || is_named) { - - int j; - - if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); - if ((f_space_id = H5Dget_space(dset_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed"); - if ((ftype_id = H5Dget_type(dset_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed"); - if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pcopy failed"); - if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - HDmemset(dims, 0, sizeof dims); - if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - if (H5Dget_space_status(dset_in, &space_status) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space_status failed"); - - nelmts = 1; - for (j = 0; j < rank; j++) - nelmts *= dims[j]; - - /* wtype_id will have already been set if using a named dtype */ - if (!is_named) { - if (options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end if */ - - if ((msize = H5Tget_size(wtype_id)) == 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed"); - - /* size of current dset */ - size_dset = nelmts * msize; - - /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration - * 1) the external filters GZIP and SZIP might not be available - * 2) the internal filters might be turned off - *------------------------------------------------------------------------- - */ - if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) { - apply_s = 1; - apply_f = 1; - - /*------------------------------------------------------------------------- - * references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - * in a second traversal of the output file - *------------------------------------------------------------------------- - */ - if (H5T_REFERENCE != H5Tget_class(wtype_id)) { - /* get the storage size of the input dataset */ - dsize_in = H5Dget_storage_size(dset_in); - - /* check for small size datasets (less than 1k) except - * changing to COMPACT. For the reference, COMPACT is limited - * by size 64K by library. - */ - if (options->layout_g != H5D_COMPACT) { - if (size_dset < options->min_comp) - apply_s = 0; - } - - /* apply the filter */ - if (apply_s) { - if (apply_filters(travt->objs[i].name, rank, dims, - msize, dcpl_out, options, &has_filter) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "apply_filters failed"); - } - - /* only if layout change requested for entire file or - * individual obj */ - if (options->all_layout > 0 || req_obj_layout == 1) - /*------------------------------------------------- - * Unset the unlimited max dims if convert to other - * than chunk layouts, because unlimited max dims - * only can be applied to chunk layout. - * Also perform only for targeted dataset - * Also check for size limit to convert to compact - *-------------------------------------------------*/ - if (options->layout_g != H5D_CHUNKED) { - /* any dataset is specified */ - if (options->op_tbl->nelems > 0) { - /* if current obj match specified obj */ - if (options_get_object(travt->objs[i].name, - options->op_tbl)) - limit_maxdims = TRUE; - } - else { /* no dataset is specified */ - limit_maxdims = TRUE; - } - - /* if convert to COMPACT */ - if (options->layout_g == H5D_COMPACT) { - /* should be smaller than 64K */ - if (size_dset > MAX_COMPACT_DSIZE) - limit_maxdims = FALSE; - } - - /* unset unlimited max dims */ - if (limit_maxdims) - H5Sset_extent_simple(f_space_id, rank, dims, - NULL); - } - - /*------------------------------------------------------------------------- - * create the output dataset; - * disable error checking in case the dataset cannot be created with the - * modified dcpl; in that case use the original instead - *------------------------------------------------------------------------- - */ - dset_out = H5Dcreate2(fidout, - travt->objs[i].name, wtype_id, - f_space_id, H5P_DEFAULT, dcpl_out, - H5P_DEFAULT); - - if (dset_out == FAIL) { - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); - if (options->verbose) - printf( - " warning: could not create dataset <%s>. Applying original settings\n", - travt->objs[i].name); - - if ((dset_out = H5Dcreate2(fidout, - travt->objs[i].name, wtype_id, f_space_id, - H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); - apply_f = 0; - } - - /*------------------------------------------------------------------------- - * read/write - *------------------------------------------------------------------------- - */ - if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) { - size_t need = (size_t)(nelmts * msize); /* bytes needed */ - - /* have to read the whole dataset if there is only one element in the dataset */ - if (need < H5TOOLS_MALLOCSIZE) - buf = HDmalloc(need); - - if (buf != NULL) { - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, - H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, - H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - - /* Check if we have VL data in the dataset's - * datatype that must be reclaimed */ - if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) - if (H5Dvlen_reclaim(wtype_id, f_space_id, - H5P_DEFAULT, buf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dvlen_reclaim failed"); - } - else { /* possibly not enough memory, read/write by hyperslabs */ - size_t p_type_nbytes = msize; /*size of memory type */ - hsize_t p_nelmts = nelmts; /*total elements */ - hsize_t elmtno; /*counter */ - int carry; /*counter carry value */ - unsigned int vl_data = 0; /*contains VL datatypes */ - - /* hyperslab info */ - hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */ - hsize_t hslab_nbytes; /*bytes per hyperslab */ - hsize_t hslab_nelmts; /*elements per hyperslab*/ - hid_t hslab_space; /*hyperslab data space */ - - /* hyperslab selection info */ - hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */ - hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */ - hsize_t hs_select_nelmts; /* selected elements */ - hsize_t zero[8]; /*vector of zeros */ - int k; - H5D_layout_t dset_layout; - hid_t dcpl_tmp = -1; /* dataset creation property list ID */ - - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* check first if writing dataset is chunked, - * if so use its chunk layout for better performance. */ - dset_layout = H5Pget_layout(dcpl_out); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_out; /* writing dataset */ - else { /* if reading dataset is chunked */ - dset_layout = H5Pget_layout(dcpl_in); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_in; /* reading dataset */ - } - - /* get hyperslab dims and size in byte */ - if (Get_hyperslab(dcpl_tmp, rank, dims, - p_type_nbytes, hslab_dims, - &hslab_nbytes) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "Get_hyperslab failed"); - - hslab_buf = HDmalloc((size_t)hslab_nbytes); - - hslab_nelmts = hslab_nbytes / p_type_nbytes; - hslab_space = H5Screate_simple(1, &hslab_nelmts, - NULL); - - /* the hyperslab selection loop */ - HDmemset(hs_sel_offset, 0, - sizeof hs_sel_offset); - HDmemset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += - hs_select_nelmts) { - if (rank > 0) { - /* calculate the hyperslab selections. The selection would be same as the hyperslab except for remaining edge portion of the dataset which is smaller then the hyperslab. - */ - for (k = 0, hs_select_nelmts = 1; - k < rank; k++) { - /* MIN() is used to get the remaining edge portion if exist. - * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ - hs_sel_count[k] = - MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); - hs_select_nelmts *= hs_sel_count[k]; - } - - if (H5Sselect_hyperslab(f_space_id, - H5S_SELECT_SET, hs_sel_offset, - NULL, hs_sel_count, NULL) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - if (H5Sselect_hyperslab(hslab_space, - H5S_SELECT_SET, zero, NULL, - &hs_select_nelmts, NULL) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - } - else { - H5Sselect_all(f_space_id); - H5Sselect_all(hslab_space); - hs_select_nelmts = 1; - } /* rank */ - - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, dset_in, - wtype_id, hslab_space, f_space_id, - H5P_DEFAULT, hslab_buf); - CHECK_H5DRW_ERROR(H5Dwrite, dset_out, - wtype_id, hslab_space, f_space_id, - H5P_DEFAULT, hslab_buf); - - /* reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(wtype_id, hslab_space, - H5P_DEFAULT, hslab_buf); - - /* calculate the next hyperslab offset */ - for (k = rank, carry = 1; k > 0 && carry; - --k) { - hs_sel_offset[k - 1] += hs_sel_count[k - - 1]; - /* if reached the end of a dim */ - if (hs_sel_offset[k - 1] == dims[k - 1]) - hs_sel_offset[k - 1] = 0; - else - carry = 0; - } /* k */ - } /* elmtno */ - - H5Sclose(hslab_space); - /* free */ - if (hslab_buf != NULL) { - HDfree(hslab_buf); - hslab_buf = NULL; - } - } /* hyperslab read */ - } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ - - /*------------------------------------------------------------------------- - * amount of compression used - *------------------------------------------------------------------------- - */ - if (options->verbose) { - double ratio = 0; - - /* only print the compression ration if there was a filter request */ - if (apply_s && apply_f && req_filter) { - /* get the storage size of the output dataset */ - dsize_out = H5Dget_storage_size(dset_out); - - /* compression ratio = uncompressed size / compressed size */ - if (dsize_out != 0) - ratio = (double) dsize_in - / (double) dsize_out; - - print_dataset_info(dcpl_out, - travt->objs[i].name, ratio, 1); - } - else - print_dataset_info(dcpl_in, travt->objs[i].name, - ratio, 0); - - /* print a message that the filter was not applied - (in case there was a filter) - */ - if (has_filter && apply_s == 0) - printf( - " <warning: filter not applied to %s. dataset smaller than %d bytes>\n", - travt->objs[i].name, - (int) options->min_comp); - - if (has_filter && apply_f == 0) - printf( - " <warning: could not apply the filter to %s>\n", - travt->objs[i].name); - - } /* verbose */ - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(dset_in, dset_out, &named_dt_head, travt, - options) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed"); - /*close */ - if (H5Dclose(dset_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); - - }/*!H5T_REFERENCE*/ - }/*h5tools_canreadf*/ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if (H5Tclose(ftype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Tclose(wtype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Pclose(dcpl_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Pclose(dcpl_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Sclose(f_space_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - if (H5Dclose(dset_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); - - } - /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead - *------------------------------------------------------------------------- - */ - else { - hid_t pid; - - /* create property to pass copy options */ - if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pcreate failed"); - - /* set options for object copy */ - if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pset_copy_object failed"); - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - - if (H5Ocopy(fidin, /* Source file or group identifier */ - travt->objs[i].name, /* Name of the source object to be copied */ - fidout, /* Destination file or group identifier */ - travt->objs[i].name, /* Name of the destination object */ - pid, /* Properties which apply to the copy */ - H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ocopy failed"); - - /* close property */ - if (H5Pclose(pid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - - /*------------------------------------------------------------------------- - * copy attrs manually - *------------------------------------------------------------------------- - */ - if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) - < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); - if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); - if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed"); - if (H5Dclose(dset_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); - if (H5Dclose(dset_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); - - if (options->verbose) - printf(FORMAT_OBJ, "dset", travt->objs[i].name); - - } /* end do we have request for filter/chunking */ - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_NAMED_DATATYPE: - - if (options->verbose) - printf(FORMAT_OBJ, "type", travt->objs[i].name); - - if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Topen2 failed"); + hid_t grp_out = -1; /* group ID */ + hid_t dset_in = -1; /* read dataset ID */ + hid_t dset_out = -1; /* write dataset ID */ + hid_t gcpl_in = -1; /* group creation property list */ + hid_t gcpl_out = -1; /* group creation property list */ + hid_t type_in = -1; /* named type ID */ + hid_t type_out = -1; /* named type ID */ + hid_t dcpl_in = -1; /* dataset creation property list ID */ + hid_t dcpl_out = -1; /* dataset creation property list ID */ + hid_t f_space_id = -1; /* file space ID */ + hid_t ftype_id = -1; /* file type ID */ + hid_t wtype_id = -1; /* read/write type ID */ + named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ + size_t msize; /* size of type */ + hsize_t nelmts; /* number of elements in dataset */ + H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */ + int rank; /* rank of dataset */ + hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ + hsize_t dsize_in; /* input dataset size before filter */ + hsize_t dsize_out; /* output dataset size after filter */ + int apply_s; /* flag for apply filter to small dataset sizes */ + int apply_f; /* flag for apply filter to return error on H5Dcreate */ + void *buf = NULL; /* buffer for raw data */ + void *hslab_buf = NULL; /* hyperslab buffer for raw data */ + int has_filter; /* current object has a filter */ + int req_filter; /* there was a request for a filter */ + int req_obj_layout = 0; /* request layout to current object */ + unsigned crt_order_flags; /* group creation order flag */ + unsigned i; + unsigned u; + int is_ref = 0; + htri_t is_named; + hbool_t limit_maxdims; + hsize_t size_dset; - /* Copy the datatype anonymously */ - if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, - travt, options)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_named_datatype failed"); - - /* Link in to group structure */ - if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, - H5P_DEFAULT, H5P_DEFAULT) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Lcreate_hard failed"); - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed"); - - if (H5Tclose(type_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Tclose(type_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + /*------------------------------------------------------------------------- + * copy the suppplied object list + *------------------------------------------------------------------------- + */ - break; + if (options->verbose) { + printf("-----------------------------------------\n"); + printf(" Type Filter (Compression) Name\n"); + printf("-----------------------------------------\n"); + } - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_LINK - * H5TRAV_TYPE_UDLINK - * - * Only handles external links; H5Lcopy will fail for other UD link types - * since we don't have creation or copy callbacks for them. - *------------------------------------------------------------------------- - */ + for (i = 0; i < travt->nobjs; i++) { + /* init variables per obj */ + buf = NULL; + limit_maxdims = FALSE; + + switch (travt->objs[i].type) { + case H5TRAV_TYPE_UNKNOWN: + HDassert(0); + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_GROUP + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_GROUP: + if (options->verbose) + printf(FORMAT_OBJ, "group", travt->objs[i].name); + + /* open input group */ + if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + + /* get input group creation property list */ + if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + + /* query and set the group creation properties */ + if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + + /* set up group creation property list */ + if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + + if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); + + /*------------------------------------------------------------------------- + * the root is a special case, we get an ID for the root group + * and copy its attributes using that ID + *------------------------------------------------------------------------- + */ + if (HDstrcmp(travt->objs[i].name, "/") == 0) { + if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + } + else { + if (options->grp_compact > 0 || options->grp_indexed > 0) + if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed"); - case H5TRAV_TYPE_LINK: - case H5TRAV_TYPE_UDLINK: { + if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gcreate2 failed"); + } - if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + + if (H5Pclose(gcpl_out) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Pclose(gcpl_in) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Gclose(grp_out) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + if (H5Gclose(grp_in) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_DATASET + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_DATASET: + has_filter = 0; + req_filter = 0; + + /* check if global filters were requested */ + if (options->n_filter_g) + req_filter = 1; + + /* check if filters were requested for individual objects */ + for (u = 0; u < options->op_tbl->nelems; u++) + if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) + if (options->op_tbl->objs[u].filter->filtn > 0) + req_filter = 1; + + /* check if layout change requested individual object */ + if (options->layout_g != H5D_LAYOUT_ERROR) { + pack_info_t *pckinfo; + + /* any dataset is specified */ + if (options->op_tbl->nelems > 0) { + /* check if object exist */ + pckinfo = options_get_object(travt->objs[i].name, options->op_tbl); + if (pckinfo) + req_obj_layout = 1; + } + } - if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, - H5P_DEFAULT, H5P_DEFAULT) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Lcopy failed"); + /* early detection of references */ + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + if ((ftype_id = H5Dget_type(dset_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + if (H5T_REFERENCE == H5Tget_class(ftype_id)) + is_ref = 1; + + /* Check if the datatype is committed */ + if ((is_named = H5Tcommitted(ftype_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); + if (is_named) + if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + + if (H5Tclose(ftype_id) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + if (H5Dclose(dset_in) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + + /*------------------------------------------------------------------------- + * check if we should use H5Ocopy or not + * if there is a request for filters/layout, we read/write the object + * otherwise we do a copy using H5Ocopy + *------------------------------------------------------------------------- + */ + if (options->op_tbl->nelems || options->all_filter == 1 + || options->all_layout == 1 || is_ref || is_named) { + + int j; + + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + if ((f_space_id = H5Dget_space(dset_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + if ((ftype_id = H5Dget_type(dset_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + HDmemset(dims, 0, sizeof dims); + if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + if (H5Dget_space_status(dset_in, &space_status) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space_status failed"); + + nelmts = 1; + for (j = 0; j < rank; j++) + nelmts *= dims[j]; + + /* wtype_id will have already been set if using a named dtype */ + if (!is_named) { + if (options->use_native == 1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end if */ - if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); + if ((msize = H5Tget_size(wtype_id)) == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + /* size of current dset */ + size_dset = nelmts * msize; + + /*------------------------------------------------------------------------- + * check if the dataset creation property list has filters that + * are not registered in the current configuration + * 1) the external filters GZIP and SZIP might not be available + * 2) the internal filters might be turned off + *------------------------------------------------------------------------- + */ + if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) { + apply_s = 1; + apply_f = 1; + + /*------------------------------------------------------------------------- + * references are a special case + * we cannot just copy the buffers, but instead we recreate the reference + * in a second traversal of the output file + *------------------------------------------------------------------------- + */ + if (H5T_REFERENCE != H5Tget_class(wtype_id)) { + /* get the storage size of the input dataset */ + dsize_in = H5Dget_storage_size(dset_in); + + /* check for small size datasets (less than 1k) except + * changing to COMPACT. For the reference, COMPACT is limited + * by size 64K by library. + */ + if (options->layout_g != H5D_COMPACT) + if (size_dset < options->min_comp) + apply_s = 0; + + /* apply the filter */ + if (apply_s) + if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed"); + + /* only if layout change requested for entire file or + * individual obj */ + if (options->all_layout > 0 || req_obj_layout == 1) + /*------------------------------------------------- + * Unset the unlimited max dims if convert to other + * than chunk layouts, because unlimited max dims + * only can be applied to chunk layout. + * Also perform only for targeted dataset + * Also check for size limit to convert to compact + *-------------------------------------------------*/ + if (options->layout_g != H5D_CHUNKED) { + /* any dataset is specified */ + if (options->op_tbl->nelems > 0) { + /* if current obj match specified obj */ + if (options_get_object(travt->objs[i].name, options->op_tbl)) + limit_maxdims = TRUE; + } + else /* no dataset is specified */ + limit_maxdims = TRUE; + + /* if convert to COMPACT */ + if (options->layout_g == H5D_COMPACT) + /* should be smaller than 64K */ + if (size_dset > MAX_COMPACT_DSIZE) + limit_maxdims = FALSE; + + /* unset unlimited max dims */ + if (limit_maxdims) + H5Sset_extent_simple(f_space_id, rank, dims, NULL); + } + + /*------------------------------------------------------------------------- + * create the output dataset; + * disable error checking in case the dataset cannot be created with the + * modified dcpl; in that case use the original instead + *------------------------------------------------------------------------- + */ + dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); + if (dset_out == FAIL) { + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); + if (options->verbose) + printf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); + + if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); + apply_f = 0; + } - } - break; + /*------------------------------------------------------------------------- + * read/write + *------------------------------------------------------------------------- + */ + if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) { + size_t need = (size_t)(nelmts * msize); /* bytes needed */ + + /* have to read the whole dataset if there is only one element in the dataset */ + if (need < H5TOOLS_MALLOCSIZE) + buf = HDmalloc(need); + + if (buf != NULL) { + /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ + CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + + /* Check if we have VL data in the dataset's + * datatype that must be reclaimed */ + if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) + if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dvlen_reclaim failed"); + } + else { /* possibly not enough memory, read/write by hyperslabs */ + size_t p_type_nbytes = msize; /*size of memory type */ + hsize_t p_nelmts = nelmts; /*total elements */ + hsize_t elmtno; /*counter */ + int carry; /*counter carry value */ + unsigned int vl_data = 0; /*contains VL datatypes */ + + /* hyperslab info */ + hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */ + hsize_t hslab_nbytes; /*bytes per hyperslab */ + hsize_t hslab_nelmts; /*elements per hyperslab*/ + hid_t hslab_space; /*hyperslab data space */ + + /* hyperslab selection info */ + hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */ + hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */ + hsize_t hs_select_nelmts; /* selected elements */ + hsize_t zero[8]; /*vector of zeros */ + int k; + H5D_layout_t dset_layout; + hid_t dcpl_tmp = -1; /* dataset creation property list ID */ + + /* check if we have VL data in the dataset's datatype */ + if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* check first if writing dataset is chunked, + * if so use its chunk layout for better performance. */ + dset_layout = H5Pget_layout(dcpl_out); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_out; /* writing dataset */ + else { /* if reading dataset is chunked */ + dset_layout = H5Pget_layout(dcpl_in); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_in; /* reading dataset */ + } - default: - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "Object type not found"); + /* get hyperslab dims and size in byte */ + if (Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Get_hyperslab failed"); + + hslab_buf = HDmalloc((size_t)hslab_nbytes); + + hslab_nelmts = hslab_nbytes / p_type_nbytes; + hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); + + /* the hyperslab selection loop */ + HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset); + HDmemset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) { + if (rank > 0) { + /* calculate the hyperslab selections. + * The selection would be same as the hyperslab + * except for remaining edge portion of the dataset + * which is smaller then the hyperslab. + */ + for (k = 0, hs_select_nelmts = 1; k < rank; k++) { + /* MIN() is used to get the remaining edge portion if exist. + * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ + hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); + hs_select_nelmts *= hs_sel_count[k]; + } + + if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + } + else { + H5Sselect_all(f_space_id); + H5Sselect_all(hslab_space); + hs_select_nelmts = 1; + } /* rank */ + + /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ + CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); + CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); + + /* reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf); + + /* calculate the next hyperslab offset */ + for (k = rank, carry = 1; k > 0 && carry; --k) { + hs_sel_offset[k - 1] += hs_sel_count[k - 1]; + /* if reached the end of a dim */ + if (hs_sel_offset[k - 1] == dims[k - 1]) + hs_sel_offset[k - 1] = 0; + else + carry = 0; + } /* k */ + } /* elmtno */ + + H5Sclose(hslab_space); + /* free */ + if (hslab_buf != NULL) { + HDfree(hslab_buf); + hslab_buf = NULL; + } + } /* hyperslab read */ + } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ + + /*------------------------------------------------------------------------- + * amount of compression used + *------------------------------------------------------------------------- + */ + if (options->verbose) { + double ratio = 0; + + /* only print the compression ration if there was a filter request */ + if (apply_s && apply_f && req_filter) { + /* get the storage size of the output dataset */ + dsize_out = H5Dget_storage_size(dset_out); + + /* compression ratio = uncompressed size / compressed size */ + if (dsize_out != 0) + ratio = (double) dsize_in / (double) dsize_out; + print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1); + } + else + print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0); + + /* print a message that the filter was not applied + (in case there was a filter) + */ + if (has_filter && apply_s == 0) + printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", travt->objs[i].name, (int) options->min_comp); + + if (has_filter && apply_f == 0) + printf(" <warning: could not apply the filter to %s>\n", travt->objs[i].name); + } /* verbose */ + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + + /*close */ + if (H5Dclose(dset_out) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + }/*!H5T_REFERENCE*/ + }/*h5tools_canreadf*/ + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + if (H5Tclose(ftype_id) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + if (H5Tclose(wtype_id) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + if (H5Pclose(dcpl_in) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Pclose(dcpl_out) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Sclose(f_space_id) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + if (H5Dclose(dset_in) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + } + /*------------------------------------------------------------------------- + * we do not have request for filter/chunking use H5Ocopy instead + *------------------------------------------------------------------------- + */ + else { + hid_t pid; + + /* create property to pass copy options */ + if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + + /* set options for object copy */ + if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed"); + + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + + if (H5Ocopy(fidin, /* Source file or group identifier */ + travt->objs[i].name, /* Name of the source object to be copied */ + fidout, /* Destination file or group identifier */ + travt->objs[i].name, /* Name of the destination object */ + pid, /* Properties which apply to the copy */ + H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed"); + + /* close property */ + if (H5Pclose(pid) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + + /*------------------------------------------------------------------------- + * copy attrs manually + *------------------------------------------------------------------------- + */ + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + if (H5Dclose(dset_in) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + if (H5Dclose(dset_out) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + + if (options->verbose) + printf(FORMAT_OBJ, "dset", travt->objs[i].name); + + } /* end do we have request for filter/chunking */ + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_NAMED_DATATYPE + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_NAMED_DATATYPE: + if (options->verbose) + printf(FORMAT_OBJ, "type", travt->objs[i].name); + + if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); + + /* Copy the datatype anonymously */ + if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + + /* Link in to group structure */ + if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcreate_hard failed"); + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + + if (H5Tclose(type_in) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + if (H5Tclose(type_out) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_LINK + * H5TRAV_TYPE_UDLINK + * + * Only handles external links; H5Lcopy will fail for other UD link types + * since we don't have creation or copy callbacks for them. + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_LINK: + case H5TRAV_TYPE_UDLINK: + if (options->verbose) + printf(FORMAT_OBJ, "link", travt->objs[i].name); + + if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed"); + + if (options->verbose) + printf(FORMAT_OBJ, "link", travt->objs[i].name); + break; + + default: + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found"); } /* switch */ - /* free */ - if (buf != NULL) { - HDfree(buf); - buf = NULL; - } + /* free */ + if (buf != NULL) { + HDfree(buf); + buf = NULL; + } + } /* i */ - } /* i */ + /* Finalize (link) the stack of named datatypes (if any) */ + named_datatype_free(&named_dt_head, 0); - /* Finalize (link) the stack of named datatypes (if any) */ - named_datatype_free(&named_dt_head, 0); - - return 0; + return ret_value; done: - H5E_BEGIN_TRY - { - H5Gclose(grp_in); - H5Gclose(grp_out); - H5Pclose(dcpl_in); - H5Pclose(gcpl_in); - H5Pclose(gcpl_out); - H5Sclose(f_space_id); - H5Dclose(dset_in); - H5Dclose(dset_out); - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Tclose(type_in); - H5Tclose(type_out); - named_datatype_free(&named_dt_head, 1); - }H5E_END_TRY; - /* free */ - if (buf != NULL) - HDfree(buf); - if (hslab_buf != NULL) - HDfree(hslab_buf); - return -1; + H5E_BEGIN_TRY + { + H5Gclose(grp_in); + H5Gclose(grp_out); + H5Pclose(dcpl_in); + H5Pclose(gcpl_in); + H5Pclose(gcpl_out); + H5Sclose(f_space_id); + H5Dclose(dset_in); + H5Dclose(dset_out); + H5Tclose(ftype_id); + H5Tclose(wtype_id); + H5Tclose(type_in); + H5Tclose(type_out); + named_datatype_free(&named_dt_head, 1); + }H5E_END_TRY; + + /* free */ + if (buf != NULL) + HDfree(buf); + if (hslab_buf != NULL) + HDfree(hslab_buf); + + return ret_value; } /*------------------------------------------------------------------------- @@ -1411,101 +1324,102 @@ done: *------------------------------------------------------------------------- */ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, - int pr) { - char strfilter[255]; + int pr) +{ + char strfilter[255]; #if defined (PRINT_DEBUG ) - char temp[255]; + char temp[255]; #endif - int nfilters; /* number of filters */ - unsigned filt_flags; /* filter flags */ - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[20]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ - char f_objname[256]; /* filter objname */ - int i; - - HDstrcpy(strfilter, "\0"); + int nfilters; /* number of filters */ + unsigned filt_flags; /* filter flags */ + H5Z_filter_t filtn; /* filter identification number */ + unsigned cd_values[20]; /* filter client data values */ + size_t cd_nelmts; /* filter client number of values */ + char f_objname[256]; /* filter objname */ + int i; - /* get information about input filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - return; + HDstrcpy(strfilter, "\0"); - for (i = 0; i < nfilters; i++) { - cd_nelmts = NELMTS(cd_values); + /* get information about input filters */ + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) + return; - filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_objname), f_objname, NULL); + for (i = 0; i < nfilters; i++) { + cd_nelmts = NELMTS(cd_values); - switch (filtn) { + filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_objname), f_objname, NULL); - case H5Z_FILTER_NONE: - HDstrcat(strfilter, "NONE "); - break; + switch (filtn) { + case H5Z_FILTER_NONE: + HDstrcat(strfilter, "NONE "); + break; - case H5Z_FILTER_DEFLATE: - HDstrcat(strfilter, "GZIP "); + case H5Z_FILTER_DEFLATE: + HDstrcat(strfilter, "GZIP "); #if defined (PRINT_DEBUG) - { - unsigned level=cd_values[0]; - sprintf(temp,"(%d)",level); - HDstrcat(strfilter,temp); - } + { + unsigned level = cd_values[0]; + + sprintf(temp,"(%d)", level); + HDstrcat(strfilter, temp); + } #endif - break; + break; - case H5Z_FILTER_SZIP: - HDstrcat(strfilter, "SZIP "); + case H5Z_FILTER_SZIP: + HDstrcat(strfilter, "SZIP "); #if defined (PRINT_DEBUG) - { - unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ - unsigned ppb=cd_values[1]; - sprintf(temp,"(%d,",ppb); - HDstrcat(strfilter,temp); - if (options_mask & H5_SZIP_EC_OPTION_MASK) - HDstrcpy(temp,"EC) "); - else if (options_mask & H5_SZIP_NN_OPTION_MASK) - HDstrcpy(temp,"NN) "); - } - HDstrcat(strfilter,temp); - + { + unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/ + unsigned ppb = cd_values[1]; + + sprintf(temp,"(%d,", ppb); + HDstrcat(strfilter, temp); + if (options_mask & H5_SZIP_EC_OPTION_MASK) + HDstrcpy(temp, "EC) "); + else if (options_mask & H5_SZIP_NN_OPTION_MASK) + HDstrcpy(temp, "NN) "); + } + HDstrcat(strfilter, temp); #endif + break; - break; - - case H5Z_FILTER_SHUFFLE: - HDstrcat(strfilter, "SHUF "); - break; - - case H5Z_FILTER_FLETCHER32: - HDstrcat(strfilter, "FLET "); - break; - - case H5Z_FILTER_NBIT: - HDstrcat(strfilter, "NBIT "); - break; - - case H5Z_FILTER_SCALEOFFSET: - HDstrcat(strfilter, "SCALEOFFSET "); - break; - - default: - HDstrcat(strfilter, "UD "); - break; - } /* switch */ - }/*i*/ - - if (!pr) - printf(FORMAT_OBJ, "dset", objname); - else { - char str[255], temp[28]; - HDstrcpy(str, "dset "); - HDstrcat(str, strfilter); - sprintf(temp, " (%.3f:1)", ratio); - HDstrcat(str, temp); - printf(FORMAT_OBJ, str, objname); - } + case H5Z_FILTER_SHUFFLE: + HDstrcat(strfilter, "SHUF "); + break; + + case H5Z_FILTER_FLETCHER32: + HDstrcat(strfilter, "FLET "); + break; + + case H5Z_FILTER_NBIT: + HDstrcat(strfilter, "NBIT "); + break; + + case H5Z_FILTER_SCALEOFFSET: + HDstrcat(strfilter, "SCALEOFFSET "); + break; + + default: + HDstrcat(strfilter, "UD "); + break; + } /* switch */ + }/*i*/ + + if (!pr) + printf(FORMAT_OBJ, "dset", objname); + else { + char str[255], temp[28]; + + HDstrcpy(str, "dset "); + HDstrcat(str, strfilter); + sprintf(temp, " (%.3f:1)", ratio); + HDstrcat(str, temp); + printf(FORMAT_OBJ, str, objname); + } } /*------------------------------------------------------------------------- @@ -1522,74 +1436,66 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, *------------------------------------------------------------------------- */ static int copy_user_block(const char *infile, const char *outfile, - hsize_t size) { + hsize_t size) +{ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ int infid = -1, outfid = -1; /* File descriptors */ - int status = 0; /* Return value */ - - /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ - HDassert(size > 0); - - /* Open files */ - if ((infid = HDopen(infile, O_RDONLY, 0)) < 0) { - status = -1; - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed"); - } - if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) { - status = -1; - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed"); - } - - /* Copy the userblock from the input file to the output file */ - while (size > 0) { - ssize_t nread, nbytes; /* # of bytes transfered, etc. */ - char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */ - const char *wbuf; /* Pointer into buffer, for writing */ - - /* Read buffer from source file */ - if (size > USERBLOCK_XFER_SIZE) - nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(infid, rbuf, (size_t)size); - if (nread < 0) { - status = -1; - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDread failed"); - } /* end if */ - - /* Write buffer to destination file */ - /* (compensating for interrupted writes & checking for errors, etc.) */ - nbytes = nread; - wbuf = rbuf; - while (nbytes > 0) { - ssize_t nwritten; /* # of bytes written */ - - do { - nwritten = HDwrite(outfid, wbuf, (size_t)nbytes); - } while (-1 == nwritten && EINTR == errno); - if (-1 == nwritten) { /* error */ - status = -1; - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDwrite failed"); - } /* end if */ - HDassert(nwritten > 0); - HDassert(nwritten <= nbytes); - - /* Update # of bytes left & offset in buffer */ - nbytes -= nwritten; - wbuf += nwritten; - HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); - } /* end while */ - /* Update size of userblock left to transfer */ - size = size - (hsize_t) nread; - } /* end while */ + /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ + HDassert(size > 0); + + /* Open files */ + if ((infid = HDopen(infile, O_RDONLY, 0)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed"); + if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed"); + + /* Copy the userblock from the input file to the output file */ + while (size > 0) { + ssize_t nread, nbytes; /* # of bytes transfered, etc. */ + char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */ + const char *wbuf; /* Pointer into buffer, for writing */ + + /* Read buffer from source file */ + if (size > USERBLOCK_XFER_SIZE) + nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE); + else + nread = HDread(infid, rbuf, (size_t)size); + if (nread < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed"); + + /* Write buffer to destination file */ + /* (compensating for interrupted writes & checking for errors, etc.) */ + nbytes = nread; + wbuf = rbuf; + while (nbytes > 0) { + ssize_t nwritten; /* # of bytes written */ + + do { + nwritten = HDwrite(outfid, wbuf, (size_t)nbytes); + } while (-1 == nwritten && EINTR == errno); + if (-1 == nwritten) /* error */ + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDwrite failed"); + HDassert(nwritten > 0); + HDassert(nwritten <= nbytes); + + /* Update # of bytes left & offset in buffer */ + nbytes -= nwritten; + wbuf += nwritten; + HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); + } /* end while */ + + /* Update size of userblock left to transfer */ + size = size - (hsize_t) nread; + } /* end while */ done: - if (infid > 0) - HDclose(infid); - if (outfid > 0) - HDclose(outfid); + if (infid > 0) + HDclose(infid); + if (outfid > 0) + HDclose(outfid); - return status; + return ret_value; } /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index b2755c2..f0f32c3 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -86,18 +85,18 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_refs_attr failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); if(H5Gclose(grp_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); if(H5Gclose(grp_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); /*------------------------------------------------------------------------- * check for hard links @@ -114,26 +113,26 @@ int do_copy_refobjs(hid_t fidin, */ case H5TRAV_TYPE_DATASET: if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); if((space_id = H5Dget_space(dset_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); if((ftype_id = H5Dget_type(dset_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((rank = H5Sget_simple_extent_ndims(space_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); nelmts = 1; for(k = 0; k < rank; k++) nelmts *= dims[k]; if((mtype_id = h5tools_get_native_type(ftype_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_get_native_type failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed"); if((msize = H5Tget_size(mtype_id)) == 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -169,15 +168,15 @@ int do_copy_refobjs(hid_t fidin, buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf==NULL) { printf("cannot read into memory\n" ); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL){ printf("cannot allocate memory\n" ); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ for(u = 0; u < nelmts; u++) { H5E_BEGIN_TRY { @@ -191,7 +190,7 @@ int do_copy_refobjs(hid_t fidin, if((refname = MapIdToName(refobj_id, travt)) != NULL) { /* create the reference, -1 parameter for objects */ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rcreate failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); if(options->verbose) { printf(FORMAT_OBJ,"dset",travt->objs[i].name ); @@ -209,10 +208,10 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); if(nelmts) if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dwrite failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); if(buf) HDfree(buf); @@ -223,7 +222,7 @@ int do_copy_refobjs(hid_t fidin, * copy attrs *----------------------------------------------------*/ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); } /*H5T_STD_REF_OBJ*/ /*------------------------------------------------------------------------- @@ -246,10 +245,10 @@ int do_copy_refobjs(hid_t fidin, buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { printf("cannot read into memory\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /*------------------------------------------------------------------------- * create output @@ -258,7 +257,7 @@ int do_copy_refobjs(hid_t fidin, refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { printf("cannot allocate memory\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ for(u = 0; u < nelmts; u++) { @@ -274,18 +273,15 @@ int do_copy_refobjs(hid_t fidin, hid_t region_id; /* region id of the referenced dataset */ if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); /* create the reference, we need the space_id */ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rcreate failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); if(H5Sclose(region_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(options->verbose) { - - - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); printf("object <%s> region reference created to <%s>\n", travt->objs[i].name, @@ -301,10 +297,10 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); if(nelmts) if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dwrite failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); if(buf) HDfree(buf); @@ -315,7 +311,7 @@ int do_copy_refobjs(hid_t fidin, * copy attrs *----------------------------------------------------*/ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); } /* H5T_STD_REF_DSETREG */ /*------------------------------------------------------------------------- * not references, open previously created object in 1st traversal @@ -323,7 +319,7 @@ int do_copy_refobjs(hid_t fidin, */ else { if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); } /* end else */ HDassert(dset_out != FAIL); @@ -333,7 +329,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_refs_attr failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); /*------------------------------------------------------------------------- * check for hard links @@ -344,7 +340,7 @@ int do_copy_refobjs(hid_t fidin, H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT); if(H5Dclose(dset_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); } /*can_read*/ /*------------------------------------------------------------------------- @@ -352,15 +348,15 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(H5Tclose(ftype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); if(H5Tclose(mtype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); if(H5Pclose(dcpl_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if(H5Sclose(space_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(H5Dclose(dset_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); break; /*------------------------------------------------------------------------- @@ -369,9 +365,9 @@ int do_copy_refobjs(hid_t fidin, */ case H5TRAV_TYPE_NAMED_DATATYPE: if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Topen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); if(H5Tclose(type_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); break; /*------------------------------------------------------------------------- @@ -384,7 +380,7 @@ int do_copy_refobjs(hid_t fidin, case H5TRAV_TYPE_UNKNOWN: case H5TRAV_TYPE_UDLINK: - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5TRAV invalid type"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5TRAV invalid type"); default: break; @@ -397,7 +393,7 @@ int do_copy_refobjs(hid_t fidin, */ named_datatype_free(&named_dt_head, 0); - return 0; + return ret_value; done: H5E_BEGIN_TRY { @@ -413,7 +409,7 @@ done: named_datatype_free(&named_dt_head, 0); } H5E_END_TRY; - return -1; + return ret_value; } @@ -469,32 +465,32 @@ static int copy_refs_attr(hid_t loc_in, void *refbuf = NULL; void *buf = NULL; const char* refname = NULL; - int *ref_comp_index = NULL; + unsigned *ref_comp_index = NULL; size_t *ref_comp_size = NULL; int ref_comp_field_n = 0; if(H5Oget_info(loc_in, &oinfo) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oget_info failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); /* get the file datatype */ if((ftype_id = H5Aget_type(attr_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_type failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); type_class = H5Tget_class(ftype_id); if((mtype_id = h5tools_get_native_type(ftype_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_get_native_type failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed"); if((msize = H5Tget_size(mtype_id)) == 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); is_ref = (type_class == H5T_REFERENCE); @@ -518,10 +514,10 @@ static int copy_refs_attr(hid_t loc_in, int nmembers = H5Tget_nmembers(ftype_id) ; if (nmembers < 1) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - ref_comp_index = (int *)HDmalloc(nmembers*sizeof (int)); - ref_comp_size = (size_t *)HDmalloc(nmembers*sizeof(ref_comp_size)); + ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned)); + ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size)); ref_comp_field_n = 0; for (i=0; i<(unsigned)nmembers; i++) { @@ -562,15 +558,15 @@ static int copy_refs_attr(hid_t loc_in, /* get name */ if(H5Aget_name(attr_id, 255, name) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_name failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name failed"); /* get the dataspace handle */ if((space_id = H5Aget_space(attr_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); /* get dimensions */ if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); /*------------------------------------------------------------------------- @@ -582,8 +578,8 @@ static int copy_refs_attr(hid_t loc_in, nelmts *= dims[j]; if (is_ref_array) { - unsigned array_rank = 0; - hsize_t array_size = 1; + unsigned array_rank = 0; + hsize_t array_size = 1; hsize_t array_dims[H5S_MAX_RANK]; hid_t base_type; @@ -591,7 +587,7 @@ static int copy_refs_attr(hid_t loc_in, msize = H5Tget_size(base_type); H5Tclose(base_type); - array_rank = H5Tget_array_ndims(mtype_id); + array_rank = (unsigned)H5Tget_array_ndims(mtype_id); H5Tget_array_dims2(mtype_id, array_dims); for(j = 0; j <array_rank; j++) array_size *= array_dims[j]; @@ -599,7 +595,7 @@ static int copy_refs_attr(hid_t loc_in, } if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Acreate2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed"); if (nelmts>0) { /* handle object references */ @@ -607,15 +603,15 @@ static int copy_refs_attr(hid_t loc_in, buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { printf("cannot read into memory\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL) { printf("cannot allocate memory\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ for(i = 0; i < (unsigned)nelmts; i++) { @@ -631,10 +627,10 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { printf( "cannot read into memory\n" ); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); /*------------------------------------------------------------------------- * create output @@ -643,7 +639,7 @@ static int copy_refs_attr(hid_t loc_in, refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { printf( "cannot allocate memory\n" ); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ for(i = 0; i < (unsigned)nelmts; i++) { @@ -661,11 +657,11 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { printf( "cannot read into memory\n" ); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); if (H5R_OBJ_REF_BUF_SIZE==msize) { hobj_ref_t ref_out; @@ -702,41 +698,43 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { printf( "cannot read into memory\n" ); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); for (i=0; i<(unsigned)nelmts; i++) { - for (j=0; j<(unsigned)ref_comp_field_n; j++) { - if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* if */ - else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hdset_reg_ref_t ref_out; - if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* else if */ - } /* j */ + for (j=0; j<(unsigned)ref_comp_field_n; j++) { + if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { + size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]); + hobj_ref_t ref_out; + + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* if */ + else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { + size_t idx = i * msize + H5Tget_member_offset(mtype_id, ref_comp_index[j]); + hdset_reg_ref_t ref_out; + + if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* else if */ + } /* j */ } /* i */ } /* else if (is_ref_comp) */ if(H5Awrite(attr_out, mtype_id, refbuf) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Awrite failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); if (is_ref_vlen && buf) H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); } /* if (nelmts) */ if (refbuf == buf) - refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ + refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ if(buf) { HDfree(buf); @@ -749,39 +747,39 @@ static int copy_refs_attr(hid_t loc_in, } if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; + HDfree(ref_comp_index); + ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; + HDfree(ref_comp_size); + ref_comp_size = NULL; } if(H5Aclose(attr_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ if(H5Tclose(ftype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); if(H5Tclose(mtype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); if(H5Sclose(space_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(H5Aclose(attr_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); } /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */ - return 0; + return ret_value; done: - if(refbuf) - HDfree(refbuf); - if(buf) - HDfree(buf); + if(refbuf) + HDfree(refbuf); + if(buf) + HDfree(buf); if (ref_comp_index) HDfree(ref_comp_index); @@ -797,7 +795,7 @@ done: H5Aclose(attr_out); } H5E_END_TRY; - return -1; + return ret_value; } /*------------------------------------------------------------------------- @@ -848,30 +846,25 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out, trav_table_t *travt) { int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - herr_t ret = -1; - const char* ref_obj_name; - hid_t space_id=-1, ref_obj_id=-1; + const char* ref_obj_name; + hid_t space_id=-1, ref_obj_id=-1; ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); - if (ref_obj_id<0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference2 failed"); + if (ref_obj_id < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rdereference2 failed"); - ref_obj_name = MapIdToName(ref_obj_id, travt); - if (ref_obj_name == NULL) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "MapIdToName failed"); + ref_obj_name = MapIdToName(ref_obj_id, travt); + if (ref_obj_name == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "MapIdToName failed"); - if (ref_type == H5R_DATASET_REGION) { - space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); - if (space_id < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); + if (ref_type == H5R_DATASET_REGION) { + space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); + if (space_id < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); } - ret = H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id); - - if (ret < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rcreate failed"); - - ret = 0; + if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); done: H5E_BEGIN_TRY { @@ -879,6 +872,6 @@ done: H5Oclose(ref_obj_id); } H5E_END_TRY; - return ret; + return ret_value; } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 9565ce3..6765c49 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -80,20 +80,20 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); if((sid = H5Dget_space(did)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((tid = H5Dget_type(did)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); /*------------------------------------------------------------------------- * filter check *------------------------------------------------------------------------- */ if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0) - ok = 0; + ok = 0; /*------------------------------------------------------------------------- @@ -108,13 +108,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if(H5Pclose(pid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if (H5Sclose(sid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if (H5Dclose(did) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); if (H5Tclose(tid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); } @@ -132,7 +132,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* get the list of objects in the file */ if(h5trav_gettable(fidout, travt) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5trav_gettable failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); for(i = 0; i < travt->nobjs; i++) { @@ -146,13 +146,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); if((sid = H5Dget_space(did)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((tid = H5Dget_type(did)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); /*------------------------------------------------------------------------- * filter check @@ -160,7 +160,6 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->all_filter == 1) { - if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0) ok = 0; } @@ -172,6 +171,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options if(options->all_layout == 1) { pack_info_t pack; + init_packobject(&pack); pack.layout = options->layout_g; pack.chunk = options->chunk_g; @@ -185,13 +185,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if (H5Pclose(pid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if (H5Sclose(sid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if (H5Dclose(did) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); if (H5Tclose(tid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); } /* if */ } /* i */ @@ -208,31 +208,31 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* open the input file */ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fopen failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed"); /* Get file creation property list for input file */ if((fcpl_in = H5Fget_create_plist(fidin)) < 0) { error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); } /* Get file space management info for input file */ if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) { error_msg("failed to retrieve file space strategy & threshold\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_file_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed"); } /* Output file is already opened */ /* Get file creation property list for output file */ if((fcpl_out = H5Fget_create_plist(fidout)) < 0) { error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); } /* Get file space management info for output file */ if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) { error_msg("failed to retrieve file space strategy & threshold\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_file_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed"); } /* @@ -245,12 +245,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(!options->fs_strategy && out_strat != in_strat) { error_msg("file space strategy not set as unexpected\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); } else if(options->fs_strategy && out_strat!= options->fs_strategy) { error_msg("file space strategy not set as unexpected\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); } /* @@ -263,22 +263,22 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(!options->fs_threshold && out_thresh != in_thresh) { error_msg("free space threshold not set as unexpected\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "free space threshold not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected"); } else if(options->fs_threshold && out_thresh != options->fs_threshold) { error_msg("free space threshold not set as unexpected\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "free space threshold not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected"); } /* Closing */ if (H5Pclose(fcpl_in) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if (H5Pclose(fcpl_out) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if (H5Fclose(fidin) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); if (H5Fclose(fidout) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); return ok; @@ -294,7 +294,8 @@ done: if (travt) trav_table_free(travt); } H5E_END_TRY; - return -1; + + return ret_value; } /* h5repack_verify() */ @@ -397,12 +398,12 @@ int h5repack_cmp_pl(const char *fname1, { /* Open the files */ - if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) + if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { error_msg("<%s>: %s\n", fname1, H5FOPENERROR ); return -1; } - if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) + if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { error_msg("<%s>: %s\n", fname2, H5FOPENERROR ); H5Fclose(fid1); @@ -417,7 +418,7 @@ int h5repack_cmp_pl(const char *fname1, */ trav_table_init(&trav); if(h5trav_gettable(fid1, trav) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5trav_gettable failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); /*------------------------------------------------------------------------- * traverse the suppplied object list @@ -430,30 +431,30 @@ int h5repack_cmp_pl(const char *fname1, { if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); if ((gcplid = H5Gget_create_plist(gid)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); if (H5Pclose(gcplid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if (H5Gclose(gid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); if ((gcplid = H5Gget_create_plist(gid)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); if (H5Pclose(gcplid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if (H5Gclose(gid) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); if (crt_order_flag1 != crt_order_flag2) { error_msg("property lists for <%s> are different\n",trav->objs[i].name); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "property lists failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed"); } } @@ -463,24 +464,24 @@ int h5repack_cmp_pl(const char *fname1, else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) { if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); if((dcpl1 = H5Dget_create_plist(dset1)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(dset2)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); /*------------------------------------------------------------------------- * compare the property lists *------------------------------------------------------------------------- */ if((ret = H5Pequal(dcpl1, dcpl2)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pequal failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed"); if(ret == 0) { error_msg("property lists for <%s> are different\n",trav->objs[i].name); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "property lists failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed"); } /*------------------------------------------------------------------------- @@ -488,13 +489,13 @@ int h5repack_cmp_pl(const char *fname1, *------------------------------------------------------------------------- */ if(H5Pclose(dcpl1) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if(H5Pclose(dcpl2) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); if(H5Dclose(dset1) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); if(H5Dclose(dset2) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); } /*if*/ } /*i*/ @@ -512,13 +513,13 @@ int h5repack_cmp_pl(const char *fname1, H5Fclose(fid1); H5Fclose(fid2); - return ret; - /*------------------------------------------------------------------------- - * error - *------------------------------------------------------------------------- - */ + return ret; +/*------------------------------------------------------------------------- +* error +*------------------------------------------------------------------------- +*/ done: H5E_BEGIN_TRY { @@ -532,8 +533,8 @@ done: H5Gclose(gid); trav_table_free(trav); } H5E_END_TRY; - return -1; + return ret_value; } @@ -602,100 +603,71 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) switch (filtn) { - case H5Z_FILTER_NONE: + case H5Z_FILTER_NONE: break; - case H5Z_FILTER_SHUFFLE: - - /* 1 private client value is returned by DCPL */ - if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS ) - return 0; - - /* get dataset's type size */ - if((size = H5Tget_size(tid)) <= 0) - return -1; - - /* the private client value holds the dataset's type size */ - if ( size != cd_values[0] ) - return 0; - - - break; - - case H5Z_FILTER_SZIP: - - /* 4 private client values are returned by DCPL */ - if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS ) - return 0; - - /* "User" parameter for pixels-per-block (index 1) */ - if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] ) - return 0; - - - break; - - case H5Z_FILTER_NBIT: - - /* only client data values number of values checked */ - if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts) - return 0; - - - - break; + case H5Z_FILTER_SHUFFLE: + /* 1 private client value is returned by DCPL */ + if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS ) + return 0; - case H5Z_FILTER_SCALEOFFSET: + /* get dataset's type size */ + if((size = H5Tget_size(tid)) <= 0) + return -1; - /* only client data values checked */ - for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++) - { - if (cd_values[j] != filter[i].cd_values[j]) - { + /* the private client value holds the dataset's type size */ + if ( size != cd_values[0] ) return 0; - } - } + break; + case H5Z_FILTER_SZIP: + /* 4 private client values are returned by DCPL */ + if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS ) + return 0; - break; - - /* for these filters values must match, no local values set in DCPL */ - case H5Z_FILTER_FLETCHER32: - case H5Z_FILTER_DEFLATE: + /* "User" parameter for pixels-per-block (index 1) */ + if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] ) + return 0; - if ( cd_nelmts != filter[i].cd_nelmts) - return 0; + break; - for( j = 0; j < cd_nelmts; j++) - { - if (cd_values[j] != filter[i].cd_values[j]) - { + case H5Z_FILTER_NBIT: + /* only client data values number of values checked */ + if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts) return 0; - } + break; - } + case H5Z_FILTER_SCALEOFFSET: + /* only client data values checked */ + for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++) + if (cd_values[j] != filter[i].cd_values[j]) + return 0; + break; + /* for these filters values must match, no local values set in DCPL */ + case H5Z_FILTER_FLETCHER32: + case H5Z_FILTER_DEFLATE: + if ( cd_nelmts != filter[i].cd_nelmts) + return 0; - break; + for( j = 0; j < cd_nelmts; j++) + if (cd_values[j] != filter[i].cd_values[j]) + return 0; - default: - if ( cd_nelmts != filter[i].cd_nelmts) - return 0; + break; - for( j = 0; j < cd_nelmts; j++) - { - if (cd_values[j] != filter[i].cd_values[j]) - { - return 0; - } + default: + if ( cd_nelmts != filter[i].cd_nelmts) + return 0; - } - break; + for( j = 0; j < cd_nelmts; j++) + if (cd_values[j] != filter[i].cd_values[j]) + return 0; + break; } /* switch */ - } return 1; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b1637a8..79dc51f 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -30,7 +30,8 @@ * 2) when diff was found (normal mode) *------------------------------------------------------------------------- */ -int print_objname (diff_opt_t * options, hsize_t nfound) +H5_ATTR_PURE int +print_objname (diff_opt_t * options, hsize_t nfound) { return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0; } diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index d592528..7897e49 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -106,9 +106,9 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \ both_zero = TRUE; \ - if(!H5_DBL_ABS_EQUAL(0,A)) \ + if(!H5_DBL_ABS_EQUAL(0, (double)A)) \ per = (double)ABS((double)((B) - (A)) / (double)(A)); \ else \ not_comparable = TRUE; \ @@ -119,9 +119,9 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \ both_zero = TRUE; \ - if(!H5_DBL_ABS_EQUAL(0,A)) \ + if(!H5_DBL_ABS_EQUAL(0, (double)A)) \ per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ else \ not_comparable = TRUE; \ @@ -597,7 +597,6 @@ static hsize_t diff_datum(void *_mem1, hid_t obj2_id; hsize_t nfound=0; /* differences found */ int ret=0; /* check return error */ - float f1, f2; double per; hbool_t both_zero; @@ -1856,210 +1855,6 @@ static hsize_t diff_datum(void *_mem1, } /*H5T_NATIVE_ULONG*/ - /*------------------------------------------------------------------------- - * H5T_NATIVE_LLONG - *------------------------------------------------------------------------- - */ - - else if (type_size==8 && type_sign!=H5T_SGN_NONE) - { - long long temp1_llong; - long long temp2_llong; - HDassert(type_size==sizeof(long long)); - - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_llong-temp2_llong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - } - else if (temp1_llong != temp2_llong) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - } /*H5T_NATIVE_LLONG*/ - - /*------------------------------------------------------------------------- - * H5T_NATIVE_ULLONG - *------------------------------------------------------------------------- - */ - - else if (type_size==8 && type_sign==H5T_SGN_NONE) - { - unsigned long long temp1_ullong; - unsigned long long temp2_ullong; - HDassert(type_size==sizeof(unsigned long long)); - - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta ) - { - - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - } - else if (temp1_ullong != temp2_ullong) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - } /*H5T_NATIVE_ULLONG*/ - - break; /* H5T_INTEGER class */ @@ -2495,7 +2290,7 @@ static hsize_t diff_datum(void *_mem1, } } /*H5T_NATIVE_DOUBLE*/ -#if H5_SIZEOF_LONG_DOUBLE !=0 +#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE /*------------------------------------------------------------------------- @@ -2503,7 +2298,7 @@ static hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (type_size==8) + else if (type_size == H5_SIZEOF_LONG_DOUBLE) { long double temp1_double; long double temp2_double; @@ -2511,7 +2306,7 @@ static hsize_t diff_datum(void *_mem1, hbool_t isnan2 = FALSE; - HDassert(type_size==sizeof(long double)); + HDassert(type_size == sizeof(long double)); HDmemcpy(&temp1_double, mem1, sizeof(long double)); HDmemcpy(&temp2_double, mem2, sizeof(long double)); @@ -2706,9 +2501,7 @@ static hsize_t diff_datum(void *_mem1, } nfound++; } - } /*H5T_NATIVE_DOUBLE*/ - - + } /*H5T_NATIVE_LDOUBLE*/ #endif /* H5_SIZEOF_LONG_DOUBLE */ @@ -3986,158 +3779,153 @@ static hsize_t diff_schar(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - char temp1_char; - char temp2_char; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_schar start\n"); - - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - if (ABS(temp1_char-temp2_char) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - nfound++; - } - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - PER(temp1_char,temp2_char); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, - ABS(temp1_char-temp2_char)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_char,temp2_char, - ABS(temp1_char-temp2_char), - per); - } - nfound++; - } - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - PER(temp1_char,temp2_char); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, - ABS(temp1_char-temp2_char)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_char,temp2_char, - ABS(temp1_char-temp2_char), - per); - } - nfound++; - } - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - if (temp1_char != temp2_char) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - nfound++; - } - - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_schar finish\n"); + hsize_t nfound=0; /* number of differences found */ + char temp1_char; + char temp2_char; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; + h5difftrace("diff_schar start\n"); + + /* -d and !-p */ + if (options->d && !options->p) + { + + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + if (ABS(temp1_char-temp2_char) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + nfound++; + } + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* !-d and -p */ + else if (!options->d && options->p) + { + + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + PER(temp1_char,temp2_char); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + ABS(temp1_char-temp2_char)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_char,temp2_char, + ABS(temp1_char-temp2_char), + per); + } + nfound++; + } + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* -d and -p */ + else if ( options->d && options->p) + { + + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + PER(temp1_char,temp2_char); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + ABS(temp1_char-temp2_char)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_char,temp2_char, + ABS(temp1_char-temp2_char), + per); + } + nfound++; + } + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } + + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + if (temp1_char != temp2_char) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + nfound++; + } + + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_schar finish\n"); + + return nfound; } @@ -4165,159 +3953,149 @@ static hsize_t diff_uchar(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned char temp1_uchar; - unsigned char temp2_uchar; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_uchar start\n"); - - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar), - per); - } - nfound++; - } - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar), - per); - } - nfound++; - } - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - if (temp1_uchar != temp2_uchar) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_uchar finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned char temp1_uchar; + unsigned char temp2_uchar; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; + h5difftrace("diff_uchar start\n"); + + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar), + per); + } + nfound++; + } + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar), + per); + } + nfound++; + } + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + if (temp1_uchar != temp2_uchar) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_uchar finish\n"); + + return nfound; } /*------------------------------------------------------------------------- @@ -4343,160 +4121,147 @@ static hsize_t diff_short(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - short temp1_short; - short temp2_short; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_short start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - if (ABS(temp1_short-temp2_short) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - nfound++; - } - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - PER(temp1_short,temp2_short); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, - ABS(temp1_short-temp2_short)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_short,temp2_short, - ABS(temp1_short-temp2_short), - per); - } - nfound++; - } - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - PER(temp1_short,temp2_short); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, - ABS(temp1_short-temp2_short)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_short,temp2_short, - ABS(temp1_short-temp2_short), - per); - } - nfound++; - } - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - if (temp1_short != temp2_short) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - nfound++; - } - - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_short finish\n"); + hsize_t nfound=0; /* number of differences found */ + short temp1_short; + short temp2_short; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; + h5difftrace("diff_short start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + if (ABS(temp1_short-temp2_short) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + nfound++; + } + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + PER(temp1_short,temp2_short); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + ABS(temp1_short-temp2_short)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_short,temp2_short, + ABS(temp1_short-temp2_short), + per); + } + nfound++; + } + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + PER(temp1_short,temp2_short); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + ABS(temp1_short-temp2_short)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_short,temp2_short, + ABS(temp1_short-temp2_short), + per); + } + nfound++; + } + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + if (temp1_short != temp2_short) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + nfound++; + } + + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_short finish\n"); + + return nfound; } @@ -4523,162 +4288,147 @@ static hsize_t diff_ushort(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned short temp1_ushort; - unsigned short temp2_ushort; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_ushort start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort), - per); - } - nfound++; - } - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort), - per); - } - nfound++; - } - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - if (temp1_ushort != temp2_ushort) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_ushort finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned short temp1_ushort; + unsigned short temp2_ushort; + hsize_t i; + double per; + hbool_t both_zero; + + h5difftrace("diff_ushort start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - return nfound; -} + if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort), + per); + } + nfound++; + } + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort), + per); + } + nfound++; + } + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + if (temp1_ushort != temp2_ushort) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_ushort finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -4704,162 +4454,147 @@ static hsize_t diff_int(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - int temp1_int; - int temp2_int; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_int start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - if (ABS(temp1_int-temp2_int) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - nfound++; - } - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - PER(temp1_int,temp2_int); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, - ABS(temp1_int-temp2_int)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_int,temp2_int, - ABS(temp1_int-temp2_int), - per); - } - nfound++; - } - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - PER(temp1_int,temp2_int); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, - ABS(temp1_int-temp2_int)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_int,temp2_int, - ABS(temp1_int-temp2_int), - per); - } - nfound++; - } - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - if (temp1_int != temp2_int) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - nfound++; - } - - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_int finish\n"); + hsize_t nfound=0; /* number of differences found */ + int temp1_int; + int temp2_int; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_int start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + if (ABS(temp1_int-temp2_int) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + nfound++; + } + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + PER(temp1_int,temp2_int); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + ABS(temp1_int-temp2_int)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_int,temp2_int, + ABS(temp1_int-temp2_int), + per); + } + nfound++; + } + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + PER(temp1_int,temp2_int); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + ABS(temp1_int-temp2_int)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_int,temp2_int, + ABS(temp1_int-temp2_int), + per); + } + nfound++; + } + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + if (temp1_int != temp2_int) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + nfound++; + } + + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_int finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -4885,160 +4620,144 @@ static hsize_t diff_uint(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned int temp1_uint; - unsigned int temp2_uint; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_uint start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - if ( PDIFF(temp1_uint,temp2_uint) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - PER_UNSIGN(signed int,temp1_uint,temp2_uint); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, - PDIFF(temp1_uint,temp2_uint), - per); - } - nfound++; - } - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - PER_UNSIGN(signed int,temp1_uint,temp2_uint); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, - PDIFF(temp1_uint,temp2_uint), - per); - } - nfound++; - } - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - if (temp1_uint != temp2_uint) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_uint finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned int temp1_uint; + unsigned int temp2_uint; + hsize_t i; + double per; + hbool_t both_zero; + + h5difftrace("diff_uint start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - return nfound; -} + if ( PDIFF(temp1_uint,temp2_uint) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + + PER_UNSIGN(signed int,temp1_uint,temp2_uint); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, + PDIFF(temp1_uint,temp2_uint), + per); + } + nfound++; + } + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + PER_UNSIGN(signed int,temp1_uint,temp2_uint); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, + PDIFF(temp1_uint,temp2_uint), + per); + } + nfound++; + } + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + + if (temp1_uint != temp2_uint) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_uint finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5064,166 +4783,150 @@ static hsize_t diff_long(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - long temp1_long; - long temp2_long; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_long start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - if (ABS(temp1_long-temp2_long) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); - } - nfound++; - } - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } - } - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - PER(temp1_long,temp2_long); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, - ABS(temp1_long-temp2_long)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_long,temp2_long, - ABS(temp1_long-temp2_long), - per); - } - nfound++; - } - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - PER(temp1_long,temp2_long); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, - ABS(temp1_long-temp2_long)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_long,temp2_long, - ABS(temp1_long-temp2_long), - per); - } - nfound++; - } - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - if (temp1_long != temp2_long) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); - } - nfound++; - } - - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_long finish\n"); + hsize_t nfound=0; /* number of differences found */ + long temp1_long; + long temp2_long; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_long start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + + if (ABS(temp1_long-temp2_long) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); + } + nfound++; + } + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + + PER(temp1_long,temp2_long); + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + ABS(temp1_long-temp2_long)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_long,temp2_long, + ABS(temp1_long-temp2_long), + per); + } + nfound++; + } + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + + PER(temp1_long,temp2_long); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + ABS(temp1_long-temp2_long)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_long,temp2_long, + ABS(temp1_long-temp2_long), + per); + } + nfound++; + } + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + if (temp1_long != temp2_long) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); + } + nfound++; + } + + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_long finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5249,166 +4952,148 @@ static hsize_t diff_ulong(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned long temp1_ulong; - unsigned long temp2_ulong; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_ulong start\n"); - - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, - PDIFF(temp1_ulong,temp2_ulong), - per); - } - nfound++; - } - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, - PDIFF(temp1_ulong,temp2_ulong), - per); - } - nfound++; - } - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - if (temp1_ulong != temp2_ulong) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_ulong finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned long temp1_ulong; + unsigned long temp2_ulong; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_ulong start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, + PDIFF(temp1_ulong,temp2_ulong), + per); + } + nfound++; + } + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, + PDIFF(temp1_ulong,temp2_ulong), + per); + } + nfound++; + } + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + if (temp1_ulong != temp2_ulong) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_ulong finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5434,156 +5119,140 @@ static hsize_t diff_llong(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - long long temp1_llong; - long long temp2_llong; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_llong start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - if (ABS( temp1_llong-temp2_llong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - if (temp1_llong != temp2_llong) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_llong finish\n"); + hsize_t nfound=0; /* number of differences found */ + long long temp1_llong; + long long temp2_llong; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_llong start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + if (ABS( temp1_llong-temp2_llong) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + + PER(temp1_llong,temp2_llong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); + } + nfound++; + } + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + + PER(temp1_llong,temp2_llong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); + } + nfound++; + } + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + + if (temp1_llong != temp2_llong) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_llong finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5609,161 +5278,145 @@ static hsize_t diff_ullong(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned long long temp1_ullong; - unsigned long long temp2_ullong; - hsize_t i; - float f1, f2; - double per; - hbool_t both_zero; - - h5difftrace("diff_ullong start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - if (temp1_ullong != temp2_ullong) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_ullong finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned long long temp1_ullong; + unsigned long long temp2_ullong; + hsize_t i; + float f1, f2; + double per; + hbool_t both_zero; + + h5difftrace("diff_ullong start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - return nfound; -} + if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + ull2float(temp1_ullong,&f1); + ull2float(temp2_ullong,&f2); + PER(f1,f2); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); + } + nfound++; + } + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + + ull2float(temp1_ullong,&f1); + ull2float(temp2_ullong,&f2); + PER(f1,f2); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); + } + nfound++; + } + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + + if (temp1_ullong != temp2_ullong) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_ullong finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5781,44 +5434,44 @@ static hsize_t diff_ullong(unsigned char *mem1, static int ull2float(unsigned long long ull_value, float *f_value) { - hid_t dxpl_id; - unsigned char *buf = NULL; - size_t src_size; - size_t dst_size; + hid_t dxpl_id; + unsigned char *buf = NULL; + size_t src_size; + size_t dst_size; - h5difftrace("ull2float start\n"); - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) - goto error; + h5difftrace("ull2float start\n"); + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) + goto error; - src_size = H5Tget_size(H5T_NATIVE_ULLONG); - dst_size = H5Tget_size(H5T_NATIVE_FLOAT); - buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size)); - if(!buf) - goto error; + src_size = H5Tget_size(H5T_NATIVE_ULLONG); + dst_size = H5Tget_size(H5T_NATIVE_FLOAT); + buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size)); + if(!buf) + goto error; - HDmemcpy(buf, &ull_value, src_size); + HDmemcpy(buf, &ull_value, src_size); - /* do conversion */ - if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0) - goto error; + /* do conversion */ + if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0) + goto error; - HDmemcpy(f_value, buf, dst_size); + HDmemcpy(f_value, buf, dst_size); - if(buf) - HDfree(buf); - h5difftrace("ull2float finish\n"); + if(buf) + HDfree(buf); + h5difftrace("ull2float finish\n"); - return 0; + return 0; error: - H5E_BEGIN_TRY { - H5Pclose(dxpl_id); - } H5E_END_TRY; - if(buf) - HDfree(buf); - h5difftrace("ull2float errored\n"); - - return -1; + H5E_BEGIN_TRY { + H5Pclose(dxpl_id); + } H5E_END_TRY; + if(buf) + HDfree(buf); + h5difftrace("ull2float errored\n"); + + return -1; } diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 14fbcaa..985a47d 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -186,21 +186,21 @@ void print_type(hid_t type) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE const char* diff_basename(const char *name) { size_t i; - if (name==NULL) + if (name == NULL) return NULL; /* Find the end of the base name */ i = HDstrlen(name); - while (i>0 && '/'==name[i-1]) + while (i > 0 && '/' == name[i - 1]) --i; /* Skip backward over base name */ - while (i>0 && '/'!=name[i-1]) + while (i > 0 && '/' != name[i - 1]) --i; return(name+i); @@ -217,20 +217,25 @@ diff_basename(const char *name) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE H5_ATTR_CONST const char* get_type(h5trav_type_t type) { switch(type) { case H5TRAV_TYPE_DATASET: return("H5G_DATASET"); + case H5TRAV_TYPE_GROUP: return("H5G_GROUP"); + case H5TRAV_TYPE_NAMED_DATATYPE: return("H5G_TYPE"); + case H5TRAV_TYPE_LINK: return("H5G_LINK"); + case H5TRAV_TYPE_UDLINK: return("H5G_UDLINK"); + case H5TRAV_TYPE_UNKNOWN: default: return("unknown type"); @@ -250,19 +255,23 @@ get_type(h5trav_type_t type) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE const char* get_sign(H5T_sign_t sign) { switch (sign) { case H5T_SGN_NONE: return "H5T_SGN_NONE"; + case H5T_SGN_2: return "H5T_SGN_2"; + case H5T_SGN_ERROR: return "H5T_SGN_ERROR"; + case H5T_NSGN: return "H5T_NSGN"; + default: HDassert(0); return "unknown sign value"; @@ -281,38 +290,48 @@ get_sign(H5T_sign_t sign) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE const char* get_class(H5T_class_t tclass) { - switch (tclass) - { - case H5T_TIME: - return("H5T_TIME"); - case H5T_INTEGER: - return("H5T_INTEGER"); - case H5T_FLOAT: - return("H5T_FLOAT"); - case H5T_STRING: - return("H5T_STRING"); - case H5T_BITFIELD: - return("H5T_BITFIELD"); - case H5T_OPAQUE: - return("H5T_OPAQUE"); - case H5T_COMPOUND: - return("H5T_COMPOUND"); - case H5T_REFERENCE: - return("H5T_REFERENCE"); - case H5T_ENUM: - return("H5T_ENUM"); - case H5T_VLEN: - return("H5T_VLEN"); - case H5T_ARRAY: - return("H5T_ARRAY"); - case H5T_NO_CLASS: - case H5T_NCLASSES: - default: - HDassert(0); - return("Invalid class"); + switch (tclass) { + case H5T_TIME: + return("H5T_TIME"); + + case H5T_INTEGER: + return("H5T_INTEGER"); + + case H5T_FLOAT: + return("H5T_FLOAT"); + + case H5T_STRING: + return("H5T_STRING"); + + case H5T_BITFIELD: + return("H5T_BITFIELD"); + + case H5T_OPAQUE: + return("H5T_OPAQUE"); + + case H5T_COMPOUND: + return("H5T_COMPOUND"); + + case H5T_REFERENCE: + return("H5T_REFERENCE"); + + case H5T_ENUM: + return("H5T_ENUM"); + + case H5T_VLEN: + return("H5T_VLEN"); + + case H5T_ARRAY: + return("H5T_ARRAY"); + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + HDassert(0); + return("Invalid class"); } /* end switch */ } /* end get_class() */ @@ -325,10 +344,10 @@ get_class(H5T_class_t tclass) */ void print_found(hsize_t nfound) { - if(g_Parallel) - parallel_print("%"H5_PRINTF_LL_WIDTH"u differences found\n", (unsigned long long)nfound); - else - HDfprintf(stdout,"%Hu differences found\n",nfound); + if(g_Parallel) + parallel_print("%"H5_PRINTF_LL_WIDTH"u differences found\n", (unsigned long long)nfound); + else + HDfprintf(stdout,"%Hu differences found\n",nfound); } @@ -375,3 +394,4 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, out: return ret; } + diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 22c611f..bfcbfb8 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -47,9 +47,9 @@ int region_output; /* region output */ int oid_output; /* oid output */ int data_output; /* data output */ int attr_data_output; /* attribute data output */ -int packed_bits_num; /* number of packed bits to display */ -int packed_data_offset; /* offset of packed bits to display */ -int packed_data_length; /* lengtht of packed bits to display */ +unsigned packed_bits_num; /* number of packed bits to display */ +unsigned packed_data_offset; /* offset of packed bits to display */ +unsigned packed_data_length; /* length of packed bits to display */ unsigned long long packed_data_mask; /* mask in which packed bits to display */ int enable_error_stack= FALSE; /* re-enable error stack */ @@ -670,7 +670,7 @@ done: * Modifications: *------------------------------------------------------------------------- */ -static size_t +H5_ATTR_PURE static size_t h5tools_count_ncols(const char *s) { register size_t i; @@ -806,7 +806,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ size_t templength = 0; - int i, indentlevel = 0; + unsigned u, indentlevel = 0; if (stream == NULL) return; @@ -828,10 +828,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx); /* Write new prefix to output */ - if (ctx->indent_level >= 0) { + if (ctx->indent_level > 0) indentlevel = ctx->indent_level; - } - else { + else /* * This is because sometimes we don't print out all the header * info for the data (like the tattr-2.ddl example). If that happens @@ -839,29 +838,23 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, * just print out the default indent levels. */ indentlevel = ctx->default_indent_level; - } /* when printing array indices, print the indentation before the prefix the prefix is printed one indentation level before */ - if (info->pindex) { - for (i = 0; i < indentlevel - 1; i++) { + if (info->pindex) + for (u = 0; u < indentlevel - 1; u++) PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); - } - } - if (elmtno == 0 && secnum == 0 && info->line_1st) { + if (elmtno == 0 && secnum == 0 && info->line_1st) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); - } - else if (secnum && info->line_cont) { + else if (secnum && info->line_cont) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); - } - else { + else PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); - } templength = h5tools_str_len(&prefix); - for (i = 0; i < indentlevel; i++) { + for (u = 0; u < indentlevel; u++) /*we already made the indent for the array indices case */ if (!info->pindex) { PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); @@ -871,7 +864,6 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, /*we cannot count the prefix for the array indices case */ templength += h5tools_str_len(&str); } - } ctx->cur_column = ctx->prev_prefix_len = templength; ctx->cur_elmt = 0; @@ -901,7 +893,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ size_t templength = 0; - int i, indentlevel = 0; + unsigned u, indentlevel = 0; if (stream == NULL) return; @@ -923,7 +915,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_max_idx, ctx); /* Write new prefix to output */ - if (ctx->indent_level >= 0) + if (ctx->indent_level > 0) indentlevel = ctx->indent_level; else /* @@ -937,20 +929,19 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /* when printing array indices, print the indentation before the prefix the prefix is printed one indentation level before */ if (info->pindex) - for (i = 0; i < indentlevel - 1; i++) { + for (u = 0; u < indentlevel - 1; u++) PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); - } - if (elmtno == 0 && secnum == 0 && info->line_1st) { + if (elmtno == 0 && secnum == 0 && info->line_1st) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); - } else if (secnum && info->line_cont) { + else if (secnum && info->line_cont) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); - } else + else PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); templength = h5tools_str_len(&prefix); - for (i = 0; i < indentlevel; i++) { + for (u = 0; u < indentlevel; u++) /*we already made the indent for the array indices case */ if (!info->pindex) { PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); @@ -960,7 +951,6 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /*we cannot count the prefix for the array indices case */ templength += h5tools_str_len(&str); } - } ctx->cur_column = ctx->prev_prefix_len = templength; ctx->cur_elmt = 0; @@ -1300,9 +1290,8 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) HDassert(ctx->ndims); ctx->acc[ctx->ndims - 1] = 1; - for (i = (ctx->ndims - 2); i >= 0; i--) { + for (i = ((int)ctx->ndims - 2); i >= 0; i--) ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; - } for (j = 0; j < ctx->ndims; j++) ctx->pos[j] = 0; } @@ -1537,18 +1526,18 @@ CATCH */ int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) + hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata) { hsize_t *dims1 = NULL; hsize_t *start = NULL; hsize_t *count = NULL; hsize_t numelem; hsize_t total_size[H5S_MAX_RANK]; - int jndx; + unsigned jndx; size_t type_size; hid_t mem_space = -1; void *region_buf = NULL; - int blkndx; + hsize_t blkndx; hid_t sid1 = -1; int ret_value = SUCCEED; @@ -1568,7 +1557,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, } /* Create dataspace for reading buffer */ - if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) + if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); if((type_size = H5Tget_size(type_id)) == 0) @@ -1641,7 +1630,8 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, hsize_t nblocks; hsize_t alloc_size; hsize_t *ptdata; - int ndims; + int sndims; + unsigned ndims; hid_t dtype = -1; hid_t type_id = -1; @@ -1650,16 +1640,16 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, nblocks = (hsize_t)snblocks; /* Print block information */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ndims = (unsigned)sndims; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); - if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) + if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, nblocks, ptdata) < 0) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); if((dtype = H5Dget_type(region_id)) < 0) @@ -1706,10 +1696,10 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container, - int ndims, hid_t type_id, hssize_t npoints) + unsigned ndims, hid_t type_id, hsize_t npoints) { hsize_t *dims1 = NULL; - int type_size; + size_t type_size; hid_t mem_space = -1; void *region_buf = NULL; int ret_value = SUCCEED; @@ -1764,17 +1754,21 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { HERR_INIT(hbool_t, TRUE) - hssize_t npoints; - int ndims; + hssize_t snpoints; + hsize_t npoints; + int sndims; + unsigned ndims; hid_t dtype = -1; hid_t type_id = -1; - if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) + if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ndims = (unsigned)sndims; if((dtype = H5Dget_type(region_id)) < 0) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed"); @@ -1805,7 +1799,7 @@ CATCH * Return: TRUE if all bytes are zero; FALSE otherwise *------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t h5tools_is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *) _mem; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index ca2b39a..ed93a46 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -40,7 +40,7 @@ #define FLUSHSTREAM(S) if(S != NULL) HDfflush(S) #define PRINTSTREAM(S, F, ...) if(S != NULL) HDfprintf(S, F, __VA_ARGS__) #define PRINTVALSTREAM(S, V) if(S != NULL) HDfprintf(S, V) -#define PUTSTREAM(X,S) if(S != NULL) HDfputs(X, S); +#define PUTSTREAM(X,S) do { if(S != NULL) HDfputs(X, S); } while(0) /* * Strings for output - these were duplicated from the h5dump.h @@ -294,7 +294,7 @@ typedef struct h5tool_format_t { const char *fmt_float; int ascii; int str_locale; - int str_repeat; + unsigned str_repeat; /* * Fields associated with compound array members. @@ -510,9 +510,9 @@ typedef struct h5tools_context_t { hsize_t size_last_dim; /*the size of the last dimension, *needed so we can break after each *row */ - int indent_level; /*the number of times we need some + unsigned indent_level; /*the number of times we need some *extra indentation */ - int default_indent_level; /*this is used when the indent level gets changed */ + unsigned default_indent_level; /*this is used when the indent level gets changed */ hsize_t acc[H5S_MAX_RANK]; /* accumulator position */ hsize_t pos[H5S_MAX_RANK]; /* matrix position */ hsize_t sm_pos; /* current stripmine element position */ @@ -545,9 +545,9 @@ H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format; extern "C" { #endif -H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */ -H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ -H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display */ +H5TOOLS_DLLVAR unsigned packed_bits_num; /* number of packed bits to display */ +H5TOOLS_DLLVAR unsigned packed_data_offset; /* offset of packed bits to display */ +H5TOOLS_DLLVAR unsigned packed_data_length; /* length of packed bits to display */ H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */ H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */ H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ @@ -597,11 +597,11 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_form H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts); H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); + hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata); H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, - FILE* stream, hid_t container, int ndims, hid_t type_id, hssize_t npoints); + FILE* stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t npoints); H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 5fb35bf..cae3107 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -207,10 +207,10 @@ hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, size_t ncols, hsize_t region_elmt_counter/*element counter*/, hsize_t elmt_counter); -int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, +static int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); + unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata); hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, @@ -650,10 +650,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) -{ + { HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); HGOTO_DONE(dimension_break); -} + } if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); @@ -795,20 +795,20 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, * hssize_t npoints is the number of points in the region *------------------------------------------------------------------------- */ -int +static int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) + unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata) { hbool_t dimension_break = TRUE; hsize_t *dims1 = NULL; hsize_t elmtno; /* elemnt index */ hsize_t curr_pos = 0; hsize_t total_size[H5S_MAX_RANK]; - size_t jndx; + hsize_t jndx; unsigned indx; - int type_size; + size_t type_size; int ret_value = SUCCEED; unsigned int region_flags; /* buffer extent flags */ hid_t mem_space = -1; @@ -823,7 +823,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, HDmemset(&ctx, 0, sizeof(ctx)); /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)) == NULL) + if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); dims1[0] = npoints; @@ -857,7 +857,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); /* assume entire data space to be printed */ - for (indx = 0; indx < (size_t) ctx.ndims; indx++) + for (indx = 0; indx < ctx.ndims; indx++) ctx.p_min_idx[indx] = 0; init_acc_pos(&ctx, total_size); @@ -866,13 +866,12 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if (jndx == npoints - 1) region_flags |= END_OF_DATA; - for (indx = 0; indx < (size_t)ctx.ndims; indx++) + for (indx = 0; indx < ctx.ndims; indx++) ctx.p_max_idx[indx] = cur_ctx->p_max_idx[indx]; ctx.sm_pos = jndx * ndims; - if (ctx.ndims > 0) { - ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } + if (ctx.ndims > 0) + ctx.size_last_dim = ctx.p_max_idx[ctx.ndims - 1]; else ctx.size_last_dim = 0; @@ -938,11 +937,13 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, hsize_t elmt_counter) { HERR_INIT(hbool_t, TRUE) hbool_t dimension_break = TRUE; - hssize_t npoints; + hssize_t snpoints; + hsize_t npoints; hsize_t alloc_size; hsize_t *ptdata; - int ndims; - hssize_t indx; + int sndims; + unsigned ndims; + hsize_t indx; hid_t dtype = -1; hid_t type_id = -1; @@ -950,12 +951,14 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, HDassert(ctx); HDassert(buffer); - if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) + if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ndims = (unsigned)sndims; /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -976,12 +979,11 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); - if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) + if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, npoints, ptdata) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); for (indx = 0; indx < npoints; indx++) { - int loop_indx; + unsigned loop_indx; h5tools_str_append(buffer, info->dset_ptformat_pre, indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx); @@ -1349,7 +1351,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools } /* initialize temporary start, count and maximum start */ - for (i = 0; i < (size_t) ctx->ndims; i++) { + for (i = 0; i < ctx->ndims; i++) { temp_start[i] = sset->start.data[i]; temp_count[i] = sset->count.data[i]; temp_block[i] = sset->block.data[i]; @@ -1391,12 +1393,11 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools if (ctx->ndims > 2) { /* dimension for start */ - current_outer_dim = (ctx->ndims - 2) - 1; + current_outer_dim = (int)(ctx->ndims - 2) - 1; /* set start to original from current_outer_dim up */ - for (i = current_outer_dim + 1; i < ctx->ndims; i++) { + for (i = (size_t)(current_outer_dim + 1); i < ctx->ndims; i++) temp_start[i] = sset->start.data[i]; - } /* increment start dimension */ do { @@ -1516,6 +1517,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont hid_t f_space = -1; /* file data space */ hsize_t elmtno; /* counter */ size_t i; /* counter */ + int sndims; /* rank of dataspace */ int carry; /* counter carry value */ hsize_t zero[8]; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ @@ -1545,11 +1547,13 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont if (f_space == FAIL) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - ctx->ndims = H5Sget_simple_extent_ndims(f_space); + sndims = H5Sget_simple_extent_ndims(f_space); + if(sndims < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + ctx->ndims = (unsigned)sndims; - if ((size_t)ctx->ndims > NELMTS(sm_size)) { + if ((size_t)ctx->ndims > NELMTS(sm_size)) H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); - } /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1691,10 +1695,14 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte hid_t type, hid_t space, void *mem) { HERR_INIT(herr_t, SUCCEED) + int sndims; /* rank of dataspace */ unsigned i; /*counters */ hsize_t nelmts; /*total selected elmts */ - ctx->ndims = H5Sget_simple_extent_ndims(space); + sndims = H5Sget_simple_extent_ndims(space); + if(sndims < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + ctx->ndims = (unsigned)sndims; if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); @@ -1712,7 +1720,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte H5_LEAVE(SUCCEED); /* nothing to print */ if (ctx->ndims > 0) { HDassert(ctx->p_max_idx[ctx->ndims - 1] == (hsize_t) ((int) ctx->p_max_idx[ctx->ndims - 1])); - ctx->size_last_dim = (int) (ctx->p_max_idx[ctx->ndims - 1]); + ctx->size_last_dim = ctx->p_max_idx[ctx->ndims - 1]; } /* end if */ else ctx->size_last_dim = 0; @@ -2599,7 +2607,6 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i unsigned i; unsigned nmembs = 0; /*number of members */ int snmembs; - int nchars; /*number of output characters */ hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer datatype */ H5T_sign_t sign_type; /*sign of value type */ @@ -2666,12 +2673,14 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Print members */ for (i = 0; i < nmembs; i++) { + int nchars; /*number of output characters */ + ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "\"%s\"", name[i]); - nchars = HDstrlen(name[i]); + nchars = (int)HDstrlen(name[i]); h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), ""); if (native < 0) { @@ -2923,6 +2932,8 @@ h5tools_print_virtual_selection(hid_t vspace, h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", VDS_ALL); break; + case H5S_SEL_ERROR: + case H5S_SEL_N: default: h5tools_str_append(buffer, "Unknown Selection"); } @@ -3632,7 +3643,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, if (cmt_bufsize > 0) { comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */ if(comment) { - cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); + cmt_bufsize = H5Oget_comment(obj_id, comment, (size_t)cmt_bufsize); if(cmt_bufsize > 0) { comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ @@ -3771,49 +3782,39 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims) void h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type) { - int packed_bits_size = 0; - + unsigned packed_bits_size = 0; hid_t n_type = h5tools_get_native_type(type); - if(H5Tget_class(n_type)==H5T_INTEGER) { - if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) { + + if(H5Tget_class(n_type) == H5T_INTEGER) { + if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) packed_bits_size = 8 * sizeof(char); - } - else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) packed_bits_size = 8 * sizeof(unsigned char); - } - else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) packed_bits_size = 8 * sizeof(short); - } - else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) packed_bits_size = 8 * sizeof(unsigned short); - } - else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) packed_bits_size = 8 * sizeof(int); - } - else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) packed_bits_size = 8 * sizeof(unsigned int); - } - else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) packed_bits_size = 8 * sizeof(long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) packed_bits_size = 8 * sizeof(unsigned long); - } - else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) packed_bits_size = 8 * sizeof(long long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) packed_bits_size = 8 * sizeof(unsigned long long); - } else error_msg("Packed Bit not valid for this datatype"); } - if ((packed_bits_size>0) && (packed_data_offset + packed_data_length) > packed_bits_size) { - error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", packed_data_offset+packed_data_length, packed_bits_size); + if((packed_bits_size > 0) && (packed_data_offset + packed_data_length) > packed_bits_size) { + error_msg("Packed Bit offset+length value(%u) too large. Max is %d\n", packed_data_offset + packed_data_length, packed_bits_size); packed_data_mask = 0; }; - h5tools_str_append(buffer, "%s %s=%d %s=%d", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length); + h5tools_str_append(buffer, "%s %s=%u %s=%u", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length); } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index ccdba26..748eb78 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -147,58 +147,65 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr * *------------------------------------------------------------------------- */ -int h5tools_can_encode(H5Z_filter_t filtn) { - switch (filtn) { +int +h5tools_can_encode(H5Z_filter_t filtn) { + switch (filtn) { /* user defined filter */ default: - return 0; + return 0; case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE - return 0; + return 0; #endif - break; + break; + case H5Z_FILTER_SZIP: #ifndef H5_HAVE_FILTER_SZIP - return 0; + return 0; #else { - unsigned int filter_config_flags; + unsigned int filter_config_flags; - if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) - return -1; - if ((filter_config_flags - & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { - /* filter present but neither encode nor decode is supported (???) */ - return -1; - } - else if ((filter_config_flags - & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { - /* decoder only: read but not write */ - return 0; - } - else if ((filter_config_flags - & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { - /* encoder only: write but not read (???) */ - return -1; - } - else if ((filter_config_flags - & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) { - return 1; - } + if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) + return -1; + if ((filter_config_flags + & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { + /* filter present but neither encode nor decode is supported (???) */ + return -1; + } + else if ((filter_config_flags + & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { + /* decoder only: read but not write */ + return 0; + } + else if ((filter_config_flags + & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { + /* encoder only: write but not read (???) */ + return -1; + } + else if ((filter_config_flags + & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) + == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) { + return 1; + } } #endif - break; + break; + case H5Z_FILTER_SHUFFLE: - break; + break; + case H5Z_FILTER_FLETCHER32: - break; + break; + case H5Z_FILTER_NBIT: - break; + break; + case H5Z_FILTER_SCALEOFFSET: - break; - }/*switch*/ + break; + }/*switch*/ - return 1; + return 1; } + diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 13c6a20..6d9a041 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -91,7 +91,7 @@ h5tools_str_close(h5tools_str_t *str) * *------------------------------------------------------------------------- */ -size_t +H5_ATTR_PURE size_t h5tools_str_len(h5tools_str_t *str) { return str->len; @@ -126,14 +126,12 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) va_list ap; /* Make sure we have some memory into which to print */ - if (!str->s || str->nalloc <= 0) { + if (!str->s || str->nalloc <= 0) h5tools_str_reset(str); - } - if (HDstrlen(fmt) == 0) { + if (HDstrlen(fmt) == 0) /* nothing to print */ return str->s; - } /* Format the arguments and append to the value already in `str' */ while (1) { @@ -156,19 +154,18 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) * to lack of buffer size, so try one more time after realloc more * buffer size before return NULL. */ - if (nchars < 0) { + if (nchars < 0) /* failure, such as bad format */ return NULL; - } - if (nchars < 0 || (size_t) nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) { + if ((size_t) nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) { /* Truncation return value as documented by C99, or zero return value with either of the * following conditions, each of which indicates that the proper C99 return value probably * should have been positive when the format string is * something other than "%s" * Alocate at least twice as much space and try again. */ - size_t newsize = MAX(str->len + nchars + 1, 2 * str->nalloc); + size_t newsize = MAX(str->len + (size_t)nchars + 1, 2 * str->nalloc); HDassert(newsize > str->nalloc); /*overflow*/ str->s = (char*)HDrealloc(str->s, newsize); HDassert(str->s); @@ -176,7 +173,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) } else { /* Success */ - str->len += nchars; + str->len += (size_t)nchars; break; } } @@ -498,41 +495,42 @@ void h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info) { - hssize_t nblocks; - hsize_t alloc_size; - hsize_t *ptdata; - int ndims = H5Sget_simple_extent_ndims(rspace); + hssize_t snblocks; /* * This function fails if the rspace does not have blocks. */ H5E_BEGIN_TRY { - nblocks = H5Sget_select_hyper_nblocks(rspace); + snblocks = H5Sget_select_hyper_nblocks(rspace); } H5E_END_TRY; /* Print block information */ - if (nblocks > 0) { - int i; - + if (snblocks > 0) { + hsize_t nblocks; + hsize_t *ptdata; + hsize_t alloc_size; + unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace); + hsize_t u; + + nblocks = (hsize_t)snblocks; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); - H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); - H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, (hsize_t)nblocks, ptdata); + H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, nblocks, ptdata); - for (i = 0; i < nblocks; i++) { - int j; + for (u = 0; u < nblocks; u++) { + unsigned v; - h5tools_str_append(str, info->dset_blockformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)i); + h5tools_str_append(str, info->dset_blockformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)u); /* Start coordinates and opposite corner */ - for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", - ptdata[i * 2 * ndims + j]); + for (v = 0; v < ndims; v++) + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", + ptdata[u * 2 * ndims + v]); - for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : ")-(", - ptdata[i * 2 * ndims + j + ndims]); + for (v = 0; v < ndims; v++) + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : ")-(", + ptdata[u * 2 * ndims + v + ndims]); h5tools_str_append(str, ")"); } @@ -557,37 +555,38 @@ void h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info) { - hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata; - int ndims = H5Sget_simple_extent_ndims(rspace); + hssize_t snpoints; /* * This function fails if the rspace does not have points. */ H5E_BEGIN_TRY { - npoints = H5Sget_select_elem_npoints(rspace); + snpoints = H5Sget_select_elem_npoints(rspace); } H5E_END_TRY; /* Print point information */ - if (npoints > 0) { - int i; - + if (snpoints > 0) { + hsize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace); + hsize_t u; + + npoints = (hsize_t)snpoints; alloc_size = npoints * ndims * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); - H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); - H5Sget_select_elem_pointlist(rspace, (hsize_t)0, (hsize_t)npoints, ptdata); + H5Sget_select_elem_pointlist(rspace, (hsize_t)0, npoints, ptdata); - for (i = 0; i < npoints; i++) { - int j; + for (u = 0; u < npoints; u++) { + unsigned v; - h5tools_str_append(str, info->dset_ptformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", - (unsigned long)i); + h5tools_str_append(str, info->dset_ptformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "", + (unsigned long)u); - for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", - (ptdata[i * ndims + j])); + for (v = 0; v < ndims; v++) + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", + (ptdata[u * ndims + v])); h5tools_str_append(str, ")"); } @@ -676,13 +675,12 @@ void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx) { - int i, indentlevel = 0; + unsigned u, indentlevel = 0; /* Write new prefix */ - if (ctx->indent_level >= 0) { + if (ctx->indent_level > 0) indentlevel = ctx->indent_level; - } - else { + else /* * This is because sometimes we don't print out all the header * info for the data (like the tattr-2.ddl example). If that happens @@ -690,11 +688,9 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, * just print out the default indent levels. */ indentlevel = ctx->default_indent_level; - } - for (i = 0; i < indentlevel; i++) { + for (u = 0; u < indentlevel; u++) h5tools_str_append(str, "%s", OPT(info->line_indent, "")); - } } /*------------------------------------------------------------------------- @@ -753,22 +749,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai unsigned char *ucp_vp = (unsigned char *)vp; char *cp_vp = (char *)vp; hid_t memb, obj; - unsigned nmembs; static char fmt_llong[8], fmt_ullong[8]; H5T_str_t pad; H5T_class_t type_class; - /* - * some tempvars to store the value before we append it to the string to - * get rid of the memory alignment problem - */ - unsigned long long tempullong; - long long templlong; - unsigned long tempulong; - long templong; - unsigned int tempuint; - int tempint; - /* Build default formats for long long types */ if (!fmt_llong[0]) { HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH); @@ -823,6 +807,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai #endif } break; + case H5T_STRING: { unsigned int i; @@ -843,12 +828,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai pad = H5Tget_strpad(type); /* Check for NULL pointer for string */ - if (s == NULL) { + if (s == NULL) h5tools_str_append(str, "NULL"); - } else { for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - int j = 1; + unsigned j = 1; /* * Count how many times the next character repeats. If the @@ -865,7 +849,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai * in it's own quote. */ if (info->str_repeat > 0 && j > info->str_repeat) { - if (quote) h5tools_str_append(str, "%c", quote); + if (quote) + h5tools_str_append(str, "%c", quote); quote = '\''; h5tools_str_append(str, "%s%c", i ? " " : "", quote); @@ -888,10 +873,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai quote = '\0'; i += j - 1; } - } - if (quote) h5tools_str_append(str, "%c", quote); + if (quote) + h5tools_str_append(str, "%c", quote); if (i == 0) /*empty string*/ @@ -899,64 +884,64 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* end else */ } break; + case H5T_INTEGER: if (sizeof(char) == nsize) { - /* if ((H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) */ - if (info->ascii) { + if (info->ascii) h5tools_print_char(str, info, (char) (*ucp_vp)); - } else if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_UCHAR)) */ unsigned char tempuchar; + HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned char)) tempuchar = 0; else - tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask; + tempuchar = (unsigned char)((unsigned long long)(tempuchar >> packed_data_offset) & packed_data_mask); } - h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar); + h5tools_str_append(str, OPT(info->fmt_uchar, "%hhu"), tempuchar); } else { - /* if (H5Tequal(type, H5T_NATIVE_SCHAR)) */ signed char tempchar; + HDmemcpy(&tempchar, cp_vp, sizeof(char)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(char)) tempchar = 0; else - tempchar = (tempchar >> packed_data_offset) & packed_data_mask; + tempchar = (signed char)((unsigned long long)(tempchar >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); } } /* end if (sizeof(char) == nsize) */ else if (sizeof(int) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_UINT)) */ + unsigned int tempuint; + HDmemcpy(&tempuint, vp, sizeof(unsigned int)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned int)) tempuint = 0; else - tempuint = (tempuint >> packed_data_offset) & packed_data_mask; + tempuint = (unsigned)((tempuint >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); } else { - /* if (H5Tequal(type, H5T_NATIVE_INT)) */ + int tempint; + HDmemcpy(&tempint, vp, sizeof(int)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(int)) tempint = 0; else - tempint = (tempint >> packed_data_offset) & packed_data_mask; + tempint = (int)((unsigned long long)(tempint >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); } } /* end if (sizeof(int) == nsize) */ else if (sizeof(short) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_USHORT)) */ unsigned short tempushort; HDmemcpy(&tempushort, vp, sizeof(unsigned short)); @@ -964,12 +949,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (packed_data_offset >= 8 * sizeof(unsigned short)) tempushort = 0; else - tempushort = (tempushort >> packed_data_offset) & packed_data_mask; + tempushort = (unsigned short)((unsigned long long)(tempushort >> packed_data_offset) & packed_data_mask); } - h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort); + h5tools_str_append(str, OPT(info->fmt_ushort, "%hu"), tempushort); } else { - /* if (H5Tequal(type, H5T_NATIVE_SHORT)) */ short tempshort; HDmemcpy(&tempshort, vp, sizeof(short)); @@ -977,14 +961,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (packed_data_offset >= 8 * sizeof(short)) tempshort = 0; else - tempshort = (tempshort >> packed_data_offset) & packed_data_mask; + tempshort = (short)((unsigned long long)(tempshort >> packed_data_offset) & packed_data_mask); } - h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort); + h5tools_str_append(str, OPT(info->fmt_short, "%hd"), tempshort); } } /* end if (sizeof(short) == nsize) */ else if (sizeof(long) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_ULONG)) */ + unsigned long tempulong; + HDmemcpy(&tempulong, vp, sizeof(unsigned long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned long)) @@ -995,20 +980,23 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); } else { - /* if (H5Tequal(type, H5T_NATIVE_LONG)) */ + long templong; + HDmemcpy(&templong, vp, sizeof(long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(long)) templong = 0; else - templong = (templong >> packed_data_offset) & packed_data_mask; + templong = (long)((unsigned long long)(templong >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); } } /* end if (sizeof(long) == nsize) */ +#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG else if (sizeof(long long) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_ULLONG)) */ + unsigned long long tempullong; + HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned long long)) @@ -1019,7 +1007,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); } else { - /* if (H5Tequal(type, H5T_NATIVE_LLONG)) */ + long long templlong; + HDmemcpy(&templlong, vp, sizeof(long long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(long long)) @@ -1030,12 +1019,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); } } /* end if (sizeof(long long) == nsize) */ +#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ break; + case H5T_COMPOUND: { + unsigned nmembs; unsigned j; - nmembs = H5Tget_nmembers(type); + nmembs = (unsigned)H5Tget_nmembers(type); h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); ctx->indent_level++; @@ -1046,7 +1038,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - if (info->arr_linebreak) h5tools_str_indent(str, info, ctx); + if (info->arr_linebreak) + h5tools_str_indent(str, info, ctx); /* The name */ name = H5Tget_member_name(type, j); @@ -1068,9 +1061,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_indent(str, info, ctx); } h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); - } break; + case H5T_ENUM: { char enum_name[1024]; @@ -1090,10 +1083,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } } break; + case H5T_REFERENCE: - if (h5tools_str_is_zero(vp, nsize)) { + if (h5tools_str_is_zero(vp, nsize)) h5tools_str_append(str, "NULL"); - } else { if (nsize == H5R_DSET_REG_REF_BUF_SIZE) { /* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */ @@ -1149,6 +1142,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; + case H5T_ARRAY: { int k, ndims; @@ -1175,7 +1169,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai ctx->indent_level++; for (i = 0; i < nelmts; i++) { - if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); + if (i) + h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) { h5tools_str_append(str, "%s", "\n"); @@ -1210,6 +1205,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai H5Tclose(memb); } break; + case H5T_VLEN: { unsigned int i; @@ -1459,31 +1455,33 @@ h5tools_str_is_zero(const void *_mem, size_t size) char * h5tools_str_replace ( const char *string, const char *substr, const char *replacement ) { - char *tok = NULL; - char *newstr = NULL; - char *oldstr = NULL; - char *head = NULL; - - if ( substr == NULL || replacement == NULL ) - return HDstrdup (string); - newstr = HDstrdup (string); - head = newstr; - while ( (tok = HDstrstr ( head, substr ))){ - oldstr = newstr; - newstr = (char *)HDmalloc( HDstrlen( oldstr ) - HDstrlen( substr ) + HDstrlen( replacement ) + 1 ); - - if ( newstr == NULL ){ - HDfree (oldstr); + char *tok = NULL; + char *newstr = NULL; + char *head = NULL; + + if(substr == NULL || replacement == NULL) + return HDstrdup(string); + newstr = HDstrdup(string); + head = newstr; + while((tok = HDstrstr(head, substr))) { + char *oldstr; + + oldstr = newstr; + newstr = (char *)HDmalloc(HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement) + 1); + + if(newstr == NULL) { + HDfree(oldstr); return NULL; } - HDmemcpy ( newstr, oldstr, tok - oldstr ); - HDmemcpy ( newstr + (tok - oldstr), replacement, HDstrlen ( replacement ) ); - HDmemcpy ( newstr + (tok - oldstr) + HDstrlen( replacement ), tok + HDstrlen ( substr ), HDstrlen ( oldstr ) - HDstrlen ( substr ) - ( tok - oldstr ) ); - HDmemset ( newstr + HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) , 0, 1 ); + HDmemcpy(newstr, oldstr, (size_t)(tok - oldstr)); + HDmemcpy(newstr + (tok - oldstr), replacement, HDstrlen(replacement)); + HDmemcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr), HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr)); + HDmemset(newstr + HDstrlen (oldstr) - HDstrlen(substr) + HDstrlen(replacement) , 0, 1); /* move back head right after the last replacement */ - head = newstr + (tok - oldstr) + HDstrlen( replacement ); - HDfree (oldstr); + head = newstr + (tok - oldstr) + HDstrlen(replacement); + HDfree(oldstr); } return newstr; } + diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index b87abf6..0884945 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -34,7 +34,7 @@ #include "h5trav.h" /* global variables */ -int h5tools_nCols = 80; +unsigned h5tools_nCols = 80; /* ``get_option'' variables */ int opt_err = 1; /*get_option prints errors if this is on */ int opt_ind = 1; /*token pointer */ @@ -57,7 +57,7 @@ hsize_t H5TOOLS_BUFSIZE = ( 32 * 1024 * 1024); /* 32 MB */ /* ``parallel_print'' variables */ unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */ char outBuff[OUTBUFF_SIZE]; -int outBuffOffset; +unsigned outBuffOffset; FILE* overflow_file = NULL; /* local functions */ @@ -89,11 +89,11 @@ void parallel_print(const char* format, ...) HDvprintf(format, ap); else { if(overflow_file == NULL) /*no overflow has occurred yet */ { - bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); + bytes_written = HDvsnprintf(outBuff + outBuffOffset, OUTBUFF_SIZE - outBuffOffset, format, ap); HDva_end(ap); HDva_start(ap, format); - if((bytes_written < 0) || (bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) { + if((bytes_written < 0) || ((unsigned)bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) { /* Terminate the outbuff at the end of the previous output */ outBuff[outBuffOffset] = '\0'; @@ -104,7 +104,7 @@ void parallel_print(const char* format, ...) bytes_written = HDvfprintf(overflow_file, format, ap); } else - outBuffOffset += bytes_written; + outBuffOffset += (unsigned)bytes_written; } else bytes_written = HDvfprintf(overflow_file, format, ap); @@ -376,7 +376,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti *------------------------------------------------------------------------- */ void -indentation(int x) +indentation(unsigned x) { if (x < h5tools_nCols) { while (x-- > 0) @@ -408,7 +408,7 @@ print_version(const char *progname) { PRINTSTREAM(rawoutstream, "%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, - ((char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); + ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } @@ -532,7 +532,7 @@ dump_tables(find_objs_t *info) * *------------------------------------------------------------------------- */ -obj_t * +H5_ATTR_PURE obj_t * search_obj(table_t *table, haddr_t objno) { unsigned u; @@ -680,7 +680,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) { - unsigned u; + size_t u; /* See if we need to make table larger */ if(table->nobjs == table->size) { @@ -883,12 +883,14 @@ void h5tools_setstatus(int D_status) h5tools_d_status = D_status; } -const char*h5tools_getprogname(void) +H5_ATTR_PURE const char * +h5tools_getprogname(void) { return h5tools_progname; } -int h5tools_getstatus(void) +H5_ATTR_PURE int +h5tools_getstatus(void) { return h5tools_d_status; } @@ -912,7 +914,6 @@ int h5tools_getenv_update_hyperslab_bufsize(void) hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10); if (errno != 0 || hyperslab_bufsize_mb <= 0) { - /* TODO: later when pubilshed HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str); */ @@ -922,13 +923,14 @@ int h5tools_getenv_update_hyperslab_bufsize(void) /* convert MB to byte */ - H5TOOLS_BUFSIZE = hyperslab_bufsize_mb * 1024 * 1024; + H5TOOLS_BUFSIZE = (hsize_t)hyperslab_bufsize_mb * 1024 * 1024; H5TOOLS_MALLOCSIZE = MAX(H5TOOLS_BUFSIZE, H5TOOLS_MALLOCSIZE); } - return (1); + error: return (-1); } + diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 3285278..f7ab65b 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -35,7 +35,7 @@ extern "C" { H5TOOLS_DLLVAR int g_nTasks; H5TOOLS_DLLVAR unsigned char g_Parallel; H5TOOLS_DLLVAR char outBuff[]; -H5TOOLS_DLLVAR int outBuffOffset; +H5TOOLS_DLLVAR unsigned outBuffOffset; H5TOOLS_DLLVAR FILE * overflow_file; /* Maximum size used in a call to malloc for a dataset */ @@ -119,10 +119,10 @@ typedef struct find_objs_t { table_t *dset_table; } find_objs_t; -H5TOOLS_DLLVAR int h5tools_nCols; /*max number of columns for outputting */ +H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for outputting */ /* Definitions of useful routines */ -H5TOOLS_DLL void indentation(int); +H5TOOLS_DLL void indentation(unsigned); H5TOOLS_DLL void print_version(const char *progname); H5TOOLS_DLL void parallel_print(const char* format, ... ); H5TOOLS_DLL void error_msg(const char *fmt, ...); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 86e60c3..66beb0d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -161,7 +161,7 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path) * *------------------------------------------------------------------------- */ -static const char * +H5_ATTR_PURE static const char * trav_addr_visited(trav_addr_t *visited, haddr_t addr) { size_t u; /* Local index variable */ @@ -490,7 +490,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info) *------------------------------------------------------------------------- */ -ssize_t +H5_ATTR_PURE ssize_t h5trav_getindex(const trav_info_t *info, const char *obj) { size_t u; /* Local index variable */ @@ -681,7 +681,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table) *------------------------------------------------------------------------- */ -int +H5_ATTR_PURE int h5trav_getindext(const char *name, const trav_table_t *table) { unsigned int i; @@ -1235,7 +1235,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co * *------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path) { size_t u; /* Local index variable */ diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index b85133d..4d79a9b 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -222,7 +222,7 @@ set_time(io_time_t *pt, timer_type t, int start_stop) * Programmer: Bill Wendling, 01. October 2001 * Modifications: */ -double +H5_ATTR_PURE double get_time(io_time_t *pt, timer_type t) { return pt->total_time[t]; diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 37d505a..8657cbc 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -252,9 +252,9 @@ main (int argc, char *argv[]) } /* end while */ /* allocate names */ - if(NULL == (src_name = HDcalloc((size_t)NAMELEN, sizeof(char)))) + if(NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) exit(EXIT_FAILURE); - if(NULL == (dst_name = HDcalloc((size_t)NAMELEN, sizeof(char)))) + if(NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) exit(EXIT_FAILURE); /* |