From a5a121cd0a7939011a8d1172a30da22d760feb4b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 15 Dec 2015 11:03:25 -0500 Subject: [svn-r28662] Removed some remainging flush dependency code from the v1 B-tree package. This data structure cannot be used with SWMR so its flush dependency code has been removed. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- src/H5B.c | 11 +++-------- src/H5Bdbg.c | 1 - src/H5Bpkg.h | 4 ---- src/H5Bprivate.h | 2 +- src/H5Gstab.c | 4 ++-- src/H5Gtest.c | 2 +- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/H5B.c b/src/H5B.c index b000cbd..c2e93c1 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -487,7 +487,6 @@ H5B__split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") cache_udata.f = f; cache_udata.type = shared->type; - cache_udata.parent = bt_ud->bt->parent; cache_udata.rc_shared = bt_ud->bt->rc_shared; if(NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") @@ -613,8 +612,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void /* Check if the root node split */ if(H5B_INS_NOOP == my_ins) { - /* The root node did not split - just update the flush dependency (if - * necessary) and exit */ + /* The root node did not split - just return */ HDassert(!split_bt_ud.bt); HGOTO_DONE(SUCCEED) } /* end if */ @@ -878,7 +876,6 @@ H5B__insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, /* Set up user data for cache callbacks */ cache_udata.f = f; cache_udata.type = type; - cache_udata.parent = bt; cache_udata.rc_shared = rc_shared; if(0 == bt->nchildren) { @@ -2038,11 +2035,10 @@ done: *------------------------------------------------------------------------- */ htri_t -H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, - void *parent) +H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr) { H5B_t *bt = NULL; /* The B-tree */ - H5UC_t *rc_shared; /* Ref-counted shared info */ + H5UC_t *rc_shared; /* Ref-counted shared info */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ htri_t ret_value = SUCCEED; /* Return value */ @@ -2069,7 +2065,6 @@ H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, */ cache_udata.f = f; cache_udata.type = type; - cache_udata.parent = parent; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree node") diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index ed7ccf2..b22264d 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -92,7 +92,6 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f cache_udata.f = f; cache_udata.type = type; cache_udata.rc_shared = rc_shared; - cache_udata.parent = NULL; if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index e9cf69a..e645626 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -59,16 +59,12 @@ typedef struct H5B_t { haddr_t right; /*address of right sibling */ uint8_t *native; /*array of keys in native format */ haddr_t *child; /*2k child pointers */ - - /* Not stored on disk */ - void *parent; /* Flush dependency parent */ } H5B_t; /* Callback info for loading a B-tree node into the cache */ typedef struct H5B_cache_ud_t { H5F_t *f; /* File that B-tree node is within */ const struct H5B_class_t *type; /* Type of tree */ - void *parent; /* Flush dependency parent */ H5UC_t *rc_shared; /* Ref-counted shared info */ } H5B_cache_ud_t; diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 3251a47..02fb82c 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -177,6 +177,6 @@ H5_DLL herr_t H5B_shared_free(void *_shared); H5_DLL herr_t H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, const H5B_class_t *type, void *udata); H5_DLL htri_t H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, - haddr_t addr, void *parent); + haddr_t addr); #endif /* _H5Bprivate_H */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index c8e5bc8..27fa67a 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -1067,10 +1067,10 @@ H5G__stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5O_stab_t *alt_stab) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message"); /* Check if the symbol table message's b-tree address is valid */ - if(H5B_valid(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, NULL) < 0) { + if(H5B_valid(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr) < 0) { /* Address is invalid, try the b-tree address in the alternate symbol * table message */ - if(!alt_stab || H5B_valid(grp_oloc->file, dxpl_id, H5B_SNODE, alt_stab->btree_addr, NULL) < 0) + if(!alt_stab || H5B_valid(grp_oloc->file, dxpl_id, H5B_SNODE, alt_stab->btree_addr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to locate b-tree") else { /* The alternate symbol table's b-tree address is valid. Adjust the diff --git a/src/H5Gtest.c b/src/H5Gtest.c index b021f9d..04607ef 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -633,7 +633,7 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header") /* Verify that the btree address is valid */ - if(H5B_valid(grp_oloc->file, H5AC_ind_dxpl_id, H5B_SNODE, stab.btree_addr, NULL) < 0) + if(H5B_valid(grp_oloc->file, H5AC_ind_dxpl_id, H5B_SNODE, stab.btree_addr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "b-tree address is invalid") /* Verify that the heap address is valid */ -- cgit v0.12 From cdd8891bc15bef7c52aff39e707f09804b6551db Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 15 Dec 2015 12:40:53 -0500 Subject: [svn-r28666] Minor trunk->revise_chunks normalization. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- src/H5B.c | 1 + src/H5Fint.c | 10 ++++------ src/H5Gtest.c | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/H5B.c b/src/H5B.c index c2e93c1..3b34c4d 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -1274,6 +1274,7 @@ H5B__remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *typ FUNC_ENTER_STATIC HDassert(f); + HDassert(H5F_addr_defined(addr)); HDassert(type); HDassert(type->decode); HDassert(type->cmp3); diff --git a/src/H5Fint.c b/src/H5Fint.c index cc693ca..e163103 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -633,19 +633,17 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size") if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &(f->shared->latest_format)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag") - + /* Require the latest format to use SWMR */ + /* (Need to revisit this when the 1.10 release is made, and require + * 1.10 or later -QAK) + */ /* For latest format or SWMR_WRITE, activate all latest version support */ if((f->shared->latest_format) || (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)) f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS; - if(H5P_get(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &(f->shared->use_mdc_logging)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'use mdc logging' flag") if(H5P_get(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &(f->shared->start_mdc_log_on_access)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'start mdc log on access' flag") - /* Require the latest format to use SWMR */ - /* (Need to revisit this when the 1.10 release is made, and require - * 1.10 or later -QAK) - */ if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get metadata cache size") f->shared->meta_aggr.feature_flag = H5FD_FEAT_AGGREGATE_METADATA; diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 04607ef..f7ca0f1 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -633,7 +633,7 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header") /* Verify that the btree address is valid */ - if(H5B_valid(grp_oloc->file, H5AC_ind_dxpl_id, H5B_SNODE, stab.btree_addr) < 0) + if(H5B_valid(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "b-tree address is invalid") /* Verify that the heap address is valid */ -- cgit v0.12 From 2c70ff1794b7ff65b233df63690951069ba487d1 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 15 Dec 2015 21:47:43 -0500 Subject: [svn-r28680] Updated the cache_tagging test to correctly output tags in the debug/verbose function. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- test/cache_tagging.c | 124 +++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 80ba2eb..470f7a1 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -112,103 +112,105 @@ static unsigned check_invalid_tag_application(void); static void print_entry_type_to_screen(int id) { - printf("Type = "); + HDfprintf(stdout, "Type = "); switch (id) { - case 0: - printf("B-tree Node(0)"); + case H5AC_BT_ID: + HDfprintf(stdout, "v1 B-tree Node"); break; - case 1: - printf("Symbol Table Node(1)"); + case H5AC_SNODE_ID: + HDfprintf(stdout, "Symbol Table Node"); break; - case 2: - printf("Local Heap Prefix(2)"); + case H5AC_LHEAP_PRFX_ID: + HDfprintf(stdout, "Local Heap Prefix"); break; - case 3: - printf("Local Heap Data Block(3)"); + case H5AC_LHEAP_DBLK_ID: + HDfprintf(stdout, "Local Heap Data Block"); break; - case 4: - printf("Global Heap(4)"); + case H5AC_GHEAP_ID: + HDfprintf(stdout, "Global Heap"); break; - case 5: - printf("Object Header(5)"); + case H5AC_OHDR_ID: + HDfprintf(stdout, "Object Header"); break; - case 6: - printf("Object Header Chunk(6)"); + case H5AC_OHDR_CHK_ID: + HDfprintf(stdout, "Object Header Chunk"); break; - case 7: - printf("v2 B-tree Header(7)"); + case H5AC_BT2_HDR_ID: + HDfprintf(stdout, "v2 B-tree Header"); break; - case 8: - printf("v2 B-tree Internal Node(8)"); + case H5AC_BT2_INT_ID: + HDfprintf(stdout, "v2 B-tree Internal Node"); break; - case 9: - printf("v2 B-tree Leaf Node(9)"); + case H5AC_BT2_LEAF_ID: + HDfprintf(stdout, "v2 B-tree Leaf Node"); break; - case 10: - printf("Fractal Heap Header(10)"); + case H5AC_FHEAP_HDR_ID: + HDfprintf(stdout, "Fractal Heap Header"); break; - case 11: - printf("Fractal Heap Direct Block(11)"); + case H5AC_FHEAP_DBLOCK_ID: + HDfprintf(stdout, "Fractal Heap Direct Block"); break; - case 12: - printf("Fractal Heap Indirect Block(12)"); + case H5AC_FHEAP_IBLOCK_ID: + HDfprintf(stdout, "Fractal Heap Indirect Block"); break; - case 13: - printf("Free Space Header(13)"); + case H5AC_FSPACE_HDR_ID: + HDfprintf(stdout, "Free Space Header"); break; - case 14: - printf("Free Space Section(14)"); + case H5AC_FSPACE_SINFO_ID: + HDfprintf(stdout, "Free Space Section"); break; - case 15: - printf("Shared Object Header Message Master Table(15)"); + case H5AC_SOHM_TABLE_ID: + HDfprintf(stdout, "Shared Object Header Message Master Table"); break; - case 16: - printf("Shared Message Index Stored As A List(16)"); + case H5AC_SOHM_LIST_ID: + HDfprintf(stdout, "Shared Message Index Stored As A List"); break; - case 17: - printf("Extensible Array Header(17)"); + case H5AC_EARRAY_HDR_ID: + HDfprintf(stdout, "Extensible Array Header"); break; - case 18: - printf("Extensible Array Index Block(18)"); + case H5AC_EARRAY_IBLOCK_ID: + HDfprintf(stdout, "Extensible Array Index Block"); break; - case 19: - printf("Extensible Array Super Block(19)"); + case H5AC_EARRAY_SBLOCK_ID: + HDfprintf(stdout, "Extensible Array Super Block"); break; - case 20: - printf("Extensible Array Data Block(20)"); + case H5AC_EARRAY_DBLOCK_ID: + HDfprintf(stdout, "Extensible Array Data Block"); break; - case 21: - printf("Extensible Array Data Block Page(21)"); + case H5AC_EARRAY_DBLK_PAGE_ID: + HDfprintf(stdout, "Extensible Array Data Block Page"); break; - case 22: - printf("Chunk Proxy(22)"); + case H5AC_FARRAY_HDR_ID: + HDfprintf(stdout, "Fixed Array Header"); break; - case 23: - printf("Fixed Array Header(23)"); + case H5AC_FARRAY_DBLOCK_ID: + HDfprintf(stdout, "Fixed Array Data Block"); break; - case 24: - printf("Fixed Array Data Block(24)"); + case H5AC_FARRAY_DBLK_PAGE_ID: + HDfprintf(stdout, "Fixed Array Data Block Page"); break; - case 25: - printf("Fixed Array Data Block Page(25)"); + case H5AC_SUPERBLOCK_ID: + HDfprintf(stdout, "File Superblock"); break; - case 26: - printf("File Superblock(26)"); + case H5AC_DRVRINFO_ID: + HDfprintf(stdout, "Driver Info Block"); break; - case 27: - printf("Test Entry(27)"); + case H5AC_TEST_ID: + HDfprintf(stdout, "Test Entry"); break; - case 28: - printf("Number of Types(28)"); + case H5AC_NTYPES: + HDfprintf(stdout, "BADNESS: Number of Types"); break; default: - printf("*Unknown*"); + HDfprintf(stdout, "BADNESS: *Unknown*"); break; } /* end switch */ + HDfprintf(stdout, " (%d)", id); + } /* print_entry_type_to_screen */ @@ -225,8 +227,6 @@ print_entry_type_to_screen(int id) * Programmer: Mike McGreevy * January 25, 2010 * - * Modifications: - * *------------------------------------------------------------------------- */ static int print_index(hid_t fid) { -- cgit v0.12 From b4ce90e13d5eea19b20260d7defdb830b1bf6a0d Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 16 Dec 2015 06:22:32 -0500 Subject: [svn-r28683] Merged r28638 from trunk. HDFFV-9273: cmakehdf5 --script failed in linux platypus Solution: remove --script option from cmakehdf5. Tested: platypus --- bin/cmakehdf5 | 266 ---------------------------------------------------------- 1 file changed, 266 deletions(-) diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 772e54c..48869cf 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -12,8 +12,6 @@ DPRINT=: #DPRINT=echo -# use the ctest scripting method if --script is given -if [ "$1" != "--script" ]; then # variable names # The "extra" number is the step number and easier to see all logfiles in # the sorted order of steps @@ -353,267 +351,3 @@ exit_code=$? # Show a closing time stamp TIMESTAMP exit $exit_code - -else -# --------------- -# older version -# --------------- - -# variable names -progname=`basename $0` # program name -cminfile="cmakemin.$$" # Cmake minimum file -cfgfile=$progname.$$ # configure file -ctest_log=ctest.log # output of ctest script -install_log=install.log # output of installation -$DPRINT $cfgfile - -# Remove temporary generated files if exit 0 -trap "rm -f $cminfile $cfgfile" 0 - -#============= -# Function definitions -#============= -TIMESTAMP() -{ - echo "=====" "`date`" "=====" -} - - -#========== -# main -#========== -# Show a start time stamp -TIMESTAMP - -# Explain what and where log files are. -cat <.log: output of configure - LastBuild_.log: output of build - LastTest_.log: output of testing - LastTestsFailed_.log: list of failed tests - -EOF - -# First generate the two needed input files, the $cimnfile and $cfgfile. -# Then use ctest to use the two input files. - -#========== -# create the configure file -#========== -# Create the cmake minimum required file to be used by the following -# configure file. Though not absolute needed, it is better to generate -# this file before the configure file. Quote the EOF to preven substitution -# in the text. -#========== -#========== -cat > $cfgfile <<'EOF' -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) -######################################################## -# This dashboard is maintained by The HDF Group -# For any comments please contact cdashhelp@hdfgroup.org -# -######################################################## - -set (CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) -set (CTEST_SOURCE_DIRECTORY "../hdf5") -set (CTEST_BINARY_DIRECTORY ".") -set (CTEST_CMAKE_GENERATOR "Unix Makefiles") -set (CTEST_BUILD_CONFIGURATION "Release") -set (CTEST_MAX_N 8) - -# -- CDash variables -set (LOCAL_NO_SUBMIT TRUE) # No CDash submit. -set (MODEL "Experimental") -set (CDASH_LOCAL TRUE) -set (SITE_BUILDNAME_SUFFIX "cmakehdf5") - -# -- URL set for internal check, default is to not update -set (LOCAL_SKIP_UPDATE TRUE) -set (REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8") -# -- Standard build options -set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") - -# Use multiple CPU cores to build -include(ProcessorCount) -ProcessorCount(N) -if(NOT N EQUAL 0) - if(N GREATER ${CTEST_MAX_N}) - set(N ${CTEST_MAX_N}) - endif(N GREATER ${CTEST_MAX_N}) - set(CTEST_BUILD_FLAGS -j${N}) - set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif() - -# ----------------------------------------------------------- -# -- Get environment -# ----------------------------------------------------------- - ## -- set hostname - ## -------------------------- - find_program (HOSTNAME_CMD NAMES hostname) - exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) - set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") - find_program (UNAME NAMES uname) - macro (getuname name flag) - exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") - endmacro (getuname) - - getuname (osname -s) - getuname (osrel -r) - getuname (cpu -m) - - if (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}-${SITE_BUILDNAME_SUFFIX}") - else (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") - endif (SITE_BUILDNAME_SUFFIX) -# ----------------------------------------------------------- - -set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") - -#----------------------------------------------------------------------------- -# MAC machines need special option -#----------------------------------------------------------------------------- -if (APPLE) - # Compiler choice - execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set(ENV{CC} "${XCODE_CC}") - set(ENV{CXX} "${XCODE_CXX}") - # Shared fortran is not supported, build static - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif (APPLE) - - -# ----------------------------------------------------------- -find_package (Subversion) -set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") -# -- Only clean build folder if LOCAL_CLEAR_BUILD is set -if (LOCAL_CLEAR_BUILD) - set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) - if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}") - file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") - else() - ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) - endif() -endif (LOCAL_CLEAR_BUILD) - -#----------------------------------------------------------------------------- -# Send the main script as a note. -list (APPEND CTEST_NOTES_FILES - "${CMAKE_CURRENT_LIST_FILE}" - "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" - ) - -# Check for required variables. -foreach (req - CTEST_CMAKE_GENERATOR - CTEST_SITE - CTEST_BUILD_NAME - ) - if (NOT DEFINED ${req}) - message(FATAL_ERROR "The containing script must set ${req}") - endif (NOT DEFINED ${req}) -endforeach (req) - -## -- set output to english -set($ENV{LC_MESSAGES} "en_EN") - -#----------------------------------------------------------------------------- -# Initialize the CTEST commands -#------------------------------ -set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") -set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"") - -# Print summary information. -foreach (v - CTEST_SITE - CTEST_BUILD_NAME - CTEST_SOURCE_DIRECTORY - CTEST_BINARY_DIRECTORY - CTEST_CMAKE_GENERATOR - CTEST_BUILD_CONFIGURATION - CTEST_CONFIGURE_COMMAND - CTEST_SCRIPT_DIRECTORY - ) - set (vars "${vars} ${v}=[${${v}}]\n") -endforeach (v) -message ("Dashboard script configuration:\n${vars}\n") - -ctest_start (${MODEL} TRACK ${MODEL}) -if (NOT LOCAL_SKIP_UPDATE) - ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}") -endif (NOT LOCAL_SKIP_UPDATE) -if(NOT res STREQUAL "0") - message (FATAL_ERROR "Configure FAILED") -endif() -message ("Configure DONE") -configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) -ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") -ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -if (NOT LOCAL_NO_SUBMIT) - ctest_submit (PARTS Update Configure Notes) -endif (NOT LOCAL_NO_SUBMIT) -ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res) -if (NOT LOCAL_NO_SUBMIT) - ctest_submit (PARTS Build) -endif (NOT LOCAL_NO_SUBMIT) -if(NOT res STREQUAL "0") - message (FATAL_ERROR "Build FAILED") -endif() -message ("build DONE") -if (NOT LOCAL_SKIP_TEST) - ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) - if (NOT LOCAL_NO_SUBMIT) - ctest_submit (PARTS Test) - endif (NOT LOCAL_NO_SUBMIT) - if(NOT res STREQUAL "0") - message (FATAL_ERROR "Test FAILED") - endif() - message ("test DONE") -endif (NOT LOCAL_SKIP_TEST) -if(NOT LOCAL_MEMCHECK_TEST) - ##----------------------------------------------- - ## Package the product - ##----------------------------------------------- - execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V - WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} - RESULT_VARIABLE cpackResult - OUTPUT_VARIABLE cpackLog - ERROR_VARIABLE cpackLog.err - ) - file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") -endif(NOT LOCAL_MEMCHECK_TEST) -#----------------------------------------------------------------------------- - -message ("DONE") -EOF - - -# Run ctest -ctest -S $cfgfile -C Release -V -O $ctest_log -exit_code=$? -if [ $exit_code = 0 ]; then - echo CTest script completed without error -else - echo Error encountered CTest script -fi -# Using HDF5-*.sh because actual name is unavailable -install_sh=HDF5-*.sh -echo installing with $install_sh ... -./$install_sh --skip-license > $install_log -exit_code=$? -if [ $exit_code = 0 ]; then - echo Complete without error -else - echo Error encountered -fi -TIMESTAMP -exit $exit_code - -fi - -- cgit v0.12 From d30135da2a20eb6122237d31ce84c8ef8847ade5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 16 Dec 2015 09:12:30 -0500 Subject: [svn-r28685] Move project to the HDF% 1.10 CDash page --- CTestConfig.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 36bf4a0..bd97834 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -10,10 +10,10 @@ set (CTEST_NIGHTLY_START_TIME "18:00:00 CST") set (CTEST_DROP_METHOD "http") if (CDASH_LOCAL) set (CTEST_DROP_SITE "10.10.10.82") - set (CTEST_DROP_LOCATION "/submit.php?project=HDF5Trunk") + set (CTEST_DROP_LOCATION "/submit.php?project=HDF5110") else (CDASH_LOCAL) set (CTEST_DROP_SITE "cdash.hdfgroup.org") - set (CTEST_DROP_LOCATION "/submit.php?project=HDF5+Trunk") + set (CTEST_DROP_LOCATION "/submit.php?project=HDF5110") endif (CDASH_LOCAL) set (CTEST_DROP_SITE_CDASH TRUE) -- cgit v0.12 From c419289b04a0935f9eae5582016d9e52d7afb25c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 16 Dec 2015 14:54:56 -0500 Subject: [svn-r28692] Merge of r28669 from trunk. Minor // comment removal. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- examples/h5_vds-percival-unlim.c | 5 +++-- tools/lib/h5tools_dump.c | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/h5_vds-percival-unlim.c b/examples/h5_vds-percival-unlim.c index b5f3ebd..2496c37 100644 --- a/examples/h5_vds-percival-unlim.c +++ b/examples/h5_vds-percival-unlim.c @@ -288,8 +288,9 @@ main (void) /* Read all VDS data */ - //EIP We should be able to do it by using H5S_ALL instead of making selection - // or using H5Sselect_all from vspace. + /* EIP We should be able to do it by using H5S_ALL instead of making selection + * or using H5Sselect_all from vspace. + */ start[0] = 0; start[1] = 0; start[2] = 0; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index c6e96e4..39cfbeb 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1543,7 +1543,6 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont /* Hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ - //hsize_t hs_count[H5S_MAX_RANK]; /* size this pass */ hsize_t hs_nelmts; /* elements in request */ /* VL data special information */ @@ -1626,11 +1625,9 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont hs_size[i] = MIN(total_size[i] - hs_offset[i], sm_size[i]); ctx->p_max_idx[i] = ctx->p_min_idx[i] + hs_size[i]; hs_nelmts *= hs_size[i]; -// hs_count[i] = 1; } H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); -// H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_count, hs_size); H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL); } else { -- cgit v0.12 From 765faf883e3061a0f66b3d2074a8fd81d2aed659 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 16 Dec 2015 16:32:40 -0500 Subject: [svn-r28694] Fix for the refresh problem from DLS with --enable-threadsafe. This is part I of the fix for object refresh: no refresh action needed if the file is the writer. Tested on jam, platypus, os1010test, emu, moohan, ostrich. --- src/H5Oflush.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/H5Oflush.c b/src/H5Oflush.c index e9189f8..68f47fd 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -241,6 +241,9 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc, hid_t dxpl_id) FUNC_ENTER_NOAPI(FAIL) + if(H5F_INTENT(oloc.file) & H5F_ACC_RDWR) + HGOTO_DONE(SUCCEED) + /* Create empty object location */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; -- cgit v0.12 From 44b35e2f8b3317cbb3f60c56ba678ed32fd6d3ea Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 17 Dec 2015 01:58:33 -0500 Subject: [svn-r28698] Minor normalization with trunk. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- test/ohdr.c | 1 - tools/h5dump/h5dumpgentest.c | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/test/ohdr.c b/test/ohdr.c index 6faced9..295d149 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -982,7 +982,6 @@ main(void) PASSED(); } - /* Close the file we created */ if(H5Fclose(file) < 0) TEST_ERROR diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 059fee5..0eeaec5 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -7502,22 +7502,17 @@ gent_charsets(void) const char *utf8_p_; } CharSetInfo; - hid_t charset_dtid; - hid_t ascii_dtid; + hid_t charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) ); + hid_t ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); hid_t utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); const char * writeData[] = { "ascii", "utf8", }; sid = H5Screate_simple( 1, dim, NULL ); fid = H5Fcreate( FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); - - charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) ); - - ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); status = H5Tset_cset( ascii_dtid, H5T_CSET_ASCII ); HDassert(status >= 0); H5Tinsert( charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_ ), ascii_dtid ); - utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); status = H5Tset_cset( utf8_dtid, H5T_CSET_UTF8 ); HDassert(status >= 0); H5Tinsert( charset_dtid, "utf8", HOFFSET( CharSetInfo, utf8_p_ ), utf8_dtid ); -- cgit v0.12 From eacff80a4e47433ffa9e88fea934b78284d93df8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 18 Dec 2015 23:56:09 -0500 Subject: [svn-r28708] Description: Fix earray, farray and btree2 use of incorrect file pointer when two files are opened and used to access the data structure. Misc. minor code cleanups as well. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5B2.c | 33 +++------- src/H5B2dbg.c | 64 +++++------------- src/H5B2hdr.c | 84 ++++++++++++++++++++++-- src/H5B2pkg.h | 4 ++ src/H5B2test.c | 7 +- src/H5C.c | 29 +++------ src/H5EAhdr.c | 5 +- src/H5FAhdr.c | 3 +- src/H5Fint.c | 5 +- test/Makefile.am | 15 ++--- test/btree2.c | 182 ++++++++++++++++++++++++++++++++++++++++++++------- test/dsets.c | 194 +++++++++++++++++++++++++++---------------------------- test/earray.c | 179 ++++++++++++++++++++++++++++++++++++++++++++------ test/farray.c | 163 ++++++++++++++++++++++++++++++++++++++++++---- 14 files changed, 699 insertions(+), 268 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 84ff8de..5225d56 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -139,7 +139,6 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, { H5B2_t *bt2 = NULL; /* Pointer to the B-tree */ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ - H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ haddr_t hdr_addr; /* B-tree header address */ H5B2_t *ret_value = NULL; /* Return value */ @@ -163,12 +162,8 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info") /* Look up the B-tree header */ - cache_udata.f = f; - cache_udata.parent = parent; - cache_udata.addr = hdr_addr; - cache_udata.ctx_udata = ctx_udata; - if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree header") + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, ctx_udata, parent, H5AC__NO_FLAGS_SET))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") /* Point v2 B-tree wrapper at header and bump it's ref count */ bt2->hdr = hdr; @@ -186,7 +181,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, ret_value = bt2; done: - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header") if(!ret_value && bt2) if(H5B2_close(bt2, dxpl_id) < 0) @@ -215,7 +210,6 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, void *parent) { H5B2_t *bt2 = NULL; /* Pointer to the B-tree */ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ - H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ H5B2_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -225,12 +219,8 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, void *parent) HDassert(H5F_addr_defined(addr)); /* Look up the B-tree header */ - cache_udata.f = f; - cache_udata.parent = parent; - cache_udata.addr = addr; - cache_udata.ctx_udata = ctx_udata; - if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree header") + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, ctx_udata, parent, H5AC__READ_ONLY_FLAG))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") /* Check for pending heap deletion */ if(hdr->pending_delete) @@ -256,7 +246,7 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, void *parent) ret_value = bt2; done: - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header") if(!ret_value && bt2) if(H5B2_close(bt2, dxpl_id) < 0) @@ -1388,7 +1378,7 @@ H5B2_close(H5B2_t *bt2, hid_t dxpl_id) /* Lock the v2 B-tree header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ - if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(bt2->f, dxpl_id, H5AC_BT2_HDR, bt2_addr, NULL, H5AC__NO_FLAGS_SET))) + if(NULL == (hdr = H5B2__hdr_protect(bt2->f, dxpl_id, bt2_addr, NULL, NULL, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set the shared v2 B-tree header's file context for this operation */ @@ -1450,7 +1440,6 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, void *parent, H5B2_remove_t op, void *op_data) { H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ - H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1463,11 +1452,7 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, #ifdef QAK HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); #endif /* QAK */ - cache_udata.f = f; - cache_udata.parent = parent; - cache_udata.addr = addr; - cache_udata.ctx_udata = ctx_udata; - if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC__NO_FLAGS_SET))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, ctx_udata, parent, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Remember the callback & context for later */ @@ -1489,7 +1474,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); done: /* Unprotect the header, if an error occurred */ - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index c7dc165..05fa1d8 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -95,7 +95,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ - H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -114,20 +113,13 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) { + if(type->crt_dbg_ctx) /* Create debugging context */ if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") - } /* end if */ - /* - * Load the B-tree header. - */ - cache_udata.f = f; - cache_udata.addr = addr; - cache_udata.ctx_udata = dbg_ctx; - cache_udata.parent = NULL; - if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) + /* Load the B-tree header */ + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, dbg_ctx, NULL, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") /* Set file pointer for this B-tree operation */ @@ -181,11 +173,8 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, done: if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") - if(hdr) { - hdr->f = NULL; - if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") - } /* end if */ + if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__hdr_debug() */ @@ -213,7 +202,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ - H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -240,15 +228,9 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") } /* end if */ - /* - * Load the B-tree header. - */ - cache_udata.f = f; - cache_udata.addr = hdr_addr; - cache_udata.ctx_udata = dbg_ctx; - cache_udata.parent = NULL; - if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") + /* Load the B-tree header */ + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, NULL, H5AC__READ_ONLY_FLAG))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -311,11 +293,8 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, done: if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") - if(hdr) { - hdr->f = NULL; - if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") - } /* end if */ + if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node") @@ -342,7 +321,6 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */ - H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ @@ -366,21 +344,14 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDassert(nrec > 0); /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) { + if(type->crt_dbg_ctx) /* Create debugging context */ if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") - } /* end if */ - /* - * Load the B-tree header. - */ - cache_udata.f = f; - cache_udata.addr = hdr_addr; - cache_udata.ctx_udata = dbg_ctx; - cache_udata.parent = NULL; - if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree header") + /* Load the B-tree header */ + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, NULL, H5AC__READ_ONLY_FLAG))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -426,11 +397,8 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent done: if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") - if(hdr) { - hdr->f = NULL; - if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") - } /* end if */ + if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node") diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index f3945bc..c91723d 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -220,10 +220,9 @@ HDmemset(hdr->page, 0, hdr->node_size); hdr->shadowed_internal = NULL; /* Create the callback context, if the callback exists */ - if(hdr->cls->crt_context) { + if(hdr->cls->crt_context) if(NULL == (hdr->cb_ctx = (*hdr->cls->crt_context)(ctx_udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "unable to create v2 B-tree client callback context") - } /* end if */ done: if(ret_value < 0) @@ -499,6 +498,83 @@ done: /*------------------------------------------------------------------------- + * Function: H5B2__hdr_protect + * + * Purpose: Convenience wrapper around protecting v2 B-tree header + * + * Return: Non-NULL pointer to header on success/NULL on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 18 2015 + * + *------------------------------------------------------------------------- + */ +H5B2_hdr_t * +H5B2__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t hdr_addr, void *ctx_udata, + void *parent, unsigned flags) +{ + H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */ + H5B2_hdr_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(hdr_addr)); + + /* only the H5AC__READ_ONLY_FLAG may appear in flags */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Set up user data for cache callbacks */ + udata.f = f; + udata.parent = parent; + udata.addr = hdr_addr; + udata.ctx_udata = ctx_udata; + + /* Protect the header */ + if(NULL == (ret_value = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &udata, flags))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load v2 B-tree header, address = %llu", (unsigned long long)hdr_addr) + ret_value->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5B2__hdr_protect() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__hdr_unprotect + * + * Purpose: Convenience wrapper around unprotecting v2 B-tree header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 18 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2__hdr_unprotect(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned cache_flags) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(hdr); + + /* Unprotect the header */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_HDR, hdr->addr, hdr, cache_flags) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr->addr) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5B2__hdr_unprotect() */ + + +/*------------------------------------------------------------------------- * Function: H5B2__hdr_free * * Purpose: Free B-tree header info @@ -620,8 +696,8 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id) done: /* Unprotect the header with appropriate flags */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_HDR, hdr->addr, hdr, cache_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header") + if(H5B2__hdr_unprotect(hdr, dxpl_id, cache_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__hdr_delete() */ diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 834ef3d..6124ec4 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -321,6 +321,10 @@ H5_DLL herr_t H5B2__hdr_decr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr); H5_DLL size_t H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2__hdr_dirty(H5B2_hdr_t *hdr); +H5_DLL H5B2_hdr_t *H5B2__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t hdr_addr, + void *ctx_udata, void *parent, unsigned flags); +H5_DLL herr_t H5B2__hdr_unprotect(H5B2_hdr_t *hdr, hid_t dxpl_id, + unsigned cache_flags); H5_DLL herr_t H5B2__hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id); /* Routines for operating on leaf nodes */ diff --git a/src/H5B2test.c b/src/H5B2test.c index 654659b..a72dc30 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -67,8 +67,8 @@ static herr_t H5B2__test_store(void *nrecord, const void *udata); static herr_t H5B2__test_compare(const void *rec1, const void *rec2); static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx); static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx); -static herr_t H5B2__test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, - int indent, int fwidth, const void *record, const void *_udata); +static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); @@ -295,8 +295,7 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5B2__test_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, - int indent, int fwidth, const void *record, +H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const void H5_ATTR_UNUSED *_udata) { FUNC_ENTER_STATIC_NOERR diff --git a/src/H5C.c b/src/H5C.c index 448e6fe..5c3d9ef 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -3428,7 +3428,7 @@ done: ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ "an extreme sanity check failed on exit.\n"); } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -7610,8 +7610,8 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) #if H5C_DO_EXTREME_SANITY_CHECKS if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0 || - (H5C_validate_lru_list(cache_ptr) < 0)) { + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -9439,10 +9439,8 @@ H5C_validate_lru_list(H5C_t * cache_ptr) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") } - if ( ( cache_ptr->LRU_list_len < 0 ) || ( cache_ptr->LRU_list_size < 0 ) ) { - + if(cache_ptr->LRU_list_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - } if ( ( cache_ptr->LRU_list_len == 1 ) && @@ -9569,10 +9567,8 @@ H5C_validate_pinned_entry_list(H5C_t * cache_ptr) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") } - if ( ( cache_ptr->pel_len < 0 ) || ( cache_ptr->pel_size < 0 ) ) { - + if(cache_ptr->pel_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - } if ( ( cache_ptr->pel_len == 1 ) && @@ -9692,21 +9688,12 @@ H5C_validate_protected_entry_list(H5C_t * cache_ptr) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - if ( ( ( cache_ptr->pl_head_ptr == NULL ) - || - ( cache_ptr->pl_tail_ptr == NULL ) - ) - && - ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr ) - ) { - + if(((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) + && (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - } - - if ( ( cache_ptr->pl_len < 0 ) || ( cache_ptr->pl_size < 0 ) ) { + if(cache_ptr->pl_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - } if ( ( cache_ptr->pl_len == 1 ) && diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index e60f804..46224f6 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -43,7 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -619,7 +619,7 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */ * * Purpose: Convenience wrapper around protecting extensible array header * - * Return: Non-NULL pointer to index block on success/NULL on failure + * Return: Non-NULL pointer to header on success/NULL on failure * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -650,6 +650,7 @@ H5EA__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata, /* Protect the header */ if(NULL == (ret_value = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, &udata, flags))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) + ret_value->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ CATCH diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 3acf807..a71d92e 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -400,7 +400,7 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ * * Purpose: Convenience wrapper around protecting fixed array header * - * Return: Non-NULL pointer to index block on success/NULL on failure + * Return: Non-NULL pointer to header on success/NULL on failure * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -431,6 +431,7 @@ H5FA__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata, /* Protect the header */ if(NULL == (ret_value = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, &udata, flags))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", (unsigned long long)fa_addr) + ret_value->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ CATCH diff --git a/src/H5Fint.c b/src/H5Fint.c index e163103..b6cc1f1 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1141,12 +1141,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, if(NULL == (lf = H5FD_open(name, flags, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - } /* end if */ - /* Place an advisory lock on the file */ + /* Place an advisory lock on the file & create the 'top' file structure */ if((H5FD_lock(lf, (hbool_t)((flags & H5F_ACC_RDWR) ? TRUE : FALSE)) < 0) || - (NULL == (file = H5F_new(NULL, flags, fcpl_id, fapl_id, lf)))) { + (NULL == (file = H5F_new(NULL, flags, fcpl_id, fapl_id, lf)))) { if(H5FD_close(lf) < 0) /* Closing will remove the lock */ HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info") HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to lock the file or initialize file structure") diff --git a/test/Makefile.am b/test/Makefile.am index 59ba43b..cef7c75 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -51,17 +51,14 @@ check_SCRIPTS = $(TEST_SCRIPT) # executed, generally most specific tests to least specific tests. # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. -# These tests (fheap, btree2) are under development and are not used by -# the library yet. Move them to the end so that their failure do not block -# other current library code tests. -TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ +TEST_PROG= testhdf5 cache cache_api cache_tagging lheap ohdr stab gheap \ + farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ twriteorder big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\ getname vfd ntypes dangle dtransform reserved cross_read \ - freespace mf vds farray earray btree2 fheap file_image unregister \ - cache_logging cork swmr + freespace mf vds file_image unregister cache_logging cork swmr # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. @@ -174,9 +171,9 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 \ multi_file-[rs].h5 core_file plugin.h5 \ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ - unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \ - objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \ - earray.h5 efc[0-5].h5 log_vfd_out.log \ + unlink_chunked.h5 btree2.h5 btree2_tmp.h5 objcopy_src.h5 objcopy_dst.h5 \ + objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 farray_tmp.h5 \ + earray.h5 earray_tmp.h5 efc[0-5].h5 log_vfd_out.log \ new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \ split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ file_image_core_test.h5.copy unregister_filter_1.h5 unregister_filter_2.h5 \ diff --git a/test/btree2.c b/test/btree2.c index 83c079b..c367779 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -31,6 +31,7 @@ const char *FILENAME[] = { "btree2", + "btree2_tmp", NULL }; @@ -108,9 +109,8 @@ create_file(hid_t *file, H5F_t **f, hid_t fapl) STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) { + if(H5AC_ignore_tags(*f) < 0) STACK_ERROR - } /* Success */ return(0); @@ -2810,9 +2810,8 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) @@ -2849,9 +2848,8 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) @@ -4909,7 +4907,7 @@ test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ ninfo.depth = 0; - ninfo.nrec = INSERT_SPLIT_ROOT_NREC - u; + ninfo.nrec = (uint16_t)(INSERT_SPLIT_ROOT_NREC - u); record = 31; /* Middle record in root node */ if(check_node_info(bt2, dxpl, record, &ninfo) < 0) TEST_ERROR @@ -6379,9 +6377,8 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, bt2_addr) < 0) @@ -6535,9 +6532,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Re-shuffle record #'s */ for(u = 0; u < INSERT_MANY; u++) { @@ -6631,9 +6627,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) @@ -6720,9 +6715,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) @@ -6806,9 +6800,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) @@ -7157,9 +7150,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) @@ -7202,9 +7194,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) @@ -7260,9 +7251,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) @@ -7318,9 +7308,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) { + if(H5AC_ignore_tags(f) < 0) STACK_ERROR - } /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) @@ -7605,6 +7594,146 @@ error: /*------------------------------------------------------------------------- + * Function: test_open_twice_diff + * + * Purpose: Open a v2 B-tree twice, through different "top" file + * handles, with an intermediate file open that takes the "shared" + * file handle from the first B-tree's file pointer. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Friday, December 18, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) +{ + char filename[1024]; /* Filename to use */ + char filename_tmp[1024]; /* Temporary file name */ + hid_t file = -1; /* File ID */ + hid_t file2 = -1; /* File ID */ + hid_t file0 = -1; /* File ID */ + hid_t file00 = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + H5B2_t *bt2_2 = NULL; /* Second v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + /* + * Display testing message + */ + TESTING("open B-tree twice, through different file handles"); + + /* Create the file to work on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Re-open v2 B-tree */ + if(NULL == (bt2_2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + FAIL_STACK_ERROR + + /* Close the second v2 B-tree wrapper */ + if(H5B2_close(bt2_2, dxpl) < 0) + FAIL_STACK_ERROR + bt2_2 = NULL; + + /* Re-open the file */ + /* (So that there is something holding the file open when the extensible + * array is closed) + */ + if((file0 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Close the first v2 B-tree wrapper */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close the file */ + /* (close before second file, to detect error on internal B-tree header's + * shared file information) + */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + file = -1; + + /* Open a different file */ + /* (This re-allocates the 'top' file pointer and assigns it a different + * 'shared' file pointer, making the file pointer in the fixed array's + * header stale) + */ + h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); + if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Re-open the file with the v2 B-tree array */ + if((file2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + FAIL_STACK_ERROR + + /* Open the B-tree through the second file handle */ + if(NULL == (bt2_2 = H5B2_open(f2, dxpl, bt2_addr, f2, NULL))) + FAIL_STACK_ERROR + + /* Close the extra file handles */ + if(H5Fclose(file0) < 0) + FAIL_STACK_ERROR + if(H5Fclose(file00) < 0) + FAIL_STACK_ERROR + + /* Close the second v2 B-tree */ + if(H5B2_close(bt2_2, dxpl) < 0) + FAIL_STACK_ERROR + bt2_2 = NULL; + + /* Close file */ + if(H5Fclose(file2) < 0) + FAIL_STACK_ERROR + + /* All tests passed */ + PASSED(); + + /* All tests passed */ + return(0); + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + if(bt2) + H5B2_close(bt2_2, dxpl); + H5Fclose(file); + H5Fclose(file2); + H5Fclose(file0); + H5Fclose(file00); + } H5E_END_TRY; + return(1); +} /* test_open_twice_diff() */ + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Test the B-tree v2 code @@ -7712,6 +7841,9 @@ main(void) nerrors += test_modify(fapl, &cparam, &tparam); } /* end for */ + /* Test opening B-trees twice */ + nerrors += test_open_twice_diff(fapl, &cparam); + /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/dsets.c b/test/dsets.c index 9775214..4b7123d 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -10069,6 +10069,80 @@ error: /*------------------------------------------------------------------------- + * Function: test_zero_dim_dset + * + * Purpose: Tests support for reading a 1D chunled dataset with + * dimension size = 0. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * Wednesdat, July 9, 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_zero_dim_dset(hid_t fapl) +{ + char filename[FILENAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t dcpl = -1; /* Dataset creation property list ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dsid = -1; /* Dataset ID */ + hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */ + int data[1]; + + TESTING("shrinking large chunk"); + + h5_fixname(FILENAME[16], fapl, filename, sizeof filename); + + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + + /* Create dataset creation property list */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + + /* Set 1 chunk size */ + chunk_dim = 1; + if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR + + /* Create 1D dataspace with 0 dim size */ + dim = 0; + if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR + + /* Create chunked dataset */ + if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* write 0 elements from dataset */ + if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR + + /* Read 0 elements from dataset */ + if(H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR + + /* Close everything */ + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dsid); + H5Sclose(sid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end test_zero_dim_dset() */ + + +/*------------------------------------------------------------------------- * Function: test_swmr_non_latest * * Purpose: Checks that a file created with either: @@ -10672,80 +10746,6 @@ error: /*------------------------------------------------------------------------- - * Function: test_zero_dim_dset - * - * Purpose: Tests support for reading a 1D chunled dataset with - * dimension size = 0. - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Mohamad Chaarawi - * Wednesdat, July 9, 2014 - * - *------------------------------------------------------------------------- - */ -static herr_t -test_zero_dim_dset(hid_t fapl) -{ - char filename[FILENAME_BUF_SIZE]; - hid_t fid = -1; /* File ID */ - hid_t dcpl = -1; /* Dataset creation property list ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dsid = -1; /* Dataset ID */ - hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */ - int data[1]; - - TESTING("shrinking large chunk"); - - h5_fixname(FILENAME[16], fapl, filename, sizeof filename); - - /* Create file */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - - /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - - /* Set 1 chunk size */ - chunk_dim = 1; - if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR - - /* Create 1D dataspace with 0 dim size */ - dim = 0; - if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR - - /* Create chunked dataset */ - if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* write 0 elements from dataset */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR - - /* Read 0 elements from dataset */ - if(H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR - - /* Close everything */ - if(H5Sclose(sid) < 0) FAIL_STACK_ERROR - if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - - PASSED(); - - return 0; - -error: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Dclose(dsid); - H5Sclose(sid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; -} /* end test_zero_dim_dset() */ - - -/*------------------------------------------------------------------------- * Function: test_scatter * * Purpose: Tests H5Dscatter with a variety of different selections @@ -11851,38 +11851,38 @@ main(void) nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); - nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); + nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); nerrors += (test_tconv(file) < 0 ? 1 : 0); nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); - nerrors += (test_nbit_int(file) < 0 ? 1 : 0); - nerrors += (test_nbit_float(file) < 0 ? 1 : 0); - nerrors += (test_nbit_double(file) < 0 ? 1 : 0); - nerrors += (test_nbit_array(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int(file) < 0 ? 1 : 0); + nerrors += (test_nbit_float(file) < 0 ? 1 : 0); + nerrors += (test_nbit_double(file) < 0 ? 1 : 0); + nerrors += (test_nbit_array(file) < 0 ? 1 : 0); nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0); nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0); nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); - nerrors += (test_multiopen (file) < 0 ? 1 : 0); - nerrors += (test_types(file) < 0 ? 1 : 0); - nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_multiopen (file) < 0 ? 1 : 0); + nerrors += (test_types(file) < 0 ? 1 : 0); + nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0); nerrors += (test_missing_filter(file) < 0 ? 1 : 0); - nerrors += (test_can_apply(file) < 0 ? 1 : 0); - nerrors += (test_can_apply2(file) < 0 ? 1 : 0); - nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); + nerrors += (test_can_apply(file) < 0 ? 1 : 0); + nerrors += (test_can_apply2(file) < 0 ? 1 : 0); + nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); - nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); - nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); + nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); nerrors += (test_filter_delete(file) < 0 ? 1 : 0); - nerrors += (test_filters_endianess() < 0 ? 1 : 0); - nerrors += (test_zero_dims(file) < 0 ? 1 : 0); + nerrors += (test_filters_endianess() < 0 ? 1 : 0); + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -11902,10 +11902,10 @@ main(void) nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0); nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0); - nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); if(H5Fclose(file) < 0) goto error; diff --git a/test/earray.c b/test/earray.c index 3bd46e8..1753104 100644 --- a/test/earray.c +++ b/test/earray.c @@ -185,6 +185,7 @@ static herr_t earray_cache_test_free_icr(void *thing); /* Local variables */ const char *FILENAME[] = { "earray", + "earray_tmp", NULL }; @@ -344,9 +345,8 @@ create_file(unsigned flags, hid_t fapl, hid_t *file, H5F_t **f) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) { + if(H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR - } /* Success */ return(0); @@ -455,17 +455,19 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, /* (actually will close & re-open the file as well) */ if(tparam->reopen_array) { /* Close array, if given */ - if(ea) { + if(ea && *ea) { if(H5EA_close(*ea, dxpl) < 0) FAIL_STACK_ERROR *ea = NULL; } /* end if */ /* Close file */ - if(H5Fclose(*file) < 0) - FAIL_STACK_ERROR - *file = (-1); - *f = NULL; + if(*file) { + if(H5Fclose(*file) < 0) + FAIL_STACK_ERROR + *file = (-1); + *f = NULL; + } /* end if */ /* Re-open the file */ if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) @@ -476,15 +478,13 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) { + if(H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR - } /* Re-open array, if given */ - if(ea) { + if(ea) if(NULL == (*ea = H5EA_open(*f, dxpl, ea_addr, NULL))) FAIL_STACK_ERROR - } /* end if */ } /* end if */ /* Success */ @@ -1009,7 +1009,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE /* Set invalid max. # of elements per data block page bits */ if(test_cparam.idx_blk_elmts > 0) { HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); - test_cparam.max_dblk_page_nelmts_bits = H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1; + test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1); H5E_BEGIN_TRY { ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); } H5E_END_TRY; @@ -1036,7 +1036,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE TEST_ERROR } /* end if */ HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); - test_cparam.max_dblk_page_nelmts_bits = test_cparam.max_nelmts_bits + 1; + test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(test_cparam.max_nelmts_bits + 1); H5E_BEGIN_TRY { ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); } H5E_END_TRY; @@ -1272,6 +1272,148 @@ error: /*------------------------------------------------------------------------- + * Function: test_open_twice_diff + * + * Purpose: Open an extensible array twice, through different "top" file + * handles, with an intermediate file open that takes the "shared" + * file handle from the first extensible array's file pointer. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Friday, December 18, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) +{ + char filename_tmp[EARRAY_FILENAME_LEN]; /* Temporary file name */ + hid_t file = -1; /* File ID */ + hid_t file2 = -1; /* File ID */ + hid_t file0 = -1; /* File ID */ + hid_t file00 = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5EA_t *ea = NULL; /* Extensible array wrapper */ + H5EA_t *ea2 = NULL; /* Extensible array wrapper */ + haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ + + /* Create file & retrieve pointer to internal file object */ + if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0) + TEST_ERROR + + /* + * Display testing message + */ + TESTING("open extensible array twice, through different file handles"); + + /* Create array */ + if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + TEST_ERROR + + /* Open the array again, through the first file handle */ + if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + FAIL_STACK_ERROR + + /* Verify the creation parameters */ + if(verify_cparam(ea, cparam) < 0) + TEST_ERROR + if(verify_cparam(ea2, cparam) < 0) + TEST_ERROR + + /* Close the second extensible array wrapper */ + if(H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + ea2 = NULL; + + /* Re-open the file */ + /* (So that there is something holding the file open when the extensible + * array is closed) + */ + if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Check for closing & re-opening the file */ + if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0) + TEST_ERROR + + /* Verify the creation parameters */ + if(verify_cparam(ea, cparam) < 0) + TEST_ERROR + + /* Close the first extensible array wrapper */ + if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + ea = NULL; + + /* Close the first file */ + /* (close before second file, to detect error on internal array header's + * shared file information) + */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + file = -1; + + /* Open a different file */ + /* (This re-allocates the 'top' file pointer and assigns it a different + * 'shared' file pointer, making the file pointer in the extensible array's + * header stale) + */ + h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); + if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + + /* Re-open the file with the extensible array */ + if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + FAIL_STACK_ERROR + + /* Open the extensible array through the second file handle */ + if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + FAIL_STACK_ERROR + + /* Verify the creation parameters */ + if(verify_cparam(ea2, cparam) < 0) + TEST_ERROR + + /* Close the extra file handles */ + if(H5Fclose(file0) < 0) + FAIL_STACK_ERROR + if(H5Fclose(file00) < 0) + FAIL_STACK_ERROR + + /* Close array, delete array, close file & verify file is empty */ + if(finish(file2, fapl, f2, ea2, ea_addr) < 0) + TEST_ERROR + + /* All tests passed */ + PASSED() + + return 0; + +error: + H5E_BEGIN_TRY { + if(ea) + H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + if(ea2) + H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT); + H5Fclose(file); + H5Fclose(file2); + H5Fclose(file0); + H5Fclose(file00); + } H5E_END_TRY; + + return 1; +} /* test_open_twice_diff() */ + + +/*------------------------------------------------------------------------- * Function: test_delete_open * * Purpose: Delete opened extensible array (& open deleted array) @@ -1469,7 +1611,7 @@ eiter_fw_next(void *_eiter) * *------------------------------------------------------------------------- */ -static hssize_t +static H5_ATTR_PURE hssize_t eiter_fw_max(const void *_eiter) { const eiter_fw_t *eiter = (const eiter_fw_t *)_eiter; @@ -1687,7 +1829,7 @@ eiter_rv_next(void *_eiter) * *------------------------------------------------------------------------- */ -static hssize_t +static H5_ATTR_PURE hssize_t eiter_rv_max(const void *_eiter) { const eiter_rv_t *eiter = (const eiter_rv_t *)_eiter; @@ -1939,7 +2081,7 @@ eiter_rnd_next(void *_eiter) * *------------------------------------------------------------------------- */ -static hssize_t +static H5_ATTR_PURE hssize_t eiter_rnd_max(const void *_eiter) { const eiter_rnd_t *eiter = (const eiter_rnd_t *)_eiter; @@ -2160,7 +2302,7 @@ eiter_cyc_next(void *_eiter) * *------------------------------------------------------------------------- */ -static hssize_t +static H5_ATTR_PURE hssize_t eiter_cyc_max(const void *_eiter) { const eiter_cyc_t *eiter = (const eiter_cyc_t *)_eiter; @@ -2587,7 +2729,7 @@ main(void) /* Seed random #'s */ curr_time = HDtime(NULL); - HDsrandom((unsigned long)curr_time); + HDsrandom((unsigned)curr_time); /* Create an empty file to retrieve size */ { @@ -2638,6 +2780,7 @@ main(void) nerrors += test_create(fapl, &cparam, &tparam); nerrors += test_reopen(fapl, &cparam, &tparam); nerrors += test_open_twice(fapl, &cparam, &tparam); + nerrors += test_open_twice_diff(fapl, &cparam, &tparam); nerrors += test_delete_open(fapl, &cparam, &tparam); /* * nerrors += test_flush_depend(env_h5_drvr, fapl, &cparam, &tparam); diff --git a/test/farray.c b/test/farray.c index e3e59da..50a9856 100644 --- a/test/farray.c +++ b/test/farray.c @@ -102,6 +102,7 @@ struct farray_test_param_t { /* Local variables */ const char *FILENAME[] = { "farray", + "farray_tmp", NULL }; @@ -159,9 +160,8 @@ create_file(hid_t fapl, hid_t *file, H5F_t **f) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) { + if(H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR - } /* Success */ return(0); @@ -274,17 +274,19 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, /* (actually will close & re-open the file as well) */ if(tparam->reopen_array) { /* Close array, if given */ - if(fa) { + if(fa && *fa) { if(H5FA_close(*fa, dxpl) < 0) FAIL_STACK_ERROR *fa = NULL; } /* end if */ /* Close file */ - if(H5Fclose(*file) < 0) - FAIL_STACK_ERROR - *file = (-1); - *f = NULL; + if(*file) { + if(H5Fclose(*file) < 0) + FAIL_STACK_ERROR + *file = (-1); + *f = NULL; + } /* end if */ /* Re-open the file */ if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) @@ -295,15 +297,13 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) { + if(H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR - } /* Re-open array, if given */ - if(fa) { + if(fa) if(NULL == (*fa = H5FA_open(*f, dxpl, fa_addr, NULL))) FAIL_STACK_ERROR - } /* end if */ } /* end if */ /* Success */ @@ -722,6 +722,144 @@ error: /*------------------------------------------------------------------------- + * Function: test_open_twice_diff + * + * Purpose: Open a fixed array twice, through different "top" file + * handles, with an intermediate file open that takes the "shared" + * file handle from the first fixed array's file pointer. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Friday, December 18, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +{ + char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ + hid_t file = -1; /* File ID */ + hid_t file2 = -1; /* File ID */ + hid_t file0 = -1; /* File ID */ + hid_t file00 = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + + /* + * Display testing message + */ + TESTING("open fixed array twice, through different file handles"); + + /* Create file & retrieve pointer to internal file object */ + if(create_file(fapl, &file, &f) < 0) + TEST_ERROR + + /* Create array */ + if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + TEST_ERROR + + /* Open the array again, through the first file handle */ + if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + FAIL_STACK_ERROR + + /* Verify the creation parameters */ + if(verify_cparam(fa, cparam) < 0) + TEST_ERROR + if(verify_cparam(fa2, cparam) < 0) + TEST_ERROR + + /* Close the second fixed array wrapper */ + if(H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + fa2 = NULL; + + /* Re-open the file */ + /* (So that there is something holding the file open when the extensible + * array is closed) + */ + if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Check for closing & re-opening the file */ + if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0) + TEST_ERROR + + /* Close the first fixed array wrapper */ + if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + fa = NULL; + + /* Close the first file */ + /* (close before second file, to detect error on internal array header's + * shared file information) + */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + file = -1; + + /* Open a different file */ + /* (This re-allocates the 'top' file pointer and assigns it a different + * 'shared' file pointer, making the file pointer in the fixed array's + * header stale) + */ + h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); + if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + + /* Re-open the file with the fixed array */ + if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + FAIL_STACK_ERROR + + /* Open the fixed array through the second file handle */ + if(NULL == (fa2 = H5FA_open(f2, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + FAIL_STACK_ERROR + + /* Verify the creation parameters */ + if(verify_cparam(fa2, cparam) < 0) + TEST_ERROR + + /* Close the extra file handles */ + if(H5Fclose(file0) < 0) + FAIL_STACK_ERROR + if(H5Fclose(file00) < 0) + FAIL_STACK_ERROR + + /* Close array, delete array, close file & verify file is empty */ + if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + TEST_ERROR + + /* All tests passed */ + PASSED() + + return 0; + +error: + H5E_BEGIN_TRY { + if(fa) + H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + if(fa2) + H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT); + H5Fclose(file); + H5Fclose(file2); + H5Fclose(file0); + H5Fclose(file00); + } H5E_END_TRY; + + return 1; +} /* test_open_twice_diff() */ + + +/*------------------------------------------------------------------------- * Function: test_delete_open * * Purpose: Delete opened fixed array (& open deleted array) @@ -1535,7 +1673,7 @@ main(void) /* Seed random #'s */ curr_time = HDtime(NULL); - HDsrandom((unsigned long)curr_time); + HDsrandom((unsigned)curr_time); /* Create an empty file to retrieve size */ { @@ -1586,6 +1724,7 @@ main(void) nerrors += test_create(fapl, &cparam, &tparam); nerrors += test_reopen(fapl, &cparam, &tparam); nerrors += test_open_twice(fapl, &cparam, &tparam); + nerrors += test_open_twice_diff(fapl, &cparam, &tparam); nerrors += test_delete_open(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ -- cgit v0.12 From 0016ea927f7474e642c43a8e652033fe00dec828 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 19 Dec 2015 16:27:15 -0500 Subject: [svn-r28712] Description: Switch v2 B-trees to use the same mechanism for setting up flush dependencies as extensible and fixed arrays. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Adense.c | 89 +++++++++++++------------------------- src/H5Aint.c | 21 +++------ src/H5Apkg.h | 22 ++++------ src/H5B2.c | 99 ++++++++++++++---------------------------- src/H5B2cache.c | 36 ++++++++++----- src/H5B2dbg.c | 6 +-- src/H5B2hdr.c | 11 +++-- src/H5B2int.c | 4 +- src/H5B2pkg.h | 9 ++-- src/H5B2private.h | 10 ++--- src/H5Dbtree2.c | 125 ++++++++++++++++++++++++++++++----------------------- src/H5Dearray.c | 58 ------------------------- src/H5Dfarray.c | 56 ------------------------ src/H5EAprivate.h | 1 - src/H5FAprivate.h | 1 - src/H5FS.c | 2 +- src/H5Gdense.c | 32 +++++++------- src/H5Gobj.c | 2 +- src/H5Goh.c | 4 +- src/H5Gtest.c | 4 +- src/H5HFhdr.c | 1 - src/H5HFhuge.c | 25 ++++------- src/H5HFpkg.h | 1 - src/H5HFstat.c | 2 +- src/H5Oainfo.c | 17 +------- src/H5Oattribute.c | 103 +++++-------------------------------------- src/H5Otest.c | 35 ++------------- src/H5SM.c | 20 ++++----- test/btree2.c | 32 +++++++------- 29 files changed, 264 insertions(+), 564 deletions(-) diff --git a/src/H5Adense.c b/src/H5Adense.c index 8bc0e05..148977d 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -126,7 +126,6 @@ typedef struct H5A_bt2_ud_rm_t { /* downward */ H5A_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */ haddr_t corder_bt2_addr; /* v2 B-tree address of creation order index */ - void *parent; /* Flush dependency parent */ } H5A_bt2_ud_rm_t; /* @@ -141,7 +140,6 @@ typedef struct H5A_bt2_ud_rmbi_t { H5HF_t *shared_fheap; /* Fractal heap handle for shared messages */ H5_index_t idx_type; /* Index type for operation */ haddr_t other_bt2_addr; /* v2 B-tree address of "other" index */ - void *parent; /* Flush dependency parent */ } H5A_bt2_ud_rmbi_t; @@ -185,7 +183,7 @@ typedef struct H5A_bt2_ud_rmbi_t { *------------------------------------------------------------------------- */ herr_t -H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo, void *parent) +H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo) { H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ @@ -248,7 +246,7 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); H5O_FHEAP_ID_LEN; /* Fractal heap ID */ bt2_cparam.split_percent = H5A_NAME_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5A_NAME_BT2_MERGE_PERC; - if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam, NULL, parent))) + if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") /* Retrieve the v2 B-tree's address in the file */ @@ -269,7 +267,7 @@ HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr) H5O_FHEAP_ID_LEN; /* Fractal heap ID */ bt2_cparam.split_percent = H5A_CORDER_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5A_CORDER_BT2_MERGE_PERC; - if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam, NULL, parent))) + if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index") /* Retrieve the v2 B-tree's address in the file */ @@ -342,7 +340,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) */ H5A_t * H5A_dense_open(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *name, void *parent) + const char *name) { H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */ H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -386,7 +384,7 @@ H5A_dense_open(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, } /* end if */ /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, parent))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open v2 B-tree for name index") /* Create the "udata" information for v2 B-tree record find */ @@ -445,7 +443,6 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing message */ unsigned mesg_flags = 0; /* Flags for storing message */ htri_t attr_sharable; /* Flag indicating attributes are sharable */ - H5O_proxy_t *oh_proxy = NULL; /* Attribute's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -531,14 +528,8 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert attribute into fractal heap") } /* end else */ - /* Check for SWMR writes to the file */ - if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&attr->oloc, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin attribute object header proxy") - /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Create the callback information for v2 B-tree record insertion */ @@ -562,7 +553,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) if(ainfo->index_corder) { /* Open the creation order index v2 B-tree */ HDassert(H5F_addr_defined(ainfo->corder_bt2_addr)); - if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo->corder_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo->corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Insert the record into the creation order index v2 B-tree */ @@ -572,8 +563,6 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) done: /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(shared_fheap && H5HF_close(shared_fheap, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") if(fheap && H5HF_close(fheap, dxpl_id) < 0) @@ -648,7 +637,6 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5WB_t *wb = NULL; /* Wrapped buffer for attribute data */ uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing attribute */ - H5O_proxy_t *oh_proxy = NULL; /* Attribute's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -672,14 +660,8 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) if(H5F_addr_defined(op_data->corder_bt2_addr)) { H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */ - /* Check for SWMR writes to the file */ - if(H5F_INTENT(op_data->f) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&op_data->attr->oloc, op_data->dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin attribute object header proxy") - /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(op_data->f, op_data->dxpl_id, op_data->corder_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_corder = H5B2_open(op_data->f, op_data->dxpl_id, op_data->corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Create the "udata" information for v2 B-tree record modify */ @@ -740,8 +722,6 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) done: /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(bt2_corder && H5B2_close(bt2_corder, op_data->dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") if(wb && H5WB_unwrap(wb) < 0) @@ -773,7 +753,6 @@ H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ htri_t attr_sharable; /* Flag indicating attributes are sharable */ - H5O_proxy_t *oh_proxy = NULL; /* Attribute's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -811,14 +790,8 @@ H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo->fheap_addr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") - /* Check for SWMR writes to the file */ - if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&attr->oloc, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin attribute object header proxy") - /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Create the "udata" information for v2 B-tree record modify */ @@ -847,8 +820,6 @@ H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) done: /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(shared_fheap && H5HF_close(shared_fheap, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") if(fheap && H5HF_close(fheap, dxpl_id) < 0) @@ -919,7 +890,7 @@ done: */ herr_t H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *old_name, const char *new_name, void *parent) + const char *old_name, const char *new_name) { H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */ H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -966,7 +937,7 @@ H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, parent))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Create the "udata" information for v2 B-tree record modify */ @@ -1041,7 +1012,7 @@ H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") /* Delete old attribute from dense storage */ - if(H5A_dense_remove(f, dxpl_id, ainfo, old_name, parent) < 0) + if(H5A_dense_remove(f, dxpl_id, ainfo, old_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") done: @@ -1172,7 +1143,7 @@ done: herr_t H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order, - hsize_t skip, void *parent, hsize_t *last_attr, + hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -1246,7 +1217,7 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, } /* end if */ /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL, parent))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") /* Construct the user data for v2 B-tree iterator callback */ @@ -1272,7 +1243,7 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, else { /* Build the table of attributes for this object */ /* (build table using the name index, but sort according to idx_type) */ - if(H5A_dense_build_table(f, dxpl_id, ainfo, idx_type, order, parent, &atable) < 0) + if(H5A_dense_build_table(f, dxpl_id, ainfo, idx_type, order, &atable) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes") /* Iterate over attributes in table */ @@ -1322,7 +1293,7 @@ H5A__dense_remove_bt2_cb(const void *_record, void *_udata) /* Check for removing the link from the creation order index */ if(H5F_addr_defined(udata->corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(udata->common.f, udata->common.dxpl_id, udata->corder_bt2_addr, NULL, udata->parent))) + if(NULL == (bt2_corder = H5B2_open(udata->common.f, udata->common.dxpl_id, udata->corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Set up the user data for the v2 B-tree 'record remove' callback */ @@ -1374,7 +1345,7 @@ done: */ herr_t H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *name, void *parent) + const char *name) { H5A_bt2_ud_rm_t udata; /* User data for v2 B-tree record removal */ H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -1418,7 +1389,7 @@ H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, } /* end if */ /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, parent))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Set up the user data for the v2 B-tree 'record remove' callback */ @@ -1431,7 +1402,6 @@ H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, udata.common.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */ udata.common.found_op_data = &attr_copy; udata.corder_bt2_addr = ainfo->corder_bt2_addr; - udata.parent = parent; /* Remove the record from the name index v2 B-tree */ if(H5B2_remove(bt2_name, dxpl_id, &udata, H5A__dense_remove_bt2_cb, &udata) < 0) @@ -1533,7 +1503,7 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) } /* end else */ /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->other_bt2_addr, NULL, bt2_udata->parent))) + if(NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->other_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") /* Set the common information for the v2 B-tree remove operation */ @@ -1595,7 +1565,7 @@ done: */ herr_t H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *parent) + H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5HF_t *fheap = NULL; /* Fractal heap handle */ H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */ @@ -1665,7 +1635,7 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, } /* end if */ /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL, parent))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") /* Set up the user data for the v2 B-tree 'record remove' callback */ @@ -1675,16 +1645,15 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, udata.shared_fheap = shared_fheap; udata.idx_type = idx_type; udata.other_bt2_addr = idx_type == H5_INDEX_NAME ? ainfo->corder_bt2_addr : ainfo->name_bt2_addr; - udata.parent = parent; /* Remove the record from the name index v2 B-tree */ - if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, NULL, H5A__dense_remove_by_idx_bt2_cb, &udata) < 0) + if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, H5A__dense_remove_by_idx_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from v2 B-tree index") } /* end if */ else { /* Build the table of attributes for this object */ /* (build table using the name index, but sort according to idx_type) */ - if(H5A_dense_build_table(f, dxpl_id, ainfo, idx_type, order, parent, &atable) < 0) + if(H5A_dense_build_table(f, dxpl_id, ainfo, idx_type, order, &atable) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes") /* Check for skipping too many attributes */ @@ -1692,7 +1661,7 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") /* Delete appropriate attribute from dense storage */ - if(H5A_dense_remove(f, dxpl_id, ainfo, ((atable.attrs[n])->shared)->name, parent) < 0) + if(H5A_dense_remove(f, dxpl_id, ainfo, ((atable.attrs[n])->shared)->name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") } /* end else */ @@ -1727,7 +1696,7 @@ done: */ htri_t H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *name, void *parent) + const char *name) { H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */ H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -1770,7 +1739,7 @@ H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, } /* end if */ /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, parent))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Create the "udata" information for v2 B-tree record 'find' */ @@ -1881,7 +1850,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo, void *parent) +H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo) { H5A_bt2_ud_common_t udata; /* v2 B-tree user data for deleting attributes */ H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -1911,7 +1880,7 @@ H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo, void *parent) udata.found_op_data = NULL; /* Delete name index v2 B-tree */ - if(H5B2_delete(f, dxpl_id, ainfo->name_bt2_addr, NULL, parent, H5A__dense_delete_bt2_cb, &udata) < 0) + if(H5B2_delete(f, dxpl_id, ainfo->name_bt2_addr, NULL, H5A__dense_delete_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index") ainfo->name_bt2_addr = HADDR_UNDEF; @@ -1923,7 +1892,7 @@ H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo, void *parent) /* Check if we should delete the creation order index v2 B-tree */ if(H5F_addr_defined(ainfo->corder_bt2_addr)) { /* Delete the creation order index, without adjusting the ref. count on the attributes */ - if(H5B2_delete(f, dxpl_id, ainfo->corder_bt2_addr, NULL, parent, NULL, NULL) < 0) + if(H5B2_delete(f, dxpl_id, ainfo->corder_bt2_addr, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index") ainfo->corder_bt2_addr = HADDR_UNDEF; } /* end if */ diff --git a/src/H5Aint.c b/src/H5Aint.c index bde64c4..80761b6 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1407,8 +1407,7 @@ done: */ herr_t H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - H5_index_t idx_type, H5_iter_order_t order, void *parent, - H5A_attr_table_t *atable) + H5_index_t idx_type, H5_iter_order_t order, H5A_attr_table_t *atable) { H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ hsize_t nrec; /* # of records in v2 B-tree */ @@ -1424,7 +1423,7 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, HDassert(atable); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, parent))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in "name" B-tree */ @@ -1455,7 +1454,7 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, /* Iterate over the links in the group, building a table of the link messages */ if(H5A_dense_iterate(f, dxpl_id, (hid_t)0, ainfo, H5_INDEX_NAME, - H5_ITER_NATIVE, (hsize_t)0, parent, NULL, &attr_op, &udata) < 0) + H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") /* Sort attribute table in correct iteration order */ @@ -1789,7 +1788,6 @@ htri_t H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) { H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL) @@ -1811,14 +1809,8 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) if(ainfo->nattrs == HSIZET_MAX) { /* Check if we are using "dense" attribute storage */ if(H5F_addr_defined(ainfo->fheap_addr)) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(f, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in "name" B-tree */ @@ -1834,8 +1826,6 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) done: /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") @@ -2364,9 +2354,8 @@ H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo attr_op.op_type = H5A_ATTR_OP_LIB; attr_op.u.lib_op = H5A__dense_post_copy_file_cb; - /*!FIXME must pass something for parent once SWMR works with H5Ocopy -NAF */ if(H5A_dense_iterate(src_oloc->file, dxpl_id, (hid_t)0, ainfo_src, H5_INDEX_NAME, - H5_ITER_NATIVE, (hsize_t)0, NULL, NULL, &attr_op, &udata) < 0) + H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") done: diff --git a/src/H5Apkg.h b/src/H5Apkg.h index ab036fa..5858147 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -207,37 +207,34 @@ H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid H5_DLL ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf); /* Attribute "dense" storage routines */ -H5_DLL herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo, - void *parent); +H5_DLL herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo); H5_DLL H5A_t *H5A_dense_open(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *name, void *parent); + const char *name); H5_DLL herr_t H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr); H5_DLL herr_t H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr); H5_DLL herr_t H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *old_name, const char *new_name, void *parent); + const char *old_name, const char *new_name); H5_DLL herr_t H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order, - hsize_t skip, void *parent, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, + hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data); H5_DLL herr_t H5A_dense_remove(H5F_t *f, hid_t dxpl_id, - const H5O_ainfo_t *ainfo, const char *name, void *parent); + const H5O_ainfo_t *ainfo, const char *name); H5_DLL herr_t H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order, - hsize_t n, void *parent); + hsize_t n); H5_DLL htri_t H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *name, void *parent); -H5_DLL herr_t H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo, - void *parent); - + const char *name); +H5_DLL herr_t H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo); /* Attribute table operations */ H5_DLL herr_t H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_index_t idx_type, H5_iter_order_t order, H5A_attr_table_t *atable); H5_DLL herr_t H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order, - void *parent, H5A_attr_table_t *atable); + H5A_attr_table_t *atable); H5_DLL herr_t H5A_attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *last_attr, hid_t loc_id, const H5A_attr_iter_op_t *attr_op, void *op_data); @@ -270,7 +267,6 @@ H5_DLL herr_t H5A_attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *me H5_DLL herr_t H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t * ainfo_src, H5O_loc_t *dst_oloc, H5O_ainfo_t *ainfo_dst, hid_t dxpl_id, H5O_copy_t *cpy_info); - /* Testing functions */ #ifdef H5A_TESTING H5_DLL htri_t H5A_is_shared_test(hid_t aid); diff --git a/src/H5B2.c b/src/H5B2.c index 5225d56..5c1e107 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -134,8 +134,7 @@ H5FL_DEFINE_STATIC(H5B2_t); *------------------------------------------------------------------------- */ H5B2_t * -H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, - void *ctx_udata, void *parent) +H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udata) { H5B2_t *bt2 = NULL; /* Pointer to the B-tree */ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ @@ -154,7 +153,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, HDcompile_assert(H5B2_NUM_BTREE_ID == NELMTS(H5B2_client_class_g)); /* Create shared v2 B-tree header */ - if(HADDR_UNDEF == (hdr_addr = H5B2__hdr_create(f, dxpl_id, cparam, ctx_udata, parent))) + if(HADDR_UNDEF == (hdr_addr = H5B2__hdr_create(f, dxpl_id, cparam, ctx_udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't create v2 B-tree header") /* Create v2 B-tree wrapper */ @@ -162,7 +161,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info") /* Look up the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, ctx_udata, parent, H5AC__NO_FLAGS_SET))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, ctx_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") /* Point v2 B-tree wrapper at header and bump it's ref count */ @@ -206,7 +205,7 @@ done: *------------------------------------------------------------------------- */ H5B2_t * -H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, void *parent) +H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata) { H5B2_t *bt2 = NULL; /* Pointer to the B-tree */ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ @@ -219,7 +218,7 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, void *parent) HDassert(H5F_addr_defined(addr)); /* Look up the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, ctx_udata, parent, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, ctx_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") /* Check for pending heap deletion */ @@ -904,12 +903,6 @@ done: * * Purpose: Removes the n'th record from a B-tree. * - * The 'udata' parameter is only used to pass through to the - * crt_flush_dep and upd_flush_dep callbacks, so it only - * needs to contain enough information for those (if any - it - * can be NULL). Specifically, it does not need to identify - * the specific record to search for. - * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol @@ -920,7 +913,7 @@ done: */ herr_t H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, - hsize_t idx, void *udata, H5B2_remove_t op, void *op_data) + hsize_t idx, H5B2_remove_t op, void *op_data) { H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -954,7 +947,7 @@ H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, if(H5B2__remove_internal_by_idx(hdr, dxpl_id, &depth_decreased, NULL, NULL, hdr->depth, &(hdr->cache_info), NULL, &hdr->root, - H5B2_POS_ROOT, idx, udata, op, op_data) < 0) + H5B2_POS_ROOT, idx, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") /* Check for decreasing the depth of the B-tree */ @@ -1378,7 +1371,7 @@ H5B2_close(H5B2_t *bt2, hid_t dxpl_id) /* Lock the v2 B-tree header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ - if(NULL == (hdr = H5B2__hdr_protect(bt2->f, dxpl_id, bt2_addr, NULL, NULL, H5AC__NO_FLAGS_SET))) + if(NULL == (hdr = H5B2__hdr_protect(bt2->f, dxpl_id, bt2_addr, NULL, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set the shared v2 B-tree header's file context for this operation */ @@ -1437,7 +1430,7 @@ done: */ herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, - void *parent, H5B2_remove_t op, void *op_data) + H5B2_remove_t op, void *op_data) { H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1452,7 +1445,7 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, #ifdef QAK HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); #endif /* QAK */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, ctx_udata, parent, H5AC__NO_FLAGS_SET))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, ctx_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Remember the callback & context for later */ @@ -1509,64 +1502,38 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* * Check arguments. + * + * At present, this function is only used to setup a flush dependency + * between an object header proxy and the v2 B-tree header when + * the B-tree is being used to index a chunked data set. + * + * Make sure that the parameters are congruent with this. */ HDassert(bt2); HDassert(hdr); - - /* Set the shared v2 B-tree header's file context for this operation */ - bt2->hdr->f = bt2->f; - - /* Set up flush dependency between parent entry and B-tree header */ - if(H5B2__create_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on file metadata") - -done: - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_depend() */ - - -/*------------------------------------------------------------------------- - * Function: H5B2_undepend - * - * Purpose: Remove a child flush dependency between the v2 B-tree's - * header and another piece of metadata in the file. - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * Fall 2012 - * - *------------------------------------------------------------------------- - */ -herr_t -H5B2_undepend(H5AC_info_t *parent_entry, H5B2_t *bt2) -{ - /* Local variables */ - H5B2_hdr_t *hdr = bt2->hdr; /* Header for B-tree */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(SUCCEED) - -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ + HDassert(parent_entry); + HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(parent_entry->type); + HDassert(parent_entry->type->id == H5AC_OHDR_PROXY_ID); + HDassert(hdr->parent == NULL || hdr->parent == parent_entry); /* - * Check arguments. + * Check to see if the flush dependency between the object header proxy + * and the v2 B-tree header has already been setup. If it hasn't, then + * set it up. */ - HDassert(bt2); - HDassert(hdr); + if(NULL == hdr->parent) { + /* Set the shared v2 B-tree header's file context for this operation */ + bt2->hdr->f = bt2->f; - /* Set the shared v2 B-tree header's file context for this operation */ - bt2->hdr->f = bt2->f; + /* Set up flush dependency between parent entry and B-tree header */ + if(H5B2__create_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on file metadata") - /* Remove flush dependency between parent entry and B-tree header */ - if(H5B2__destroy_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency on file metadata") + hdr->parent = parent_entry; + } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_undepend() */ +} /* end H5B2_depend() */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 58e76af..2c40761 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -328,7 +328,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, /* Initialize B-tree header info */ cparam.cls = H5B2_client_class_g[id]; - if(H5B2__hdr_init(hdr, &cparam, udata->ctx_udata, udata->parent, depth) < 0) + if(H5B2__hdr_init(hdr, &cparam, udata->ctx_udata, depth) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info") /* Set the B-tree header's address */ @@ -501,23 +501,35 @@ H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) /* Check if the file was opened with SWMR-write access */ if(hdr->swmr_write) { - HDassert(hdr->parent); switch(action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: case H5AC_NOTIFY_ACTION_AFTER_LOAD: - /* Create flush dependency on parent */ - if(H5B2__create_flush_depend((H5AC_info_t *)hdr->parent, (H5AC_info_t *)hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - break; - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: /* do nothing */ - break; + break; - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Destroy flush dependency on parent */ - if(H5B2__destroy_flush_depend((H5AC_info_t *)hdr->parent, (H5AC_info_t *)hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* If hdr->parent != NULL, the v2 B-tree header + * must be employed as the index for a chunked + * data set which has been modified by the SWMR writer. + * + * In this case, hdr->parent must contain a + * pointer to the object header proxy which is the flush + * dependency parent of the v2 B-tree header. + * + * hdr->parent is used to destroy the flush dependency + * before the v2 B-tree header is evicted. + */ + if(hdr->parent) { + /* Sanity checks */ + HDassert(((H5AC_info_t *)hdr->parent)->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(((H5AC_info_t *)hdr->parent)->type); + HDassert(((H5AC_info_t *)hdr->parent)->type->id == H5AC_OHDR_PROXY_ID); + + /* Destroy flush dependency on object header proxy */ + if(H5B2__destroy_flush_depend((H5AC_info_t *)hdr->parent, (H5AC_info_t *)hdr) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + } /* end if */ break; default: diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 05fa1d8..b0e9ba2 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -119,7 +119,7 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, dbg_ctx, NULL, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") /* Set file pointer for this B-tree operation */ @@ -229,7 +229,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end if */ /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, NULL, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") /* Set file pointer for this B-tree operation */ @@ -350,7 +350,7 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, NULL, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set file pointer for this B-tree operation */ diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index c91723d..414d3c3 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -109,7 +109,7 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); */ herr_t H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, - void *parent, uint16_t depth) + uint16_t depth) { size_t sz_max_nrec; /* Temporary variable for range checking */ unsigned u_max_nrec_size; /* Temporary variable for range checking */ @@ -133,7 +133,7 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, HDassert(cparam->merge_percent < (cparam->split_percent / 2)); /* Initialize basic information */ - hdr->parent = parent; + hdr->parent = NULL; hdr->rc = 0; hdr->pending_delete = FALSE; @@ -294,7 +294,7 @@ done: */ haddr_t H5B2__hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, - void *ctx_udata, void *parent) + void *ctx_udata) { H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ @@ -312,7 +312,7 @@ H5B2__hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header") /* Initialize shared B-tree info */ - if(H5B2__hdr_init(hdr, cparam, ctx_udata, parent, (uint16_t)0) < 0) + if(H5B2__hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info") /* Allocate space for the header on disk */ @@ -512,7 +512,7 @@ done: */ H5B2_hdr_t * H5B2__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t hdr_addr, void *ctx_udata, - void *parent, unsigned flags) + unsigned flags) { H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */ H5B2_hdr_t *ret_value = NULL; /* Return value */ @@ -528,7 +528,6 @@ H5B2__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t hdr_addr, void *ctx_udata, /* Set up user data for cache callbacks */ udata.f = f; - udata.parent = parent; udata.addr = hdr_addr; udata.ctx_udata = ctx_udata; diff --git a/src/H5B2int.c b/src/H5B2int.c index f7927db..a33b8c3 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -3410,7 +3410,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, void *swap_loc, void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n, - void *udata, H5B2_remove_t op, void *op_data) + H5B2_remove_t op, void *op_data) { H5AC_info_t *new_cache_info; /* Pointer to new cache info */ unsigned *new_cache_info_flags_ptr = NULL; @@ -3702,7 +3702,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* Attempt to remove record from child node */ if(depth > 1) { if(H5B2__remove_internal_by_idx(hdr, dxpl_id, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1), - new_cache_info, new_cache_info_flags_ptr, new_node_ptr, next_pos, n, udata, op, op_data) < 0) + new_cache_info, new_cache_info_flags_ptr, new_node_ptr, next_pos, n, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") } /* end if */ else { diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 6124ec4..5691d5f 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -241,7 +241,6 @@ typedef enum H5B2_nodepos_t { /* Callback info for loading a free space header into the cache */ typedef struct H5B2_hdr_cache_ud_t { H5F_t *f; /* File that v2 b-tree header is within */ - void *parent; /* Flush dependency parent */ haddr_t addr; /* Address of B-tree header in the file */ void *ctx_udata; /* User-data for protecting */ } H5B2_hdr_cache_ud_t; @@ -313,16 +312,16 @@ H5_DLL herr_t H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, /* Routines for managing B-tree header info */ H5_DLL H5B2_hdr_t *H5B2__hdr_alloc(H5F_t *f); H5_DLL haddr_t H5B2__hdr_create(H5F_t *f, hid_t dxpl_id, - const H5B2_create_t *cparam, void *ctx_udata, void *parent); + const H5B2_create_t *cparam, void *ctx_udata); H5_DLL herr_t H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, - void *ctx_udata, void *parent, uint16_t depth); + void *ctx_udata, uint16_t depth); H5_DLL herr_t H5B2__hdr_incr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2__hdr_decr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr); H5_DLL size_t H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2__hdr_dirty(H5B2_hdr_t *hdr); H5_DLL H5B2_hdr_t *H5B2__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t hdr_addr, - void *ctx_udata, void *parent, unsigned flags); + void *ctx_udata, unsigned flags); H5_DLL herr_t H5B2__hdr_unprotect(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned cache_flags); H5_DLL herr_t H5B2__hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id); @@ -383,7 +382,7 @@ H5_DLL herr_t H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, void *swap_loc, void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n, - void *udata, H5B2_remove_t op, void *op_data); + H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent, unsigned idx, H5B2_remove_t op, void *op_data); diff --git a/src/H5B2private.h b/src/H5B2private.h index 1047a29..cc60c9b 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -129,9 +129,8 @@ typedef struct H5B2_t H5B2_t; /* Library-private Function Prototypes */ /***************************************/ H5_DLL H5B2_t *H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, - void *ctx_udata, void *parent); -H5_DLL H5B2_t *H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, - void *parent); + void *ctx_udata); +H5_DLL H5B2_t *H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata); H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr/*out*/); H5_DLL herr_t H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata); H5_DLL herr_t H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, @@ -147,20 +146,19 @@ H5_DLL herr_t H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5_DLL herr_t H5B2_remove(H5B2_t *b2, hid_t dxpl_id, void *udata, H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, - H5_iter_order_t order, hsize_t idx, void *udata, H5B2_remove_t op, + H5_iter_order_t order, hsize_t idx, H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec); H5_DLL herr_t H5B2_size(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size); H5_DLL herr_t H5B2_close(H5B2_t *bt2, hid_t dxpl_id); H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, - void *ctx_udata, void *parent, H5B2_remove_t op, void *op_data); + void *ctx_udata, H5B2_remove_t op, void *op_data); H5_DLL htri_t H5B2_support(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5AC_info_t *child); H5_DLL herr_t H5B2_unsupport(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5AC_info_t *child); H5_DLL herr_t H5B2_depend(H5AC_info_t *parent_entry, H5B2_t *bt2); -H5_DLL herr_t H5B2_undepend(H5AC_info_t *parent_entry, H5B2_t *bt2); /* Statistics routines */ H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info); diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index 5ff174d..f286db2 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -107,6 +107,7 @@ static herr_t H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, /* Helper routine */ static herr_t H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info); +static herr_t H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info); /* Callback for H5B2_iterate() which is called in H5D__bt2_idx_iterate() */ static int H5D__bt2_idx_iterate_cb(const void *_record, void *_udata); @@ -735,6 +736,63 @@ H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, /*------------------------------------------------------------------------- + * Function: H5D__btree2_idx_depend + * + * Purpose: Create flush dependency between v2 B-tree and dataset's + * object header. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, December 18, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info) +{ + H5O_loc_t oloc; /* Temporary object header location for dataset */ + H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_BT2 == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(idx_info->storage->u.btree2.bt2); + + /* Set up object header location for dataset */ + H5O_loc_reset(&oloc); + oloc.file = idx_info->f; + oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; + + /* Pin the dataset's object header proxy */ + if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") + + /* Make the v2 B-tree a child flush dependency of the dataset's object header */ + if(H5B2_depend((H5AC_info_t *)oh_proxy, idx_info->storage->u.btree2.bt2) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header") + +done: + /* Unpin the dataset's object header proxy */ + if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__btree2_idx_depend() */ + + +/*------------------------------------------------------------------------- * Function: H5D__bt2_idx_open() * * Purpose: Opens an existing v2 B-tree. @@ -755,8 +813,6 @@ static herr_t H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info) { H5D_bt2_ctx_ud_t u_ctx; /* user data for creating context */ - H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -777,26 +833,16 @@ H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info) u_ctx.chunk_size = idx_info->layout->size; u_ctx.dim = idx_info->layout->dim; - /* Check for SWMR writes to the file */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* Open v2 B-tree for the chunk index */ - if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr , &u_ctx, oh_proxy))) + if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset") -done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") + /* Check for SWMR writes to the file */ + if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) + if(H5D__btree2_idx_depend(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header") +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__bt2_idx_open() */ @@ -817,8 +863,6 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) { H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ H5D_bt2_ctx_ud_t u_ctx; /* data for context call */ - H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -861,30 +905,20 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) u_ctx.chunk_size = idx_info->layout->size; u_ctx.dim = idx_info->layout->dim; - /* Check for SWMR writes to the file */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* Create the v2 B-tree for the chunked dataset */ - if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, idx_info->dxpl_id, &bt2_cparam, &u_ctx, oh_proxy))) + if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, idx_info->dxpl_id, &bt2_cparam, &u_ctx))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset") /* Retrieve the v2 B-tree's address in the file */ if(H5B2_get_addr(idx_info->storage->u.btree2.bt2, &(idx_info->storage->idx_addr)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking chunked dataset") -done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") + /* Check for SWMR writes to the file */ + if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) + if(H5D__btree2_idx_depend(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header") +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__bt2_idx_create() */ @@ -1345,8 +1379,6 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */ H5B2_remove_t remove_op; /* The removal callback */ H5D_bt2_ctx_ud_t u_ctx; /* data for context call */ - H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1376,30 +1408,15 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) else remove_op = H5D__bt2_remove_cb; - /* Check for SWMR writes to the file */ - if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - } /* end if */ - /* Delete the v2 B-tree */ /*(space in the file for each object is freed in the 'remove' callback) */ - if(H5B2_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx, oh_proxy, remove_op, &remove_udata) < 0) + if(H5B2_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx, remove_op, &remove_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") idx_info->storage->idx_addr = HADDR_UNDEF; } /* end if */ done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__bt2_idx_delete() */ diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 35de599..14aaade 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -149,7 +149,6 @@ static herr_t H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info); /* Generic extensible array routines */ static herr_t H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info); static herr_t H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info); -static herr_t H5D__earray_idx_undepend(const H5D_chk_idx_info_t *idx_info); /*********************/ @@ -776,63 +775,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_undepend - * - * Purpose: Remove flush dependency between extensible array and dataset's - * object header. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Tuesday, June 2, 2009 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__earray_idx_undepend(const H5D_chk_idx_info_t *idx_info) -{ - H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(idx_info->storage->u.earray.ea); - - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.earray.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - - /* Remove the extensible array as a child flush dependency of the dataset's object header */ - if(H5EA_undepend((H5AC_info_t *)oh_proxy, idx_info->storage->u.earray.ea) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on object header") - -done: - /* Unpin the dataset's object header proxy */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__earray_idx_undepend() */ - - -/*------------------------------------------------------------------------- * Function: H5D__earray_idx_open * * Purpose: Opens an existing extensible array. diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index a1dc23b..af151a8 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -150,7 +150,6 @@ static herr_t H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info); /* Generic extensible array routines */ static herr_t H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info); static herr_t H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info); -static herr_t H5D__farray_idx_undepend(const H5D_chk_idx_info_t *idx_info); /*********************/ /* Package Variables */ @@ -777,61 +776,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__farray_idx_undepend - * - * Purpose: Remove flush dependency between fixed array and dataset's - * object header. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Copied and modified from H5Dearray.c - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__farray_idx_undepend(const H5D_chk_idx_info_t *idx_info) -{ - H5O_loc_t oloc; /* Temporary object header location for dataset */ - H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(idx_info->storage->u.farray.fa); - - /* Set up object header location for dataset */ - H5O_loc_reset(&oloc); - oloc.file = idx_info->f; - oloc.addr = idx_info->storage->u.farray.dset_ohdr_addr; - - /* Pin the dataset's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy") - - /* Remove the extensible array as a child flush dependency of the dataset's object header */ - if(H5FA_undepend((H5AC_info_t *)oh_proxy, idx_info->storage->u.farray.fa) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on object header") - -done: - /* Unpin the dataset's object header proxy */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__farray_idx_undepend() */ - -/*------------------------------------------------------------------------- * Function: H5D__farray_idx_init * * Purpose: Initialize the indexing information for a dataset. diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 5203af7..c00e118 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -143,7 +143,6 @@ H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr); H5_DLL herr_t H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt); H5_DLL herr_t H5EA_get(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt); H5_DLL herr_t H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea); -H5_DLL herr_t H5EA_undepend(H5AC_info_t *parent_entry, H5EA_t *ea); H5_DLL herr_t H5EA_iterate(H5EA_t *fa, hid_t dxpl_id, H5EA_operator_t op, void *udata); H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id); H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h index 2ce4a1d..b7c141a 100644 --- a/src/H5FAprivate.h +++ b/src/H5FAprivate.h @@ -128,7 +128,6 @@ H5_DLL herr_t H5FA_get_addr(const H5FA_t *fa, haddr_t *addr); H5_DLL herr_t H5FA_set(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, const void *elmt); H5_DLL herr_t H5FA_get(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, void *elmt); H5_DLL herr_t H5FA_depend(H5AC_info_t *parent_entry, H5FA_t *fa); -H5_DLL herr_t H5FA_undepend(H5AC_info_t *parent_entry, H5FA_t *fa); H5_DLL herr_t H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata); H5_DLL herr_t H5FA_close(H5FA_t *fa, hid_t dxpl_id); H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata); diff --git a/src/H5FS.c b/src/H5FS.c index 30ea330..bb45c75 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -1045,7 +1045,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FA_undepend + * Function: H5FS_undepend * * Purpose: Remove a child flush dependency between the free space * manager's and another piece of metadata in the file. diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 9f3a556..e8fa237 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -327,7 +327,7 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); (uint32_t)fheap_id_len; /* Fractal heap ID */ bt2_cparam.split_percent = H5G_NAME_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_NAME_BT2_MERGE_PERC; - if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam, NULL, NULL))) + if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") /* Retrieve the v2 B-tree's address in the file */ @@ -348,7 +348,7 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr) (uint32_t)fheap_id_len; /* Fractal heap ID */ bt2_cparam.split_percent = H5G_CORDER_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_CORDER_BT2_MERGE_PERC; - if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam, NULL, NULL))) + if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index") /* Retrieve the v2 B-tree's address in the file */ @@ -440,7 +440,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into fractal heap") /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Create the callback information for v2 B-tree record insertion */ @@ -462,7 +462,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst if(linfo->index_corder) { /* Open the creation order index v2 B-tree */ HDassert(H5F_addr_defined(linfo->corder_bt2_addr)); - if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, linfo->corder_bt2_addr, NULL, NULL))) + if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, linfo->corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Insert the record into the creation order index v2 B-tree */ @@ -559,7 +559,7 @@ H5G__dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Construct the user data for v2 B-tree callback */ @@ -735,7 +735,7 @@ H5G__dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") /* Construct the user data for v2 B-tree callback */ @@ -1044,7 +1044,7 @@ H5G__dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") /* Construct the user data for v2 B-tree iterator callback */ @@ -1246,7 +1246,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") /* Set up the user data for the v2 B-tree 'record remove' callback */ @@ -1328,7 +1328,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_ud H5G_bt2_ud_common_t bt2_udata; /* Info for B-tree callbacks */ /* Open the creation order index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(udata->f, udata->dxpl_id, udata->corder_bt2_addr, NULL, NULL))) + if(NULL == (bt2 = H5B2_open(udata->f, udata->dxpl_id, udata->corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Set up the user data for the v2 B-tree 'record remove' callback */ @@ -1442,7 +1442,7 @@ H5G__dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Open the name index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, linfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Set up the user data for the v2 B-tree 'record remove' callback */ @@ -1579,7 +1579,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) } /* end else */ /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->other_bt2_addr, NULL, NULL))) + if(NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->other_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for 'other' index") /* Set the common information for the v2 B-tree remove operation */ @@ -1684,7 +1684,7 @@ H5G__dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") /* Set up the user data for the v2 B-tree 'remove by index' callback */ @@ -1696,7 +1696,7 @@ H5G__dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, udata.grp_full_path_r = grp_full_path_r; /* Remove the record from the name index v2 B-tree */ - if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, NULL, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0) + if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from indexed v2 B-tree") } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ @@ -1778,7 +1778,7 @@ H5G__dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link) udata.replace_names = FALSE; /* Delete the name index, adjusting the ref. count on links removed */ - if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL, H5G_dense_remove_bt2_cb, &udata) < 0) + if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, NULL, H5G_dense_remove_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index") /* Close the fractal heap */ @@ -1787,7 +1787,7 @@ H5G__dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link) } /* end if */ else { /* Delete the name index, without adjusting the ref. count on the links */ - if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL, NULL, NULL) < 0) + if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index") } /* end else */ linfo->name_bt2_addr = HADDR_UNDEF; @@ -1796,7 +1796,7 @@ H5G__dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link) if(linfo->index_corder) { /* Delete the creation order index, without adjusting the ref. count on the links */ HDassert(H5F_addr_defined(linfo->corder_bt2_addr)); - if(H5B2_delete(f, dxpl_id, linfo->corder_bt2_addr, NULL, NULL, NULL, NULL) < 0) + if(H5B2_delete(f, dxpl_id, linfo->corder_bt2_addr, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index") linfo->corder_bt2_addr = HADDR_UNDEF; } /* end if */ diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 4991967..92ad0af 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -342,7 +342,7 @@ H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id) /* Check if we are using "dense" link storage */ if(H5F_addr_defined(linfo->fheap_addr)) { /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(grp_oloc->file, dxpl_id, linfo->name_bt2_addr, NULL, NULL))) + if(NULL == (bt2_name = H5B2_open(grp_oloc->file, dxpl_id, linfo->name_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in "name" B-tree */ diff --git a/src/H5Goh.c b/src/H5Goh.c index dc6083c..bde540c 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -363,7 +363,7 @@ H5O_group_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t * /* Check if name index available */ if(H5F_addr_defined(linfo.name_bt2_addr)) { /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, dxpl_id, linfo.name_bt2_addr, NULL, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, dxpl_id, linfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Get name index B-tree size */ @@ -374,7 +374,7 @@ H5O_group_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t * /* Check if creation order index available */ if(H5F_addr_defined(linfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(loc->file, dxpl_id, linfo.corder_bt2_addr, NULL, NULL))) + if(NULL == (bt2_corder = H5B2_open(loc->file, dxpl_id, linfo.corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Get creation order index B-tree size */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index f7ca0f1..a8796fb 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -413,7 +413,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) HGOTO_DONE_TAG(FAIL, FAIL) /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(grp->oloc.file, dxpl_id, linfo.name_bt2_addr, NULL, NULL))) + if(NULL == (bt2_name = H5B2_open(grp->oloc.file, dxpl_id, linfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -423,7 +423,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) /* Check if there is a creation order index */ if(H5F_addr_defined(linfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(grp->oloc.file, dxpl_id, linfo.corder_bt2_addr, NULL, NULL))) + if(NULL == (bt2_corder = H5B2_open(grp->oloc.file, dxpl_id, linfo.corder_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index d1426c6..42857c0 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -126,7 +126,6 @@ H5HF_hdr_alloc(H5F_t *f) /* Set the internal parameters for the heap */ hdr->f = f; - hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; hdr->sizeof_size = H5F_SIZEOF_SIZE(f); hdr->sizeof_addr = H5F_SIZEOF_ADDR(f); diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 95095e9..2b01a74 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -157,16 +157,13 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) bt2_cparam.merge_percent = H5HF_HUGE_BT2_MERGE_PERC; /* Create v2 B-tree for tracking 'huge' objects */ - if(NULL == (hdr->huge_bt2 = H5B2_create(hdr->f, dxpl_id, &bt2_cparam, hdr->f, NULL))) + if(NULL == (hdr->huge_bt2 = H5B2_create(hdr->f, dxpl_id, &bt2_cparam, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects") /* Retrieve the v2 B-tree's address in the file */ if(H5B2_get_addr(hdr->huge_bt2, &hdr->huge_bt2_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking 'huge' heap objects") - /* Create a flush dependency between the 'huge' v2 B-tree and the fractal heap */ - if(hdr->swmr_write && H5B2_depend((H5AC_info_t *)hdr, hdr->huge_bt2) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "can't create flush dependency between fractal heap and 'huge' v2 B-tree") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_huge_bt2_create() */ @@ -342,7 +339,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); /* Check if v2 B-tree is open yet */ if(NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ - if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL))) + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") } /* end if */ } /* end else */ @@ -548,7 +545,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Check if v2 B-tree is open yet */ if(NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ - if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL))) + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") } /* end if */ @@ -632,7 +629,7 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Check if v2 B-tree is open yet */ if(NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ - if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL))) + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") } /* end if */ @@ -726,7 +723,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Check if v2 B-tree is open yet */ if(NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ - if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL))) + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") } /* end if */ @@ -874,7 +871,7 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Check if v2 B-tree is open yet */ if(NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ - if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL))) + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") } /* end if */ @@ -1004,7 +1001,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Check if v2 B-tree is open yet */ if(NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ - if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL))) + if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects") } /* end if */ @@ -1125,13 +1122,9 @@ H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id) /* Sanity check */ HDassert(hdr->huge_size == 0); - /* Destroy the flush dependency between the 'huge' v2 B-tree and the fractal heap */ - if(hdr->swmr_write && H5B2_undepend((H5AC_info_t *)hdr, hdr->huge_bt2) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "can't destroy flush dependency between fractal heap and 'huge' v2 B-tree") - /* Delete the v2 B-tree */ /* (any v2 B-tree class will work here) */ - if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL, NULL, NULL) < 0) + if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL, NULL) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") /* Reset the information about 'huge' objects in the file */ @@ -1199,7 +1192,7 @@ H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) } /* end else */ /* Delete the v2 B-tree */ - if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL, op, &udata) < 0) + if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, op, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") done: diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index b4e6558..15b62e2 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -360,7 +360,6 @@ typedef struct H5HF_hdr_t { uint8_t heap_off_size; /* Size of heap offsets (in bytes) */ uint8_t heap_len_size; /* Size of heap ID lengths (in bytes) */ hbool_t checked_filters; /* TRUE if pipeline passes can_apply checks */ - hbool_t swmr_write; /* Flag indicating the file is opened with SWMR-write access */ } H5HF_hdr_t; /* Common indirect block doubling table entry */ diff --git a/src/H5HFstat.c b/src/H5HFstat.c index b54a191..303b1f4 100644 --- a/src/H5HFstat.c +++ b/src/H5HFstat.c @@ -156,7 +156,7 @@ H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size) /* Check for B-tree storage of huge objects in fractal heap */ if(H5F_addr_defined(hdr->huge_bt2_addr)) { /* Open the huge object index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f, NULL))) + if(NULL == (bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' objects") /* Get the B-tree storage */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 9e32af4..44c6611 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -339,7 +339,6 @@ static herr_t H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) { H5O_ainfo_t *ainfo = (H5O_ainfo_t *)_mesg; - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -351,22 +350,12 @@ H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) /* If the object is using "dense" attribute storage, delete it */ if(H5F_addr_defined(ainfo->fheap_addr)) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(f, dxpl_id, open_oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Delete the attribute */ - if(H5A_dense_delete(f, dxpl_id, ainfo, oh_proxy) < 0) + if(H5A_dense_delete(f, dxpl_id, ainfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense attribute storage") } /* end if */ done: - /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_ainfo_delete() */ @@ -449,9 +438,7 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* Set copied metadata tag */ H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL); - /*!FIXME Must pass something for the parent, once we have a way to - * depend on an object being copied (ohdr proxy?) -NAF */ - if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst, NULL) < 0) + if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") /* Reset metadata tag */ diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index a11e6dc..9b494a1 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -220,7 +220,6 @@ herr_t H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) { H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ herr_t ret_value = SUCCEED; /* Return value */ @@ -281,14 +280,8 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) H5O_iter_cvt_t udata; /* User data for callback */ H5O_mesg_operator_t op; /* Wrapper for operator */ - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Create dense storage for attributes */ - if(H5A_dense_create(loc->file, dxpl_id, &ainfo, oh_proxy) < 0) + if(H5A_dense_create(loc->file, dxpl_id, &ainfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create dense storage for attributes") /* Set up user data for callback */ @@ -401,8 +394,6 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") @@ -480,7 +471,6 @@ H5A_t * H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5A_t *exist_attr = NULL; /* Existing opened attribute object */ H5A_t *opened_attr = NULL; /* Newly opened attribute object */ @@ -517,14 +507,8 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) else { /* Check for attributes in dense storage */ if(H5F_addr_defined(ainfo.fheap_addr)) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, NULL, "unable to pin object header proxy") - /* Open attribute with dense storage */ - if(NULL == (opened_attr = H5A_dense_open(loc->file, dxpl_id, &ainfo, name, oh_proxy))) + if(NULL == (opened_attr = H5A_dense_open(loc->file, dxpl_id, &ainfo, name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") } /* end if */ else { @@ -559,8 +543,6 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) ret_value = opened_attr; done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, NULL, "unable to unpin attribute object header proxy") if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") @@ -1199,7 +1181,6 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, const char *new_name) { H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_proxy_t *oh_proxy = NULL; /* Attribute's object header proxy */ H5O_ainfo_t ainfo; /* Attribute information for object */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1224,14 +1205,8 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin attribute object header proxy") - /* Rename the attribute data in dense storage */ - if(H5A_dense_rename(loc->file, dxpl_id, &ainfo, old_name, new_name, oh_proxy) < 0) + if(H5A_dense_rename(loc->file, dxpl_id, &ainfo, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") } /* end if */ else { @@ -1271,8 +1246,6 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") @@ -1298,7 +1271,6 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ herr_t ret_value = FAIL; /* Return value */ @@ -1329,19 +1301,13 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, if(skip > 0 && skip >= ainfo.nattrs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Release the object header */ if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") oh = NULL; /* Iterate over attributes in dense storage */ - if((ret_value = H5A_dense_iterate(loc->file, dxpl_id, loc_id, &ainfo, idx_type, order, skip, oh_proxy, last_attr, attr_op, op_data)) < 0) + if((ret_value = H5A_dense_iterate(loc->file, dxpl_id, loc_id, &ainfo, idx_type, order, skip, last_attr, attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); } /* end if */ else { @@ -1365,8 +1331,6 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, done: /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(atable.attrs && H5A_attr_release_table(&atable) < 0) @@ -1439,7 +1403,6 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, hid_t dxpl_id) { H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1457,14 +1420,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, hbool_t can_convert = TRUE; /* Whether converting to attribute messages is possible */ size_t u; /* Local index */ - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Build the table of attributes for this object */ - if(H5A_dense_build_table(loc->file, dxpl_id, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, oh_proxy, &atable) < 0) + if(H5A_dense_build_table(loc->file, dxpl_id, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, &atable) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") /* Inspect attributes in table for ones that can't be converted back @@ -1519,7 +1476,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, } /* end for */ /* Remove the dense storage */ - if(H5A_dense_delete(loc->file, dxpl_id, ainfo, oh_proxy) < 0) + if(H5A_dense_delete(loc->file, dxpl_id, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete dense attribute storage") } /* end if */ } /* end if */ @@ -1538,8 +1495,6 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, done: /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") @@ -1612,7 +1567,6 @@ herr_t H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1637,14 +1591,8 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Delete attribute from dense storage */ - if(H5A_dense_remove(loc->file, dxpl_id, &ainfo, name, oh_proxy) < 0) + if(H5A_dense_remove(loc->file, dxpl_id, &ainfo, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") } /* end if */ else { @@ -1678,8 +1626,6 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") @@ -1705,7 +1651,6 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ @@ -1730,14 +1675,8 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Delete attribute from dense storage */ - if(H5A_dense_remove_by_idx(loc->file, dxpl_id, &ainfo, idx_type, order, n, oh_proxy) < 0) + if(H5A_dense_remove_by_idx(loc->file, dxpl_id, &ainfo, idx_type, order, n) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") } /* end if */ else { @@ -1779,8 +1718,6 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") if(atable.attrs && H5A_attr_release_table(&atable) < 0) @@ -1900,7 +1837,6 @@ htri_t H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ret_value = FAIL; /* Return value */ @@ -1924,14 +1860,8 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Check if attribute exists in dense storage */ - if((ret_value = H5A_dense_exists(loc->file, dxpl_id, &ainfo, name, oh_proxy)) < 0) + if((ret_value = H5A_dense_exists(loc->file, dxpl_id, &ainfo, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") } /* end if */ else { @@ -1955,8 +1885,6 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) } /* end else */ done: - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") @@ -1982,7 +1910,6 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) H5HF_t *fheap = NULL; /* Fractal heap handle */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2000,16 +1927,10 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") else if(ainfo_exists > 0) { - /* Check for SWMR writes to the file */ - if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(f, dxpl_id, oh))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Check if name index available */ if(H5F_addr_defined(ainfo.name_bt2_addr)) { /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo.name_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Get name index B-tree size */ @@ -2020,7 +1941,7 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) /* Check if creation order index available */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo.corder_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Get creation order index B-tree size */ @@ -2043,8 +1964,6 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) done: /* Release resources */ - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(fheap && H5HF_close(fheap, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) diff --git a/src/H5Otest.c b/src/H5Otest.c index a911469..1c149e3 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -159,7 +159,6 @@ htri_t H5O_is_attr_empty_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ @@ -195,17 +194,11 @@ H5O_is_attr_empty_test(hid_t oid) /* Check for any messages in object header */ HDassert(nattrs == 0); - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, H5AC_ind_dxpl_id, oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Set metadata tag in dxpl_id */ H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ @@ -230,8 +223,6 @@ done: /* Release resources */ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") @@ -262,7 +253,6 @@ herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) { H5O_t *oh = NULL; /* Object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -297,17 +287,11 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) /* Check for any messages in object header */ HDassert(obj_nattrs == 0); - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, H5AC_ind_dxpl_id, oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Set metadata tag in dxpl_id */ H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ @@ -329,8 +313,6 @@ done: /* Release resources */ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") @@ -363,7 +345,6 @@ herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) { H5O_t *oh = NULL; /* Object header */ - H5O_proxy_t *oh_proxy = NULL; /* Object header proxy */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_ainfo_t ainfo; /* Attribute information for object */ @@ -391,12 +372,6 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_ERROR_TAG(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ - /* Check for SWMR writes to the file */ - if(H5F_INTENT(loc->file) & H5F_ACC_SWMR_WRITE) - /* Pin the attribute's object header proxy */ - if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy_oh(loc->file, H5AC_ind_dxpl_id, oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header proxy") - /* Check for 'dense' attribute storage file addresses being defined */ if(!H5F_addr_defined(ainfo.fheap_addr)) HGOTO_DONE_TAG(FAIL, FAIL) @@ -404,7 +379,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_DONE_TAG(FAIL, FAIL) /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -414,7 +389,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Check if there is a creation order index */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL, oh_proxy))) + if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ @@ -433,8 +408,6 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") - if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin attribute object header proxy") if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") diff --git a/src/H5SM.c b/src/H5SM.c index 908463e..4a562dd 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -500,7 +500,7 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id) bt2_cparam.rrec_size = (uint32_t)H5SM_SOHM_ENTRY_SIZE(f); bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT; bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT; - if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam, f, NULL))) + if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index") /* Retrieve the v2 B-tree's address in the file */ @@ -600,7 +600,7 @@ H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id, HDassert(header->index_type == H5SM_BTREE); /* Delete the B-tree. */ - if(H5B2_delete(f, dxpl_id, header->index_addr, f, NULL, NULL, NULL) < 0) + if(H5B2_delete(f, dxpl_id, header->index_addr, f, NULL, NULL) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree") /* Revert to list unless B-trees can have zero records */ @@ -743,7 +743,7 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, bt2_cparam.rrec_size = (uint32_t)H5SM_SOHM_ENTRY_SIZE(f); bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT; bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT; - if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam, f, NULL))) + if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index") /* Retrieve the v2 B-tree's address in the file */ @@ -856,7 +856,7 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i /* Delete the B-tree and have messages copy themselves to the * list as they're deleted */ - if(H5B2_delete(f, dxpl_id, btree_addr, f, NULL, H5SM_bt2_convert_to_list_op, list) < 0) + if(H5B2_delete(f, dxpl_id, btree_addr, f, H5SM_bt2_convert_to_list_op, list) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree") done: @@ -1339,7 +1339,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, HDassert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") if(defer) { @@ -1467,7 +1467,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, /* Open the index v2 B-tree, if it isn't already */ if(NULL == bt2) { - if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") } /* end if */ @@ -1836,7 +1836,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, HDassert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") /* If this returns failure, it means that the message wasn't found. @@ -1866,7 +1866,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, else { /* Open the index v2 B-tree, if it isn't already */ if(NULL == bt2) { - if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") } /* end if */ @@ -2218,7 +2218,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id, HDassert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") /* Look up the message in the v2 B-tree */ @@ -2752,7 +2752,7 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info) if(table->indexes[u].index_type == H5SM_BTREE) { if(H5F_addr_defined(table->indexes[u].index_addr)) { /* Open the index v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl_id, table->indexes[u].index_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl_id, table->indexes[u].index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") if(H5B2_size(bt2, dxpl_id, &(ih_info->index_size)) < 0) diff --git a/test/btree2.c b/test/btree2.c index c367779..7a2432c 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -138,7 +138,7 @@ create_btree(H5F_t *f, hid_t dxpl, const H5B2_create_t *cparam, H5B2_t **bt2, haddr_t *bt2_addr) { /* Create the v2 B-tree & get its address */ - if(NULL == (*bt2 = H5B2_create(f, dxpl, cparam, f, NULL))) + if(NULL == (*bt2 = H5B2_create(f, dxpl, cparam, f))) FAIL_STACK_ERROR if(H5B2_get_addr(*bt2, bt2_addr/*out*/) < 0) FAIL_STACK_ERROR @@ -177,7 +177,7 @@ reopen_btree(H5F_t *f, hid_t dxpl, H5B2_t **bt2, haddr_t bt2_addr, FAIL_STACK_ERROR /* Re-open v2 B-tree */ - if(NULL == (*bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + if(NULL == (*bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR } /* end if */ @@ -2852,7 +2852,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); STACK_ERROR /* Re-open v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR /* Check up on B-tree after re-open */ @@ -6547,7 +6547,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); } /* end for */ /* Re-open v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR /* Remove all records */ @@ -6631,7 +6631,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); STACK_ERROR /* Re-open v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR /* Remove all records */ @@ -6641,7 +6641,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); rrecord = HSIZET_MAX; /* Remove random record */ - if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_INC, (hsize_t)rem_idx, NULL, remove_cb, &rrecord) < 0) + if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_INC, (hsize_t)rem_idx, remove_cb, &rrecord) < 0) FAIL_STACK_ERROR /* Make certain that the record value is correct */ @@ -6719,14 +6719,14 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); STACK_ERROR /* Re-open v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR /* Remove all records */ for(u = 0; u < INSERT_MANY; u++) { /* Remove first record */ rrecord = HSIZET_MAX; - if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_INC, (hsize_t)0, NULL, remove_cb, &rrecord) < 0) + if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_INC, (hsize_t)0, remove_cb, &rrecord) < 0) FAIL_STACK_ERROR /* Make certain that the record value is correct */ @@ -6804,14 +6804,14 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); STACK_ERROR /* Re-open v2 B-tree */ - if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR /* Remove all records */ for(u = 0; u < INSERT_MANY; u++) { /* Remove last record */ rrecord = HSIZET_MAX; - if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_DEC, (hsize_t)0, NULL, remove_cb, &rrecord) < 0) + if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_DEC, (hsize_t)0, remove_cb, &rrecord) < 0) FAIL_STACK_ERROR /* Make certain that the record value is correct */ @@ -7165,7 +7165,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) /* * Delete v2 B-tree */ - if(H5B2_delete(f, dxpl, bt2_addr, f, NULL, NULL, NULL) < 0) + if(H5B2_delete(f, dxpl, bt2_addr, f, NULL, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -7222,7 +7222,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) /* * Delete v2 B-tree */ - if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, bt2_addr, f, NULL, NULL, NULL) < 0) + if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, bt2_addr, f, NULL, NULL) < 0) FAIL_STACK_ERROR /* Close file */ @@ -7279,7 +7279,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) /* * Delete v2 B-tree */ - if(H5B2_delete(f, dxpl, bt2_addr, f, NULL, NULL, NULL) < 0) + if(H5B2_delete(f, dxpl, bt2_addr, f, NULL, NULL) < 0) FAIL_STACK_ERROR /* Close file */ @@ -7336,7 +7336,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) /* * Delete v2 B-tree */ - if(H5B2_delete(f, dxpl, bt2_addr, f, NULL, NULL, NULL) < 0) + if(H5B2_delete(f, dxpl, bt2_addr, f, NULL, NULL) < 0) FAIL_STACK_ERROR /* Close file */ @@ -7648,7 +7648,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) TEST_ERROR /* Re-open v2 B-tree */ - if(NULL == (bt2_2 = H5B2_open(f, dxpl, bt2_addr, f, NULL))) + if(NULL == (bt2_2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR /* Close the second v2 B-tree wrapper */ @@ -7694,7 +7694,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) FAIL_STACK_ERROR /* Open the B-tree through the second file handle */ - if(NULL == (bt2_2 = H5B2_open(f2, dxpl, bt2_addr, f2, NULL))) + if(NULL == (bt2_2 = H5B2_open(f2, dxpl, bt2_addr, f2))) FAIL_STACK_ERROR /* Close the extra file handles */ -- cgit v0.12 From 4cdae66f0d62e3b18124dea54900e24fefdb8990 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 21 Dec 2015 17:23:37 -0500 Subject: [svn-r28718] Description: Remove unused comments/code. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Dchunk.c | 1 - src/H5Dpkg.h | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 1310a97..abea154 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1937,7 +1937,6 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Set chunk's [scaled] coordinates */ io_info->store->chunk.scaled = chunk_info->scaled; - /* Load the chunk into cache and lock it. */ /* Determine if we should use the chunk cache */ if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 248808d..9daa1af 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -455,8 +455,6 @@ typedef struct H5D_shared_t { hid_t type_id; /* ID for dataset's datatype */ H5T_t *type; /* Datatype for this dataset */ H5S_t *space; /* Dataspace of this dataset */ - hbool_t space_dirty; /* Whether the dataspace info needs to be flushed to the file */ - hbool_t layout_dirty; /* Whether the layout info needs to be flushed to the file */ hid_t dcpl_id; /* Dataset creation property id */ H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */ H5O_layout_t layout; /* Data layout */ @@ -766,17 +764,6 @@ H5_DLL herr_t H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id); H5_DLL herr_t H5D__fill_term(H5D_fill_buf_info_t *fb_info); -/* Functions that operate on chunk proxy objects */ -H5_DLL herr_t H5D__chunk_proxy_create(H5D_t *dset, hid_t dxpl_id, - H5D_chunk_ud_t *udata, H5D_rdcc_ent_t *ent); -H5_DLL herr_t H5D__chunk_proxy_remove(const H5D_t *dset, hid_t dxpl_it, - H5D_rdcc_ent_t *ent); -H5_DLL herr_t H5D__chunk_proxy_mark(H5D_rdcc_ent_t *ent, hbool_t dirty); -H5_DLL herr_t H5D__chunk_proxy_create_flush_dep(H5D_rdcc_ent_t *ent, - void *parent); -H5_DLL herr_t H5D__chunk_proxy_update_flush_dep(H5D_rdcc_ent_t *ent, - void *old_parent, void *new_parent); - #ifdef H5_HAVE_PARALLEL #ifdef H5S_DEBUG -- cgit v0.12 From ba4810c546920866731b1d0ea9ca6241edde7767 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 22 Dec 2015 15:09:19 -0500 Subject: [svn-r28722] Description: Remove unused code and align w/trunk. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committtest not required on this branch) --- src/H5Dbtree.c | 1 - src/H5Dchunk.c | 10 +--------- src/H5Dearray.c | 1 - src/H5Dfarray.c | 1 - src/H5Dpkg.h | 8 -------- src/H5Oprivate.h | 6 ------ 6 files changed, 1 insertion(+), 26 deletions(-) diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 159acb0..8ef14b9 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -940,7 +940,6 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) /* Initialize "user" data for B-tree callbacks, etc. */ udata.layout = idx_info->layout; udata.storage = idx_info->storage; - udata.rdcc = NULL; /* Create the v1 B-tree for the chunk index */ if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index abea154..4d02864 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -3360,12 +3360,9 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, if(NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry") - ent->locked = 0; ent->edge_chunk_state = disable_filters ? H5D_RDCC_DISABLE_FILTERS : 0; if(udata->new_unfilt_chunk) ent->edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; - ent->dirty = FALSE; - ent->deleted = FALSE; /* Initialize the new entry */ ent->chunk_block.offset = chunk_addr; @@ -3883,16 +3880,13 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end else */ while(!carry) { - /* None of the chunks should be allocated */ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ - /* Reset size of chunk in bytes, in case filtered size changes */ - /* chunk_size = orig_chunk_size; */ - /* Look up this chunk */ if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG + /* None of the chunks should be allocated */ if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) HDassert(!H5F_addr_defined(udata.chunk_block.offset)); @@ -3960,7 +3954,6 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, udata.common.layout = &layout->u.chunk; udata.common.storage = &layout->storage.u.chunk; udata.common.scaled = scaled; - udata.common.rdcc = &dset->shared->cache.chunk; udata.chunk_block.offset = HADDR_UNDEF; H5_CHECKED_ASSIGN(udata.chunk_block.length, uint32_t, chunk_size, size_t); udata.filter_mask = filter_mask; @@ -4749,7 +4742,6 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Initialize user data for removal */ idx_udata.layout = &layout->u.chunk; idx_udata.storage = &layout->storage.u.chunk; - idx_udata.rdcc = rdcc; /* Determine if partial edge chunk filters are disabled */ disable_edge_filters = (layout->u.chunk.flags diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 14aaade..84c26bf 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -1328,7 +1328,6 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDmemset(&udata, 0, sizeof udata); udata.common.layout = idx_info->layout; udata.common.storage = idx_info->storage; - udata.common.rdcc = NULL; HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); udata.filtered = (idx_info->pline->nused > 0); if(!udata.filtered) { diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index af151a8..2958a66 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -1216,7 +1216,6 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDmemset(&udata, 0, sizeof udata); udata.common.layout = idx_info->layout; udata.common.storage = idx_info->storage; - udata.common.rdcc = NULL; HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); udata.filtered = (idx_info->pline->nused > 0); if(!udata.filtered) { diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 9daa1af..fe38dd4 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -276,9 +276,6 @@ typedef struct H5D_chunk_common_ud_t { const H5O_layout_chunk_t *layout; /* Chunk layout description */ const H5O_storage_chunk_t *storage; /* Chunk storage description */ const hsize_t *scaled; /* Scaled coordinates for a chunk */ - const struct H5D_rdcc_t *rdcc; /* Chunk cache. Only necessary if the index may - * be modified, and if any chunks in the dset - * may be cached */ } H5D_chunk_common_ud_t; /* B-tree callback info for various operations */ @@ -713,11 +710,6 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *store); -H5_DLL herr_t H5D__chunk_create_flush_dep(const H5D_rdcc_t *rdcc, - const H5O_layout_chunk_t *layout, const hsize_t offset[], void *parent); -H5_DLL herr_t H5D__chunk_update_flush_dep(const H5D_rdcc_t *rdcc, - const H5O_layout_chunk_t *layout, const hsize_t offset[], void *old_parent, - void *new_parent); H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsize_t *offset, uint32_t data_size, const void *buf); #ifdef H5D_CHUNK_DEBUG diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 5cba610..5a59863 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -931,12 +931,6 @@ H5_DLL herr_t H5O_loc_hold_file(H5O_loc_t *loc); H5_DLL herr_t H5O_loc_free(H5O_loc_t *loc); H5_DLL H5O_loc_t *H5O_get_loc(hid_t id); -/* Storage operators */ -H5_DLL void *H5O_storage_copy(const void *mesg, void *dest); -H5_DLL herr_t H5O_storage_reset(void *mesg); -H5_DLL size_t H5O_storage_meta_size(const H5F_t *f, const H5O_storage_t *storage, - hbool_t include_compact_data); - /* EFL operators */ H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl); -- cgit v0.12 From da815873ef8150c8866d047d385ab1985197a026 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 23 Dec 2015 15:09:46 -0500 Subject: [svn-r28726] Description: Minor code cleanups Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (too minor for h5committest) --- src/H5B2.c | 2 +- src/H5Dchunk.c | 5 ++--- src/H5Olayout.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 5c1e107..f421bdb 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -1293,7 +1293,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, /* Unlock current node */ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - } + } /* end block */ done: if(parent) { diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4d02864..7b5df07 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -6168,12 +6168,11 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old /* Release previous chunk */ /* Only free the old location if not doing SWMR writes - otherwise * we must keep the old chunk around in case a reader has an - * outdated version of the b-tree node + * outdated version of the B-tree node */ - if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { + if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, old_chunk->offset, old_chunk->length) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") - } alloc_chunk = TRUE; *need_modify = TRUE; } /* end if */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index a73a4d9..ca56255 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -307,7 +307,7 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED if(mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { H5F_DECODE_LENGTH(f, p, mesg->storage.u.chunk.u.single.nbytes); UINT32DECODE(p, mesg->storage.u.chunk.u.single.filter_mask); - } + } /* end if */ /* Set the chunk operations */ mesg->storage.u.chunk.ops = H5D_COPS_SINGLE; -- cgit v0.12 From 805c29431c73880991e5823f2ba82bbeca02201e Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Sat, 26 Dec 2015 16:06:38 -0500 Subject: [svn-r28728] Fix for H5Drefresh() problem from DLS with multiple opens of a dataset. Fix for H5Ffstart_swmr_write() with multiple opens of files and datasets. Tested on jam, osx1010test, moohan, ostrich, emu, platypus, kite, quail. --- src/H5Dint.c | 135 +++++ src/H5Dprivate.h | 2 + src/H5F.c | 29 +- src/H5Gpublic.h | 4 +- src/H5Oflush.c | 32 +- src/H5Oprivate.h | 2 +- test/swmr.c | 1664 ++++++++++++++++++++++++++++++++++++++++++++++++------ 7 files changed, 1668 insertions(+), 200 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index 8073d9d..ed0e63e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1940,6 +1940,141 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_mult_refresh_close + * + * Purpose: Closing down the needed information when the dataset has + * multiple opens. (From H5O_refresh_metadata_close()) + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; 12/24/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D_mult_refresh_close(hid_t dset_id, hid_t dxpl_id) +{ + H5D_t *dataset; /* Dataset to refresh */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + /* check args */ + HDassert(dataset && dataset->oloc.file && dataset->shared); + HDassert(dataset->shared->fo_count > 0); + + if(dataset->shared->fo_count > 1) { + /* Free cached information for each kind of dataset */ + switch(dataset->shared->layout.type) { + case H5D_CONTIGUOUS: + /* Free the data sieve buffer, if it's been allocated */ + if(dataset->shared->cache.contig.sieve_buf) + dataset->shared->cache.contig.sieve_buf = (unsigned char *)H5FL_BLK_FREE(sieve_buf,dataset->shared->cache.contig.sieve_buf); + break; + + case H5D_CHUNKED: + /* Check for skip list for iterating over chunks during I/O to close */ + if(dataset->shared->cache.chunk.sel_chunks) { + HDassert(H5SL_count(dataset->shared->cache.chunk.sel_chunks) == 0); + H5SL_close(dataset->shared->cache.chunk.sel_chunks); + dataset->shared->cache.chunk.sel_chunks = NULL; + } /* end if */ + + /* Check for cached single chunk dataspace */ + if(dataset->shared->cache.chunk.single_space) { + (void)H5S_close(dataset->shared->cache.chunk.single_space); + dataset->shared->cache.chunk.single_space = NULL; + } /* end if */ + + /* Check for cached single element chunk info */ + if(dataset->shared->cache.chunk.single_chunk_info) { + dataset->shared->cache.chunk.single_chunk_info = H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info); + dataset->shared->cache.chunk.single_chunk_info = NULL; + } /* end if */ + break; + + case H5D_COMPACT: + /* Nothing special to do (info freed in the layout destroy) */ + break; + + case H5D_VIRTUAL: + break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + default: + HDassert("not implemented yet" && 0); +#ifdef NDEBUG + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") +#endif /* NDEBUG */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ + + /* Destroy any cached layout information for the dataset */ + if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_mult_refresh_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5D_mult_refresh_reopen + * + * Purpose: Re-initialize the needed info when the dataset has multiple + * opens. (From H5O_refresh_metadata_reopen()) + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; 12/24/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D_mult_refresh_reopen(H5D_t *dataset, hid_t dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check args */ + HDassert(dataset && dataset->oloc.file && dataset->shared); + HDassert(dataset->shared->fo_count > 0); + + if(dataset->shared->fo_count > 1) { + + /* Release dataspace info */ + if(H5S_close(dataset->shared->space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + + /* Re-load dataspace info */ + if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + + /* Cache the dataset's dataspace info */ + if(H5D__cache_dataspace_info(dataset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + + if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset layout info") + + /* Re-load layout message info */ + if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5D_mult_refresh_reopen() */ + + +/*------------------------------------------------------------------------- * Function: H5D_oloc * * Purpose: Returns a pointer to the object location for a dataset. diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index cb04f2e..4c5f914 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -173,6 +173,8 @@ typedef struct H5D_append_flush_t { H5_DLL herr_t H5D_init(void); H5_DLL H5D_t *H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id); H5_DLL herr_t H5D_close(H5D_t *dataset); +H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id, hid_t dxpl_id); +H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset, hid_t dxpl_id); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); diff --git a/src/H5F.c b/src/H5F.c index 09765cb..948eb7a 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -760,13 +760,6 @@ H5Fclose(hid_t file_id) if((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") if(nref == 1) { - if(f->shared->sblock) { /* Clear status_flags */ - f->shared->sblock->status_flags &= ~H5F_SUPER_WRITE_ACCESS; - f->shared->sblock->status_flags &= ~H5F_SUPER_SWMR_WRITE_ACCESS; - /* Mark superblock dirty in cache, so change will get encoded */ - if(H5F_super_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") - } if(H5F_flush(f, H5AC_dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } @@ -1640,13 +1633,13 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Get the # of opened named datatypes and attributes */ - if(H5F_get_obj_count(file, H5F_OBJ_LOCAL|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) + if(H5F_get_obj_count(file, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") if(nt_attr_count) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file") /* Get the # of opened datasets and groups */ - if(H5F_get_obj_count(file, H5F_OBJ_LOCAL|H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) + if(H5F_get_obj_count(file, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") if(grp_dset_count) { @@ -1661,13 +1654,13 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_name_t") /* Get the list of opened object ids (groups & datasets) */ - if(H5F_get_obj_ids(file, H5F_OBJ_LOCAL|H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) + if(H5F_get_obj_ids(file, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") /* Refresh opened objects (groups, datasets) in the file */ for(u = 0; u < grp_dset_count; u++) { H5O_loc_t *oloc; /* object location */ - + H5G_loc_t tmp_loc; /* Set up the id's group location */ obj_glocs[u].oloc = &obj_olocs[u]; obj_glocs[u].path = &obj_paths[u]; @@ -1677,9 +1670,13 @@ H5Fstart_swmr_write(hid_t file_id) if((oloc = H5O_get_loc(obj_ids[u])) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") - /* Refresh (part 1) */ - if(H5O_refresh_metadata_close(obj_ids[u], *oloc, &obj_glocs[u], H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") + /* Make deep local copy of object's location information */ + H5G_loc(obj_ids[u], &tmp_loc); + H5G_loc_copy(&obj_glocs[u], &tmp_loc, H5_COPY_DEEP); + + /* Close the object */ + if(H5I_dec_ref(obj_ids[u]) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "decrementing object ID failed") } /* end for */ } /* end if */ @@ -1724,9 +1721,9 @@ H5Fstart_swmr_write(hid_t file_id) if(H5F_evict_cache_entries(file, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information") - /* Refresh (part 2: reopen) the objects (groups & datasets) in the file */ + /* Refresh (reopen) the objects (groups & datasets) in the file */ for(u = 0; u < grp_dset_count; u++) { - if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], H5AC_dxpl_id) < 0) + if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], H5AC_dxpl_id, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") } diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 10b07c0..9d8ade5 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -84,6 +84,8 @@ H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo, hid_t lapl_id); H5_DLL herr_t H5Gclose(hid_t group_id); +H5_DLL herr_t H5Gflush(hid_t group_id); +H5_DLL herr_t H5Grefresh(hid_t group_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -167,8 +169,6 @@ H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, size_t size); -H5_DLL herr_t H5Gflush(hid_t group_id); -H5_DLL herr_t H5Grefresh(hid_t group_id); H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 68f47fd..00fa937 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -218,10 +218,11 @@ done: * * Note: This is based on the original H5O_refresh_metadata() but * is split into 2 routines. - * (This is done so that H5Fstart_swmr_write() can use these + * This is done so that H5Fstart_swmr_write() can use these * 2 routines to refresh opened objects. This may be * restored back to the original code when H5Fstart_swmr_write() * uses a different approach to handle issues with opened objects. + * H5Fstart_swmr_write() no longer calls the 1st routine. (12/24/15) * * Return: Non-negative on success, negative on failure * @@ -241,6 +242,8 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc, hid_t dxpl_id) FUNC_ENTER_NOAPI(FAIL) + /* If the file is opened with write access, + no need to perform refresh actions. */ if(H5F_INTENT(oloc.file) & H5F_ACC_RDWR) HGOTO_DONE(SUCCEED) @@ -260,7 +263,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, dxpl_id)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, dxpl_id, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: @@ -276,10 +279,11 @@ done: * * Purpose: This is the first part of the original routine H5O_refresh_metadata(). * (1) Save object location information. - * (2) Get object cork status - * (3) Close the object - * (4) Flush and evict object metadata - * (5) Re-cork the object if needed + * (2) Handle multiple dataset opens + * (3) Get object cork status + * (4) Close the object + * (5) Flush and evict object metadata + * (6) Re-cork the object if needed * * Return: Success: Non-negative * Failure: Negative @@ -306,6 +310,12 @@ H5O_refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc, hid_t H5G_loc_copy(obj_loc, &tmp_loc, H5_COPY_DEEP); } /* end if */ + /* Get object's type */ + if(H5I_get_type(oid) == H5I_DATASET) { + if(H5D_mult_refresh_close(oid, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + } + /* Retrieve tag for object */ if(H5O_oh_tag(&oloc, dxpl_id, &tag) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to get object header address") @@ -340,8 +350,8 @@ done: * Function: H5O_refresh_metadata_reopen * * Purpose: This is the second part of the original routine H5O_refresh_metadata(). - * (1) Re-open object with the saved object location information. - * (2) Re-register object ID with the re-opened object. + * (1) Re-open object with the saved object location information. + * (2) Re-register object ID with the re-opened object. * * Return: SUCCEED/FAIL * @@ -351,7 +361,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id) +H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id, hbool_t start_swmr) { void *object = NULL; /* Dataset for this operation */ H5I_type_t type; @@ -382,6 +392,10 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id) /* Re-open the dataset */ if(NULL == (object = H5D_open(obj_loc, H5P_DATASET_ACCESS_DEFAULT, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + if(!start_swmr) { /* No need to handle multiple opens when H5Fstart_swmr_write() */ + if(H5D_mult_refresh_reopen(object, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset") + } break; case(H5I_UNINIT): diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 5a59863..3c7b78a 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -909,7 +909,7 @@ H5_DLL herr_t H5O_msg_unlock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_ H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id, hid_t dxpl_id); H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc, hid_t dxpl_id); H5_DLL herr_t H5O_refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc, hid_t dxpl_id); -H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id); +H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id, hbool_t start_swmr); /* Object copying routines */ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, diff --git a/test/swmr.c b/test/swmr.c index cb7aa81..1599acd 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -38,15 +38,15 @@ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ +#define H5D_FRIEND /*suppress error about including H5FDpkg */ +#define H5D_TESTING +#include "H5Dpkg.h" + /* This file needs to access the file driver testing code */ #define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING #include "H5FDpkg.h" /* File drivers */ -#define H5D_FRIEND /*suppress error about including H5Dpkg */ -#define H5D_TESTING -#include "H5Dpkg.h" - const char *FILENAME[] = { "swmr0", /* 0 */ @@ -57,9 +57,6 @@ const char *FILENAME[] = { #define NAME_BUF_SIZE 1024 /* Length of file name */ -/* Name of message file that is used by test_start_swmr_write_concur() */ -#define DONE_MESSAGE "DONE_MESSAGE" /* The message file to create */ - /* Tests for H5Pget/set_metadata_read_attempts(), H5Fget_metadata_read_retry_info */ static int test_metadata_read_attempts(hid_t in_fapl); static int test_metadata_read_retry_info(hid_t in_fapl); @@ -92,6 +89,12 @@ static int test_file_lock_swmr_concur(hid_t fapl); /* Tests for SWMR VFD flag */ static int test_swmr_vfd_flag(void); +/* Tests for H5Drefresh: concurrent access */ +static int test_refresh_concur(hid_t in_fapl, hbool_t new_format); + +/* Tests for multiple opens of files and datasets with H5Drefresh() & H5Fstart_swmr_write(): same process */ +static int test_multiple_same(hid_t in_fapl, hbool_t new_format); + /* * Tests for H5Pget/set_metadata_read_attemps(), H5Fget_metadata_read_retry_info() */ @@ -1508,28 +1511,30 @@ error: /* * test_start_swmr_write(): * - * Verify SWMR writing is enabled via H5Fstart_swmr_write(): + * Verify SWMR writing is enabled via H5Fstart_swmr_write(): * Mainly test for file created with SWMR_WRITE + with/without latest format: * --file will have v3 superblock and all latest version support enabled * - * (a) Creating a file + * (A) Creating a file * Create a file with SWMR_WRITE + non-latest-format * Create a chunked dataset "dataset1" in the file -- should be using latest chunk indexing * Should fail to enable SWMR as the file is already in SWMR writing mode * Close the file * - * (a) Opening a file + * (B) Opening a file * Open the file with write + non-latest-format * --file has v3 superblock and all latest version support enabled - * Open dataset "dataset1"--keep it open - * Create a chunked dataset "dataset2" in the file -- should be using latest chunk indexing -- keep it open + * Open dataset "dataset1" 3 times--keep it open + * Write to "dataset1" + * Create a group in the file + * Create a chunked dataset "dataset2" in the group--should be using latest chunk indexing--keep it open * Should succeed in enabling SWMR - * Should succeed in writing/reading from "dataset1" - * Close "dataset1" and "dataset2" - * Create "dataset3" -- should be using latest chunk indexing + * Should succeed in reading from multiple opens of "dataset1" + * Close multiple opens of "dataset1" + * Close "dataset2" + * Create "dataset3"--should be using latest chunk indexing * Close "dataset3" - * Close the file - * + * Close the group and file */ static int test_start_swmr_write(hid_t in_fapl, hbool_t new_format) @@ -1540,6 +1545,7 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format) hid_t dcpl = -1; /* Dataset creation property */ hid_t file_fapl = -1; /* File access property for the file */ hid_t did1 = -1, did2 = -1, did3 = -1; /* Dataset IDs */ + hid_t did1_a = -1, did1_b = -1; hid_t sid1 = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */ hsize_t dim[1] = {1}; /* Dimension sizes */ hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */ @@ -1690,6 +1696,14 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format) if((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; + /* open "dataset1" second time */ + if((did1_a = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* open "dataset1" third time */ + if((did1_b = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + /* Write to "dataset1" */ wdata = 88; if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) @@ -1735,16 +1749,33 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format) if(H5Pclose(file_fapl) < 0) FAIL_STACK_ERROR; + rdata = 0; + /* Read from "dataset1" via did1_b (multiple opens) */ + if(H5Dread(did1_b, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) + FAIL_STACK_ERROR; + if(wdata != rdata) + FAIL_STACK_ERROR; + if(H5Dclose(did1_b) < 0) + FAIL_STACK_ERROR; + /* Read from "dataset1" */ + rdata = 0; if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) FAIL_STACK_ERROR; if(wdata != rdata) FAIL_STACK_ERROR; - - /* Close "dataset1" */ if(H5Dclose(did1) < 0) FAIL_STACK_ERROR; + rdata = 0; + /* Read from "dataset1" via did1_a (multiple opens) */ + if(H5Dread(did1_a, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) + FAIL_STACK_ERROR; + if(wdata != rdata) + FAIL_STACK_ERROR; + if(H5Dclose(did1_a) < 0) + FAIL_STACK_ERROR; + /* Close "dataset2", dataspace, dataset creation property list */ if(H5Dclose(did2) < 0) FAIL_STACK_ERROR; @@ -1801,6 +1832,8 @@ error: H5Gclose(gid); H5Pclose(dcpl); H5Dclose(did1); + H5Dclose(did1_a); + H5Dclose(did1_b); H5Dclose(did2); H5Dclose(did3); H5Sclose(sid1); @@ -1843,17 +1876,17 @@ error: * --First time succeed, second time fail * --Close the file (2) --Open the file with write + with/without latest format - * --succeed to enable SWMR writing mode - * --reopen the same file + * --Succeed to enable SWMR writing mode + * --Reopen the same file * --fail to enable SWMR writing mode for the reopened file * --Close the file (3) --Open the file with write + with/without latest format - * --open the same file again + * --Open the same file again * --succeed to enable SWMR for the first opened file * --fail to enable SWMR for the second opened file * --Close the file * - * (E) (!new_format): When opening a file which is created with write + non-latest-format: + * (D) (!new_format): When opening a file which is created with write + non-latest-format: * (1) Open the file with SWMR write+latest format * --fail to open due to superblock version not 3 * (2) Open the file with SWMR write+non-latest-format @@ -2277,12 +2310,15 @@ error: * --result in v3 superblock with latest chunk indexing types * (b) Create the file with SWMR write + non-latest-format: * --result in v3 superblock with latest chunk indexing types + * Create a chunked dataset with 1 extendible dimension in the file * * Verify concurrent access for H5Fstart_swmr_write()-- * (1) Parent: open a file with write access * Child: concurrent open of the file with read & SWMR read (fail) * (2) Parent: open a file with write access; enable SWMR writing mode - * Child: concurrent open of the file with read & SWMR read (succeed) + * Child: open the file 2 times with read & SWMR read (succeed) + * open the dataset 2 times with the 2 file opens + * verify data read from multiple opens of the dataset is correct * (3) Parent: open a file with write access; enable SWMR writing mode * Child: Concurrent open of the file with read only (fail) * (4) Parent: open a file with write access; enable SWMR writing mode @@ -2305,7 +2341,7 @@ test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSE static int test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) { - hid_t fid; /* File ID */ + hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */ hid_t fapl; /* File access property list */ pid_t childpid=0; /* Child process ID */ pid_t tmppid; /* Child process ID returned by waitpid */ @@ -2314,15 +2350,25 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) int child_exit_val; /* Exit status of the child */ char filename[NAME_BUF_SIZE]; /* File name */ + hid_t did = -1, did1 = -1, did2 = -1, did3 = -1; + hid_t sid = -1; + hid_t dcpl = -1; + hsize_t chunk_dims[1] = {1}; + hsize_t maxdims[1] = {H5S_UNLIMITED}; + hsize_t dims[1] = {1}; + int wdata = 0; + + int out_pdf[2]; + int in_pdf[2]; + int notify = 0; + /* Output message about test being performed */ if(new_format) { - TESTING("Testing H5Fstart_swmr_write()--concurrent access for latest format"); + TESTING("H5Fstart_swmr_write()--concurrent access for latest format"); } else { - TESTING("Testing H5Fstart_swmr_write()--concurrent access for non-latest-format"); + TESTING("H5Fstart_swmr_write()--concurrent access for non-latest-format"); } /* end if */ - - if((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR @@ -2343,12 +2389,29 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR } /* end if */ + /* Create a chunked dataset with 1 extendible dimension */ + if((sid = H5Screate_simple(1, dims, maxdims)) < 0) + FAIL_STACK_ERROR; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) + FAIL_STACK_ERROR; + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* Close the dataset */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + /* Close the file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* * Case (1): @@ -2361,11 +2424,18 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Should fail */ H5E_BEGIN_TRY { /* Open the test file */ @@ -2374,15 +2444,29 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) if(fid >= 0) HDexit(EXIT_FAILURE); + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_SUCCESS); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) @@ -2405,38 +2489,176 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) * will succeed with H5Fstart_swmr_write() */ - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 2 pipes */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR + if(HDpipe(in_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ - hid_t child_fid; /* File ID */ + hid_t child_fid1 = -1, child_fid2; /* File IDs */ + hid_t child_did1 = -1, child_did2 = -1; /* Dataset IDs */ + int child_notify = 0; + int rdata = 0; + + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) + HDexit(EXIT_FAILURE); + /* close unused read end for in_pdf */ + if(HDclose(in_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + + /* Should succeed in opening the test file 2 times */ + if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); + if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); + + /* open "dataset" 2 times */ + if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + + /* Read from "dataset" via child_did1 */ + rdata = 0; + if(H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) + HDexit(EXIT_FAILURE); + if(rdata != 88) + HDexit(EXIT_FAILURE); + + /* Notify parent process */ + child_notify = 2; + if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + + /* Wait for notification from parent process */ + while(child_notify != 3) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + + /* Refresh "dataset" via child_did2 */ + if(H5Drefresh(child_did2) < 0) + HDexit(EXIT_FAILURE); + + /* Read from "dataset" child_did2 */ + rdata = 0; + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) + HDexit(EXIT_FAILURE); + if(rdata != 99) + HDexit(EXIT_FAILURE); + + /* Read from "dataset" child_did1 */ + rdata = 0; + if(H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) + HDexit(EXIT_FAILURE); + if(rdata != 99) + HDexit(EXIT_FAILURE); - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close the dataset */ + if(H5Dclose(child_did1)) + HDexit(EXIT_FAILURE); + if(H5Dclose(child_did2)) HDexit(EXIT_FAILURE); - /* Should succeed in opening the test file */ - if((child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + /* Close the file */ + if(H5Fclose(child_fid1) < 0) HDexit(EXIT_FAILURE); - if(H5Fclose(child_fid) < 0) + if(H5Fclose(child_fid2) < 0) HDexit(EXIT_FAILURE); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + if(HDclose(in_pdf[1]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_SUCCESS); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Close unused write end for in_pdf */ + if(HDclose(in_pdf[1]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* open "dataset", keep it open */ + if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + if((did3 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* Write to "dataset" */ + wdata = 88; + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) + FAIL_STACK_ERROR; + + /* Flush to disk */ + if(H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0) + FAIL_STACK_ERROR; /* Enable SWMR writing mode */ - if(H5Fstart_swmr_write(fid) < 0) + if(H5Fstart_swmr_write(fid1) < 0) TEST_ERROR - /* Send the message that H5Fstart_swmr_write() completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Wait for notification from child process */ + while(notify != 2) { + if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + } + + /* Write to "dataset" */ + wdata = 99; + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) + FAIL_STACK_ERROR; + + /* Flush to disk */ + if(H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0) + FAIL_STACK_ERROR; + + /* Notify child process */ + notify = 3; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the dataset */ + if(H5Dclose(did1) < 0) + FAIL_STACK_ERROR + if(H5Dclose(did2) < 0) + FAIL_STACK_ERROR + if(H5Dclose(did3) < 0) + FAIL_STACK_ERROR + + /* Close the pipes */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; + if(HDclose(in_pdf[0]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) @@ -2450,28 +2672,38 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) TEST_ERROR /* Close the file */ - if(H5Fclose(fid) < 0) + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR + /* * Case (3): * Verify concurrent file open with H5F_ACC_RDONLY * will fail with H5Fstart_swmr_write() */ - - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Should fail in opening the test file */ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); @@ -2482,6 +2714,10 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) HDexit(EXIT_SUCCESS); } /* end if */ + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -2490,8 +2726,14 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) if(H5Fstart_swmr_write(fid) < 0) TEST_ERROR - /* Send the message that H5Fstart_swmr_write() completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) @@ -2514,19 +2756,27 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) * will fail with H5Fstart_swmr_write() */ - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Should fail in opening the test file */ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); @@ -2534,9 +2784,17 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) if(fid >= 0) HDexit(EXIT_FAILURE); + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_SUCCESS); } /* end if */ + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -2545,8 +2803,14 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) if(H5Fstart_swmr_write(fid) < 0) TEST_ERROR - /* Send the message that H5Fstart_swmr_write() completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR /* Wait for child process to complete */ if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) @@ -2569,19 +2833,27 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) * will fail with H5Fstart_swmr_write() */ - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Should fail in opening the test file */ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl); @@ -2589,9 +2861,17 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) if(fid >= 0) HDexit(EXIT_FAILURE); + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_SUCCESS); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -2600,8 +2880,14 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) if(H5Fstart_swmr_write(fid) < 0) TEST_ERROR - /* Send the message that H5Fstart_swmr_write() completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) @@ -2627,6 +2913,8 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) error: H5E_BEGIN_TRY { + H5Sclose(sid); + H5Pclose(dcpl); H5Pclose(fapl); H5Fclose(fid); } H5E_END_TRY; @@ -4243,6 +4531,8 @@ test_file_lock_concur(hid_t in_fapl) pid_t childpid=0; /* Child process ID */ int child_status; /* Status passed to waitpid */ int child_wait_option=0; /* Options passed to waitpid */ + int out_pdf[2]; + int notify = 0; /* Output message about test being performed */ TESTING("File open with different combinations of flags--concurrent access"); @@ -4265,8 +4555,9 @@ test_file_lock_concur(hid_t in_fapl) * Case 1: 1) RDWR 2) RDWR : should fail */ - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4274,11 +4565,18 @@ test_file_lock_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); @@ -4287,15 +4585,30 @@ test_file_lock_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4303,9 +4616,9 @@ test_file_lock_concur(hid_t in_fapl) /* Check if child terminated normally */ if(WIFEXITED(child_status)) { - /* Check exit status of the child */ - if(WEXITSTATUS(child_status) != 0) - TEST_ERROR + /* Check exit status of the child */ + if(WEXITSTATUS(child_status) != 0) + TEST_ERROR } else FAIL_STACK_ERROR @@ -4316,8 +4629,9 @@ test_file_lock_concur(hid_t in_fapl) /* * Case 2: 1) RDWR 2) RDONLY : should fail */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4325,11 +4639,18 @@ test_file_lock_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Opens the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); @@ -4338,15 +4659,30 @@ test_file_lock_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Opens the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4368,8 +4704,9 @@ test_file_lock_concur(hid_t in_fapl) * Case 3: 1) RDONLY 2) RDWR : should fail */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4377,11 +4714,18 @@ test_file_lock_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Opens the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); @@ -4390,15 +4734,30 @@ test_file_lock_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* end if */ + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Opens the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4420,7 +4779,9 @@ test_file_lock_concur(hid_t in_fapl) * Case 4: 1) RDONLY 2) RDONLY : should succeed */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4428,11 +4789,18 @@ test_file_lock_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Opens the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); @@ -4442,19 +4810,34 @@ test_file_lock_concur(hid_t in_fapl) if(child_fid >= 0) { /* Close the file */ if(H5Fclose(child_fid) < 0) - FAIL_STACK_ERROR + HDexit(EXIT_FAILURE); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_SUCCESS); } /* end if */ HDexit(EXIT_FAILURE); } /* end if */ + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Create file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4524,6 +4907,8 @@ test_file_lock_swmr_concur(hid_t in_fapl) pid_t childpid=0; /* Child process ID */ int child_status; /* Status passed to waitpid */ int child_wait_option=0; /* Options passed to waitpid */ + int out_pdf[2]; + int notify = 0; /* Output message about test being performed */ TESTING("File open with different combintations of flags + SWMR flags--concurrent access"); @@ -4550,8 +4935,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 1: 1) RDWR 2) RDWR|SWMR_WRITE : should fail */ - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4559,11 +4945,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl); @@ -4572,15 +4965,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4602,20 +5010,28 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 2: 1) RDWR 2) RDONLY|SWMR_READ: should fail */ - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); @@ -4624,19 +5040,34 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Check if child terminated normally */ if(WIFEXITED(child_status)) { @@ -4654,8 +5085,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 3: 1) RDWR|SWMR_WRITE 2) RDWR : should fail */ - /* Remove the message file to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4663,11 +5095,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); @@ -4676,15 +5115,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4706,8 +5160,8 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 4: 1) RDWR|SWMR_WRITE 2) RDWR|SWMR_WRITE : should fail */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4715,11 +5169,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl); @@ -4728,15 +5189,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4758,20 +5234,27 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 5: 1) RDWR|SWMR_WRITE 2) RDONLY|SWMR_READ : should succeed */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); @@ -4783,15 +5266,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR HDexit(EXIT_SUCCESS); } + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR + + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4813,8 +5311,8 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 6: 1) RDWR|SWMR_WRITE 2) RDONLY : should fail */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4822,11 +5320,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -4835,15 +5340,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4865,8 +5385,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 7: 1) RDONLY|SWMR_READ 2) RDWR : should fail */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4874,11 +5395,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); @@ -4887,15 +5415,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4917,8 +5460,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 8: 1) RDONLY|SWMR_READ 2) RDWR|SWMR_WRITE : should fail */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4926,11 +5470,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl); @@ -4939,15 +5490,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -4969,8 +5535,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 9: 1) RDONLY|SWMR_READ 2) RDONLY|SWMR_READ : should succeed */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -4978,11 +5545,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); @@ -4994,15 +5568,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR HDexit(EXIT_SUCCESS); } + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -5024,8 +5613,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 10: 1) RDONLY|SWMR_READ 2) RDONLY : should succeed */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -5033,11 +5623,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ if((child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -5048,15 +5645,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR HDexit(EXIT_SUCCESS); } + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -5078,8 +5690,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 11: 1) RDONLY 2) RDWR|SWMR_WRITE : should fail */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -5087,11 +5700,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl); @@ -5100,15 +5720,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* Close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -5130,8 +5765,9 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 12: 1) RDONLY 2) RDONLY|SWMR_READ : should succeed */ - /* Remove the message file just to be sure */ - HDremove(DONE_MESSAGE); + /* Create 1 pipe */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR /* Fork child process */ if((childpid = HDfork()) < 0) @@ -5139,11 +5775,18 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ + int child_notify = 0; - /* Wait till parent process completes the open */ - if(h5_wait_message(DONE_MESSAGE) < 0) + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + /* Open the test file */ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); @@ -5155,15 +5798,30 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR HDexit(EXIT_SUCCESS); } + + /* Close the pipe */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } + /* close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Send the message that the open completes */ - h5_send_message(DONE_MESSAGE); + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipe */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) @@ -5364,6 +6022,664 @@ error: } /* test_bug_refresh() */ #endif /* OUT */ +/* + * test_refresh_concur(): + * + * The "new_format" parameter indicates whether to create the file with latest format or not. + * To have SWMR support, can use either one of the following in creating a file: + * (a) Create the file with write + latest format: + * --result in v3 superblock with latest chunk indexing types + * (b) Create the file with SWMR write + non-latest-format: + * --result in v3 superblock with latest chunk indexing types + * + * Verify H5Drefresh() works correctly with concurrent access: + * Parent process: + * (1) Open the test file, write to the dataset + * (2) Notify child process #A + * (3) Wait for notification from child process #B + * (4) Extend the dataset, write to the dataset, flush the file + * (5) Notify child process #C + * Child process: + * (1) Wait for notification from parent process #A + * (2) Open the file 2 times + * (3) Open the dataset 2 times with the 2 files + * (4) Verify the dataset's dimension and data read are correct + * (5) Notify parent process #B + * (6) Wait for notification from parent process #C + * (7) Refresh the dataset + * (8) Verify the dataset's dimension and data are correct + */ +#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) + +static int +test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSED new_format) +{ + SKIPPED(); + HDputs(" Test skipped due to fork or waitpid not defined."); + return 0; +} /* test_refresh_concur() */ + +#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */ + +static int +test_refresh_concur(hid_t in_fapl, hbool_t new_format) +{ + hid_t fid; /* File ID */ + hid_t fapl; /* File access property list */ + pid_t childpid=0; /* Child process ID */ + pid_t tmppid; /* Child process ID returned by waitpid */ + int child_status; /* Status passed to waitpid */ + int child_wait_option=0; /* Options passed to waitpid */ + int child_exit_val; /* Exit status of the child */ + char filename[NAME_BUF_SIZE]; /* File name */ + + hid_t did = -1; + hid_t sid = -1; + hid_t dcpl = -1; + hsize_t chunk_dims[1] = {1}; + hsize_t maxdims[1] = {H5S_UNLIMITED}; + hsize_t dims[1] = { 1 }; + hsize_t new_dims[1] = {2}; + + int out_pdf[2]; + int in_pdf[2]; + int notify = 0; + int wbuf[2]; + + /* Output message about test being performed */ + if(new_format) { + TESTING("H5Drefresh()--concurrent access for latest format"); + } else { + TESTING("H5Drefresh()--concurrent access for non-latest-format"); + } /* end if */ + + + if((fapl = H5Pcopy(in_fapl)) < 0) + FAIL_STACK_ERROR + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + if(new_format) { + /* Set to use the latest library format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR + + /* Create the test file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + } else { + /* Create the test file without latest format but with SWMR write */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + } /* end if */ + + /* Create a chunked dataset with 1 extendible dimension */ + if((sid = H5Screate_simple(1, dims, maxdims)) < 0) + FAIL_STACK_ERROR; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) + FAIL_STACK_ERROR; + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* Closing */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + FAIL_STACK_ERROR + + /* Create 2 pipes */ + if(HDpipe(out_pdf) < 0) + FAIL_STACK_ERROR + if(HDpipe(in_pdf) < 0) + FAIL_STACK_ERROR + + /* Fork child process */ + if((childpid = HDfork()) < 0) + FAIL_STACK_ERROR + + if(childpid == 0) { /* Child process */ + hid_t child_fid1 = -1; /* File ID */ + hid_t child_fid2 = -1; /* File ID */ + hid_t child_did1 = -1, child_did2 = -1; + hid_t child_sid = -1; + hsize_t tdims[1]; + int rbuf[2] = {0, 0}; + int child_notify = 0; + + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) + HDexit(EXIT_FAILURE); + + /* close unused read end for in_pdf */ + if(HDclose(in_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + + /* Open the file 2 times */ + if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); + + if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); + + /* Open the dataset 2 times */ + if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + + /* Get the dataset's dataspace via did1 */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); + if(tdims[0] != 1) + HDexit(EXIT_FAILURE); + + /* Read from the dataset via did2 */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); + + /* Verify the data is correct */ + if(rbuf[0] != 99) + HDexit(EXIT_FAILURE); + + /* Notify parent process */ + child_notify = 2; + if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + + /* Wait for notification from parent process */ + while(child_notify != 3) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } + + /* Refresh dataset via did1 */ + if(H5Drefresh(child_did1) < 0) + HDexit(EXIT_FAILURE); + + /* Get the dataset's dataspace and verify */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); + + if(tdims[0] != 2) + HDexit(EXIT_FAILURE); + + /* Read from the dataset */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); + + /* Verify the data is correct */ + if(rbuf[0] != 100 || rbuf[1] != 100) + HDexit(EXIT_FAILURE); + + /* Close the 2 datasets */ + if(H5Dclose(child_did1) < 0) + HDexit(EXIT_FAILURE); + if(H5Dclose(child_did2) < 0) + HDexit(EXIT_FAILURE); + + /* Close the 2 files */ + if(H5Fclose(child_fid1) < 0) + HDexit(EXIT_FAILURE); + if(H5Fclose(child_fid2) < 0) + HDexit(EXIT_FAILURE); + + /* Close the pipes */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + if(HDclose(in_pdf[1]) < 0) + HDexit(EXIT_FAILURE); + + HDexit(EXIT_SUCCESS); + } + + /* Close unused read end for out_pdf */ + if(HDclose(out_pdf[0]) < 0) + FAIL_STACK_ERROR + /* Close unused write end for in_pdf */ + if(HDclose(in_pdf[1]) < 0) + FAIL_STACK_ERROR + + /* Open the test file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) + FAIL_STACK_ERROR + + /* Open the dataset */ + if((did = H5Dopen2(fid, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* Write to the dataset */ + wbuf[0] = wbuf[1] = 99; + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) + FAIL_STACK_ERROR; + + /* Flush to disk */ + if(H5Fflush(fid, H5F_SCOPE_LOCAL) < 0) + FAIL_STACK_ERROR; + + /* Notify child process */ + notify = 1; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + + /* Wait for notification from child process */ + while(notify != 2) { + if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + } + + /* Extend the dataset */ + if(H5Dset_extent(did, new_dims) < 0) + FAIL_STACK_ERROR; + + /* Write to the dataset */ + wbuf[0] = wbuf[1] = 100; + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) + FAIL_STACK_ERROR; + + /* Flush to disk */ + if(H5Fflush(fid, H5F_SCOPE_LOCAL) < 0) + FAIL_STACK_ERROR; + + /* Notify child process */ + notify = 3; + if(HDwrite(out_pdf[1], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; + + /* Close the pipes */ + if(HDclose(out_pdf[1]) < 0) + FAIL_STACK_ERROR; + if(HDclose(in_pdf[0]) < 0) + FAIL_STACK_ERROR; + + /* Wait for child process to complete */ + if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) + FAIL_STACK_ERROR + + /* Check exit status of child process */ + if(WIFEXITED(child_status)) { + if((child_exit_val = WEXITSTATUS(child_status)) != 0) + TEST_ERROR + } else /* Child process terminated abnormally */ + TEST_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + FAIL_STACK_ERROR + + /* Close the property list */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dcpl); + H5Pclose(fapl); + H5Fclose(fid); + } H5E_END_TRY; + + return -1; + +} /* test_refresh_concur() */ +#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */ + +/* + * test_multiple_same(): + * + * The "new_format" parameter indicates whether to create the file with latest format or not. + * To have SWMR support, can use either one of the following in creating a file: + * (a) Create the file with write + latest format: + * --result in v3 superblock with latest chunk indexing types + * (b) Create the file with SWMR write + non-latest-format: + * --result in v3 superblock with latest chunk indexing types + * + * Verify that H5Drefresh() and H5Fstart_swmr_write() work properly with multiple + * opens of files and datasets. + */ +static int +test_multiple_same(hid_t in_fapl, hbool_t new_format) +{ + hid_t fid = -1, fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */ + hid_t fapl; /* File access property list */ + char filename[NAME_BUF_SIZE]; /* File name */ + hid_t did = -1, did1 = -1, did2 = -1, did3 = -1; + hid_t sid = -1; + hid_t dcpl = -1; + hsize_t chunk_dims[2] = {1, 2}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t dims[2] = {1, 1}; + int rbuf = 0; + int wbuf = 0; + + /* Output message about test being performed */ + if(new_format) { + TESTING("multiple--single process access for latest format"); + } else { + TESTING("multiple--single process access for non-latest-format"); + } /* end if */ + + + if((fapl = H5Pcopy(in_fapl)) < 0) + FAIL_STACK_ERROR + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + if(new_format) { + /* Set to use the latest library format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR + + /* Create the test file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + } else { + /* Create the test file without latest format but with SWMR write */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + } /* end if */ + + /* Create a chunked dataset with 1 extendible dimension */ + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + FAIL_STACK_ERROR; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) + FAIL_STACK_ERROR; + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* Closing */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(fid) < 0) + FAIL_STACK_ERROR + + /* Case 1 */ + + /* Open the file 3 times: SWMR-write, read-write, read-only */ + if((fid1 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) + FAIL_STACK_ERROR + if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR + + /* Open the dataset 3 times with fid1, fid2, fid3 */ + if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + + /* Write to the dataset via did1 */ + wbuf = 88; + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0) + FAIL_STACK_ERROR; + + /* Refresh via did2 */ + if(H5Drefresh(did2) < 0) + FAIL_STACK_ERROR; + + /* Read from the dataset via did2 */ + rbuf = 0; + if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0) + FAIL_STACK_ERROR; + /* Verify the data is correct */ + if(rbuf != 88) + FAIL_STACK_ERROR; + + /* Write to the dataset via did3 */ + wbuf = 99; + if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0) + FAIL_STACK_ERROR; + + /* Refresh via did1 */ + if(H5Drefresh(did1) < 0) + FAIL_STACK_ERROR; + + /* Read from the dataset via did1 */ + rbuf = 0; + if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0) + FAIL_STACK_ERROR; + /* Verify the data is correct */ + if(rbuf != 99) + FAIL_STACK_ERROR; + + /* Close datasets */ + if(H5Dclose(did1) < 0) + FAIL_STACK_ERROR; + if(H5Dclose(did2) < 0) + FAIL_STACK_ERROR; + if(H5Dclose(did3) < 0) + FAIL_STACK_ERROR; + + /* Close files */ + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) + FAIL_STACK_ERROR + if(H5Fclose(fid3) < 0) + FAIL_STACK_ERROR + + /* Case 2 */ + + /* Open the file 3 times: read-write, read-only, read-write */ + if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR + if((fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Open the dataset 3 times with fid1, fid2, fid3 */ + if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Write to the dataset via did1 */ + wbuf = 88; + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0) + FAIL_STACK_ERROR; + + /* Refresh via did2 */ + if(H5Drefresh(did2) < 0) + FAIL_STACK_ERROR; + + /* Read from dataset via did2 */ + rbuf = 0; + if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0) + FAIL_STACK_ERROR; + if(rbuf != wbuf) + FAIL_STACK_ERROR; + + /* Write to dataset via did3 */ + wbuf = 99; + if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0) + FAIL_STACK_ERROR; + + /* Enable SWMR write */ + if(H5Fstart_swmr_write(fid1) < 0) + FAIL_STACK_ERROR; + + /* Read from dataset via did1 and verify data is correct */ + rbuf = 0; + if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0) + FAIL_STACK_ERROR; + if(rbuf != wbuf) + FAIL_STACK_ERROR; + + /* Write to dataset via did2 */ + wbuf = 100; + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0) + FAIL_STACK_ERROR; + + /* Refresh dataset via did3 */ + if(H5Drefresh(did3) < 0) + FAIL_STACK_ERROR; + + /* Read from dataset via did3 and verify data is correct */ + rbuf = 0; + if(H5Dread(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0) + FAIL_STACK_ERROR; + if(rbuf != wbuf) + FAIL_STACK_ERROR; + + /* Close datasets */ + if(H5Dclose(did1) < 0) + FAIL_STACK_ERROR; + if(H5Dclose(did2) < 0) + FAIL_STACK_ERROR; + if(H5Dclose(did3) < 0) + FAIL_STACK_ERROR; + + /* Close files */ + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) + FAIL_STACK_ERROR; + if(H5Fclose(fid3) < 0) + FAIL_STACK_ERROR + + /* Case 3 */ + + /* Open the file 3 times: read-write, read-only, read-only */ + if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR + if((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR + + /* Open the dataset 3 times with fid1, fid2, fid3 */ + if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Write to the dataset via did1 */ + wbuf = 88; + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0) + FAIL_STACK_ERROR; + + /* Refresh dataset via did2 */ + if(H5Drefresh(did2) < 0) + FAIL_STACK_ERROR; + + /* Read from dataset via did2 and verify data is correct */ + rbuf = 0; + if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0) + FAIL_STACK_ERROR; + if(rbuf != wbuf) + FAIL_STACK_ERROR; + + /* Close dataset via did2 */ + if(H5Dclose(did2) < 0) + FAIL_STACK_ERROR; + + /* Close file via fid2 */ + if(H5Fclose(fid2) < 0) + FAIL_STACK_ERROR + + /* Write to dataset via did3 */ + wbuf = 99; + if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0) + FAIL_STACK_ERROR; + + /* Close dataset via did3 */ + if(H5Dclose(did3) < 0) + FAIL_STACK_ERROR; + + /* Close file via fid3 */ + if(H5Fclose(fid3) < 0) + FAIL_STACK_ERROR + + /* Enable SWMR writing */ + if(H5Fstart_swmr_write(fid1) < 0) + FAIL_STACK_ERROR; + + /* Read from dataset via did1 and verify data is correct */ + rbuf = 0; + if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0) + FAIL_STACK_ERROR; + if(rbuf != wbuf) + FAIL_STACK_ERROR; + + /* Close dataset via did1 */ + if(H5Dclose(did1) < 0) + FAIL_STACK_ERROR; + + /* Close file via fid1 */ + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + + /* Close the property list */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(did); + H5Dclose(did1); + H5Dclose(did2); + H5Dclose(did3); + H5Sclose(sid); + H5Pclose(dcpl); + H5Pclose(fapl); + H5Fclose(fid); + H5Fclose(fid1); + H5Fclose(fid2); + H5Fclose(fid3); + } H5E_END_TRY; + + return -1; + +} /* test_multiple_same() */ + /**************************************************************** ** ** Tests for new public routines introduced from the SWMR project. @@ -5394,6 +6710,10 @@ main(void) #ifdef OUT nerrors += test_bug_refresh(fapl); #endif + nerrors += test_refresh_concur(fapl, TRUE); + nerrors += test_refresh_concur(fapl, FALSE); + nerrors += test_multiple_same(fapl, TRUE); + nerrors += test_multiple_same(fapl, FALSE); /* Tests on H5Pget/set_metadata_read_attempts() and H5Fget_metadata_read_retry_info() */ nerrors += test_metadata_read_attempts(fapl); @@ -5447,7 +6767,7 @@ main(void) nerrors += test_swmr_vfd_flag(); if(nerrors) - goto error; + goto error; printf("All tests passed.\n"); -- cgit v0.12 From 1639542351e530163d16064b186778a18d5262c2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 29 Dec 2015 13:42:50 -0500 Subject: [svn-r28744] Description: Bring r28742 from trunk, adjusting to shadow B-tree nodes for SWMR: Add 'update' operation to v2 B-trees, which will insert a new record, or modify an existing one, depending on if the record exists or not. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Abtree2.c | 8 +- src/H5B2.c | 72 +- src/H5B2dbg.c | 44 +- src/H5B2int.c | 445 +++++++- src/H5B2pkg.h | 29 +- src/H5B2private.h | 5 +- src/H5B2test.c | 168 ++- src/H5Gbtree2.c | 8 +- src/H5HFbtree2.c | 57 +- src/H5SMbtree2.c | 44 +- test/btree2.c | 2902 ++++++++++++++++++++++++++++++++++++++++++++------ tools/misc/h5debug.c | 4 + 12 files changed, 3259 insertions(+), 527 deletions(-) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 972fb0b..716ad4a 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -116,9 +116,7 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ H5A__dense_btree2_name_compare, /* Record comparison callback */ H5A__dense_btree2_name_encode, /* Record encoding callback */ H5A__dense_btree2_name_decode, /* Record decoding callback */ - H5A__dense_btree2_name_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5A__dense_btree2_name_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing 'creation order' field of attributes */ @@ -132,9 +130,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ H5A__dense_btree2_corder_compare, /* Record comparison callback */ H5A__dense_btree2_corder_encode, /* Record encoding callback */ H5A__dense_btree2_corder_decode, /* Record decoding callback */ - H5A__dense_btree2_corder_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5A__dense_btree2_corder_debug /* Record debugging callback */ }}; diff --git a/src/H5B2.c b/src/H5B2.c index f421bdb..a36e2f5 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -88,6 +88,7 @@ extern const H5B2_class_t H5A_BT2_NAME[1]; extern const H5B2_class_t H5A_BT2_CORDER[1]; extern const H5B2_class_t H5D_BT2[1]; extern const H5B2_class_t H5D_BT2_FILT[1]; +extern const H5B2_class_t H5B2_TEST2[1]; const H5B2_class_t *const H5B2_client_class_g[] = { H5B2_TEST, /* 0 - H5B2_TEST_ID */ @@ -102,6 +103,7 @@ const H5B2_class_t *const H5B2_client_class_g[] = { H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */ H5D_BT2, /* 10 - H5B2_CDSET_ID */ H5D_BT2_FILT, /* 11 - H5B2_CDSET_FILT_ID */ + H5B2_TEST2 /* 12 - H5B2_TEST_ID */ }; @@ -286,36 +288,78 @@ H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata) /* Get the v2 B-tree header */ hdr = bt2->hdr; + /* Insert the record */ + if(H5B2__insert_hdr(hdr, dxpl_id, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2_insert() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2_update + * + * Purpose: Insert or modify a record to the B-tree. + * If the record exists already, it is modified as if H5B2_modify + * was called). If it doesn't exist, it is inserted as if + * H5B2_insert was called. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 23 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2_update(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, void *op_data) +{ + H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ + H5B2_update_status_t status = H5B2_UPDATE_UNKNOWN; /* Whether the record was inserted/modified */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments. */ + HDassert(bt2); + HDassert(udata); + + /* Set the shared v2 B-tree header's file context for this operation */ + bt2->hdr->f = bt2->f; + + /* Get the v2 B-tree header */ + hdr = bt2->hdr; + /* Check if the root node is allocated yet */ if(!H5F_addr_defined(hdr->root.addr)) { /* Create root node as leaf node in B-tree */ if(H5B2__create_leaf(hdr, dxpl_id, hdr, &(hdr->root)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node") } /* end if */ - /* Check if we need to split the root node (equiv. to a 1->2 node split) */ - else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) { - /* Split root node */ - if(H5B2__split_root(hdr, dxpl_id) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node") - } /* end if */ /* Attempt to insert record into B-tree */ if(hdr->depth > 0) { - if(H5B2__insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") + if(H5B2__update_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree internal node") } /* end if */ else { - if(H5B2__insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") + if(H5B2__update_leaf(hdr, dxpl_id, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree leaf node") } /* end else */ - /* Mark B-tree header as dirty */ - if(H5B2__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + /* Sanity check */ + HDassert(H5B2_UPDATE_UNKNOWN != status); + + /* Use insert algorithm if nodes to leaf full */ + if(H5B2_UPDATE_INSERT_CHILD_FULL == status) + if(H5B2__insert_hdr(hdr, dxpl_id, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_insert() */ +} /* H5B2_update() */ /*------------------------------------------------------------------------- diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index b0e9ba2..bc1edd7 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -92,7 +92,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, const H5B2_class_t *type, haddr_t obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header info */ - void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ @@ -109,17 +108,9 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); - HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || - (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); - - /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) - /* Create debugging context */ - if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, f, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") /* Set file pointer for this B-tree operation */ @@ -171,8 +162,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end for */ done: - if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") @@ -199,7 +188,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_internal_t *internal = NULL; /* B-tree internal node */ - void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value=SUCCEED; /* Return value */ @@ -215,21 +203,12 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); - HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || - (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); - /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) { - /* Create debugging context */ - if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") - } /* end if */ - /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, f, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") /* Set file pointer for this B-tree operation */ @@ -279,7 +258,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_INT_NREC(internal, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), dbg_ctx); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), hdr->cb_ctx); } /* end for */ /* Print final node pointer */ @@ -291,8 +270,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, internal->node_ptrs[u].addr); done: - if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0) @@ -321,7 +298,6 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */ - void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ @@ -337,20 +313,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); - HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || - (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); - /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) - /* Create debugging context */ - if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") - /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, f, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set file pointer for this B-tree operation */ @@ -391,12 +359,10 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_LEAF_NREC(leaf, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), hdr->cb_ctx); } /* end for */ done: - if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5B2int.c b/src/H5B2int.c index a33b8c3..251080d 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2260,6 +2260,62 @@ done: /*------------------------------------------------------------------------- + * Function: H5B2__insert_hdr + * + * Purpose: Adds a new record to the B-tree. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 23 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2__insert_hdr(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments. */ + HDassert(hdr); + HDassert(udata); + + /* Check if the root node is allocated yet */ + if(!H5F_addr_defined(hdr->root.addr)) { + /* Create root node as leaf node in B-tree */ + if(H5B2__create_leaf(hdr, dxpl_id, hdr, &(hdr->root)) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node") + } /* end if */ + /* Check if we need to split the root node (equiv. to a 1->2 node split) */ + else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) { + /* Split root node */ + if(H5B2__split_root(hdr, dxpl_id) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node") + } /* end if */ + + /* Attempt to insert record into B-tree */ + if(hdr->depth > 0) { + if(H5B2__insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") + } /* end if */ + else { + if(H5B2__insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") + } /* end else */ + + /* Mark B-tree header as dirty */ + if(H5B2__hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__insert_hdr() */ + + +/*------------------------------------------------------------------------- * Function: H5B2__insert_leaf * * Purpose: Adds a new record to a B-tree leaf node. @@ -2277,6 +2333,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr H5B2_nodepos_t curr_pos, void *parent, void *udata) { H5B2_leaf_t *leaf; /* Pointer to leaf node */ + unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2292,11 +2349,6 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, parent, curr_node_ptr->node_nrec, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - /* Shadow the node if doing SWMR writes */ - if(hdr->swmr_write) - if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") - /* Must have a leaf node with enough space to insert a record now */ HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec); @@ -2323,6 +2375,9 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") + /* Mark the node as dirty */ + leaf_flags |= H5AC__DIRTIED_FLAG; + /* Update record count for node pointer to current node */ curr_node_ptr->all_nrec++; curr_node_ptr->node_nrec++; @@ -2353,8 +2408,14 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr done: /* Release the B-tree leaf node (marked as dirty) */ - if(leaf && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + if(leaf) { + /* Shadow the node if doing SWMR writes */ + if(hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) + if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node") + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__insert_leaf() */ @@ -2396,10 +2457,8 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, parent, curr_node_ptr->node_nrec, depth, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") - /* Shadow the node if doing SWMR writes */ - if(hdr->swmr_write) - if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") + /* Sanity check number of records */ + HDassert(internal->nrec == curr_node_ptr->node_nrec); /* Split or redistribute child node pointers, if necessary */ { @@ -2504,14 +2563,374 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, done: /* Release the B-tree internal node */ - if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + if(internal) { + /* Shadow the node if doing SWMR writes */ + if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) + if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node") + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__insert_internal() */ /*------------------------------------------------------------------------- + * Function: H5B2__update_leaf + * + * Purpose: Insert or modify a record in a B-tree leaf node. + * If the record exists already, it is modified as if H5B2_modify + * was called). If it doesn't exist, it is inserted as if + * H5B2_insert was called. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 23 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, + H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *parent, + void *udata, H5B2_modify_t op, void *op_data) +{ + H5B2_leaf_t *leaf; /* Pointer to leaf node */ + unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */ + int cmp = -1; /* Comparison value of records */ + unsigned idx; /* Location of record which matches key */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments. */ + HDassert(hdr); + HDassert(curr_node_ptr); + HDassert(H5F_addr_defined(curr_node_ptr->addr)); + + /* Lock current B-tree node */ + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, parent, curr_node_ptr->node_nrec, H5AC__NO_FLAGS_SET))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + + /* Sanity check number of records */ + HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); + HDassert(leaf->nrec == curr_node_ptr->node_nrec); + + /* Check for inserting into empty leaf */ + if(leaf->nrec == 0) + idx = 0; + else { + /* Find correct location to insert this record */ + cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + + /* Check for inserting a record */ + if(0 != cmp) { + /* Check if the leaf node is full */ + if(curr_node_ptr->node_nrec == hdr->node_info[0].split_nrec) { + /* Indicate that the leaf is full, but we need to insert */ + *status = H5B2_UPDATE_INSERT_CHILD_FULL; + + /* Let calling routine handle insertion */ + HGOTO_DONE(SUCCEED) + } /* end if */ + + /* Adjust index to leave room for record to insert */ + if(cmp > 0) + idx++; + + /* Make room for new record */ + if(idx < leaf->nrec) + HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size * (leaf->nrec - idx)); + } /* end if */ + } /* end else */ + + /* Check for modifying existing record */ + if(0 == cmp) { + hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */ + + /* Make callback for current record */ + if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) { + /* Make certain that the callback didn't modify the value if it failed */ + HDassert(changed == FALSE); + + HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation") + } /* end if */ + + /* Mark the node as dirty if it changed */ + leaf_flags |= (changed ? H5AC__DIRTIED_FLAG : 0); + + /* Indicate that the record was modified */ + *status = H5B2_UPDATE_MODIFY_DONE; + } /* end if */ + else { + /* Must have a leaf node with enough space to insert a record now */ + HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec); + + /* Make callback to store record in native form */ + if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") + + /* Mark the node as dirty */ + leaf_flags |= H5AC__DIRTIED_FLAG; + + /* Indicate that the record was inserted */ + *status = H5B2_UPDATE_INSERT_DONE; + + /* Update record count for node pointer to current node */ + curr_node_ptr->all_nrec++; + curr_node_ptr->node_nrec++; + + /* Update record count for current node */ + leaf->nrec++; + } /* end else */ + + /* Check for new record being the min or max for the tree */ + /* (Don't use 'else' for the idx check, to allow for root leaf node) */ + if(H5B2_POS_MIDDLE != curr_pos) { + if(idx == 0) { + if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { + if(hdr->min_native_rec == NULL) + if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") + HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + } /* end if */ + } /* end if */ + if(idx == (unsigned)(leaf->nrec - 1)) { + if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { + if(hdr->max_native_rec == NULL) + if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") + HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + } /* end if */ + } /* end if */ + } /* end if */ + +done: + /* Release the B-tree leaf node */ + if(leaf) { + /* Shadow the node if doing SWMR writes */ + if(hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) + if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node") + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__update_leaf() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__update_internal + * + * Purpose: Insert or modify a record in a B-tree leaf node. + * If the record exists already, it is modified as if H5B2_modify + * was called). If it doesn't exist, it is inserted as if + * H5B2_insert was called. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 24 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, + unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, + H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *parent, + void *udata, H5B2_modify_t op, void *op_data) +{ + H5B2_internal_t *internal = NULL; /* Pointer to internal node */ + unsigned internal_flags = H5AC__NO_FLAGS_SET; + int cmp; /* Comparison value of records */ + unsigned idx; /* Location of record which matches key */ + H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments. */ + HDassert(hdr); + HDassert(depth > 0); + HDassert(curr_node_ptr); + HDassert(H5F_addr_defined(curr_node_ptr->addr)); + + /* Lock current B-tree node */ + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, parent, curr_node_ptr->node_nrec, depth, H5AC__NO_FLAGS_SET))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + + /* Sanity check number of records */ + HDassert(internal->nrec == curr_node_ptr->node_nrec); + + /* Locate node pointer for child */ + cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + + /* Check for modifying existing record */ + if(0 == cmp) { + hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */ + + /* Make callback for current record */ + if((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) { + /* Make certain that the callback didn't modify the value if it failed */ + HDassert(changed == FALSE); + + HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation") + } /* end if */ + + /* Mark the node as dirty if it changed */ + internal_flags |= (changed ? H5AC__DIRTIED_FLAG : 0); + + /* Indicate that the record was modified */ + *status = H5B2_UPDATE_MODIFY_DONE; + } /* end if */ + else { + /* Adjust index to leave room for node to insert */ + if(cmp > 0) + idx++; + + /* Check if this node is left/right-most */ + if(H5B2_POS_MIDDLE != curr_pos) { + if(idx == 0) { + if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) + next_pos = H5B2_POS_LEFT; + } /* end if */ + else if(idx == internal->nrec) { + if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) + next_pos = H5B2_POS_RIGHT; + } /* end else */ + } /* end if */ + + /* Attempt to update record in child */ + if(depth > 1) { + if(H5B2__update_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in internal B-tree node") + } /* end if */ + else { + if(H5B2__update_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in leaf B-tree node") + } /* end else */ + + /* Take actions based on child's status report */ + switch(*status) { + case H5B2_UPDATE_MODIFY_DONE: + /* No action */ + break; + + case H5B2_UPDATE_INSERT_DONE: + /* Mark node as dirty */ + internal_flags |= H5AC__DIRTIED_FLAG; + + /* Update total record count for node pointer to current node */ + curr_node_ptr->all_nrec++; + break; + + case H5B2_UPDATE_INSERT_CHILD_FULL: + /* Split/redistribute this node */ + if(internal->nrec == hdr->node_info[depth].split_nrec) { + hbool_t could_split = FALSE; /* Whether the child node could split */ + +#ifdef QAK +HDfprintf(stderr, "%s: idx = %u, internal->nrec = %u\n", FUNC, idx, internal->nrec); +HDfprintf(stderr, "%s: hdr->node_info[%u].split_nrec = %u\n", FUNC, (unsigned)depth, (unsigned)hdr->node_info[depth].split_nrec); +HDfprintf(stderr, "%s: hdr->node_info[%u].split_nrec = %u\n", FUNC, (unsigned)(depth - 1), (unsigned)hdr->node_info[depth - 1].split_nrec); +#endif /* QAK */ + if(idx == 0) { /* Left-most child */ +#ifdef QAK +HDfprintf(stderr, "%s: Left-most child\n", FUNC); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx + 1), (unsigned)internal->node_ptrs[idx + 1].node_nrec); +#endif /* QAK */ + /* Check for left-most child and its neighbor being close to full */ + if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + } /* end if */ + else if(idx == internal->nrec) { /* Right-most child */ +#ifdef QAK +HDfprintf(stderr, "%s: Right-most child\n", FUNC); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx - 1), (unsigned)internal->node_ptrs[idx - 1].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec); +#endif /* QAK */ + /* Check for right-most child and its neighbor being close to full */ + if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + } /* end else-if */ + else { /* Middle child */ +#ifdef QAK +HDfprintf(stderr, "%s: Middle child\n", FUNC); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx - 1), (unsigned)internal->node_ptrs[idx - 1].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx + 1), (unsigned)internal->node_ptrs[idx + 1].node_nrec); +#endif /* QAK */ + /* Check for middle child and its left neighbor being close to full */ + if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + /* Check for middle child and its right neighbor being close to full */ + else if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + } /* end if */ + + /* If this node is full and the child node insertion could + * cause a split, punt back up to caller, leaving the + * "insert child full" status. + */ + if(could_split) { + /* Release the internal B-tree node */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + internal = NULL; + +#ifdef QAK +HDfprintf(stderr, "%s: Punting back to caller\n", FUNC); +#endif /* QAK */ + /* Punt back to caller */ + HGOTO_DONE(SUCCEED); + } /* end if */ + } /* end if */ + + /* Release the internal B-tree node */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + internal = NULL; + + /* Indicate that the record was inserted */ + *status = H5B2_UPDATE_INSERT_DONE; + + /* Dodge sideways into inserting a record into this node */ + if(H5B2__insert_internal(hdr, dxpl_id, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos, parent, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into internal B-tree node") + break; + + case H5B2_UPDATE_UNKNOWN: + default: + HDassert(0 && "Invalid update status"); + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "invalid update status") + } /* end switch */ + } /* end else */ + +done: + /* Release the internal B-tree node */ + if(internal) { + /* Shadow the node if doing SWMR writes */ + if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) + if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node") + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__update_internal() */ + + +/*------------------------------------------------------------------------- * Function: H5B2__create_leaf * * Purpose: Creates empty leaf node of a B-tree and update node pointer diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 5691d5f..b6410fd 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -238,6 +238,14 @@ typedef enum H5B2_nodepos_t { H5B2_POS_MIDDLE /* Node is neither right or left-most in tree */ } H5B2_nodepos_t; +/* Update status */ +typedef enum H5B2_update_status_t { + H5B2_UPDATE_UNKNOWN, /* Unknown update status (initial state) */ + H5B2_UPDATE_MODIFY_DONE, /* Update successfully modified existing record */ + H5B2_UPDATE_INSERT_DONE, /* Update inserted record successfully */ + H5B2_UPDATE_INSERT_CHILD_FULL /* Update will insert record, but child is full */ +} H5B2_update_status_t; + /* Callback info for loading a free space header into the cache */ typedef struct H5B2_hdr_cache_ud_t { H5F_t *f; /* File that v2 b-tree header is within */ @@ -264,7 +272,7 @@ typedef struct H5B2_leaf_cache_ud_t { #ifdef H5B2_TESTING /* Node information for testing */ -typedef struct { +typedef struct H5B2_node_info_test_t { uint16_t depth; /* Depth of node */ uint16_t nrec; /* Number of records in node */ } H5B2_node_info_test_t; @@ -293,6 +301,13 @@ H5FL_EXTERN(H5B2_leaf_t); /* Internal v2 B-tree testing class */ #ifdef H5B2_TESTING H5_DLLVAR const H5B2_class_t H5B2_TEST[1]; +H5_DLLVAR const H5B2_class_t H5B2_TEST2[1]; + +/* B-tree record for testing H5B2_TEST2 class */ +typedef struct H5B2_test_rec_t { + hsize_t key; /* Key for record */ + hsize_t val; /* Value for record */ +} H5B2_test_rec_t; #endif /* H5B2_TESTING */ /* Array of v2 B-tree client ID -> client class mappings */ @@ -345,12 +360,24 @@ H5_DLL herr_t H5B2__leaf_free(H5B2_leaf_t *l); H5_DLL herr_t H5B2__internal_free(H5B2_internal_t *i); /* Routines for inserting records */ +H5_DLL herr_t H5B2__insert_hdr(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata); H5_DLL herr_t H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent, void *udata); H5_DLL herr_t H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent, void *udata); +/* Routines for update records */ +H5_DLL herr_t H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, + uint16_t depth, unsigned *parent_cache_info_flags_ptr, + H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status, + H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_modify_t op, + void *op_data); +H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, + H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status, + H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_modify_t op, + void *op_data); + /* Routines for iterating over nodes/records */ H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent, H5B2_operator_t op, void *op_data); diff --git a/src/H5B2private.h b/src/H5B2private.h index cc60c9b..ad3248d 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -57,6 +57,7 @@ typedef enum H5B2_subid_t { H5B2_ATTR_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" attribute storage on objects */ H5B2_CDSET_ID, /* B-tree is for non-filtered chunked dataset storage w/ >1 unlim dims */ H5B2_CDSET_FILT_ID, /* B-tree is for filtered chunked dataset storage w/ >1 unlim dims */ + H5B2_TEST2_ID, /* Another B-tree is for testing (do not use for actual data) */ H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */ } H5B2_subid_t; @@ -97,8 +98,6 @@ struct H5B2_class_t { herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */ herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */ const void *record, const void *ctx); - void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */ - herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */ }; /* v2 B-tree creation parameters */ @@ -143,6 +142,8 @@ H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data); H5_DLL herr_t H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, void *op_data); +H5_DLL herr_t H5B2_update(H5B2_t *bt2, hid_t dxpl_id, void *udata, + H5B2_modify_t op, void *op_data); H5_DLL herr_t H5B2_remove(H5B2_t *b2, hid_t dxpl_id, void *udata, H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, diff --git a/src/H5B2test.c b/src/H5B2test.c index a72dc30..141acee 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -61,6 +61,7 @@ typedef struct H5B2_test_ctx_t { /* Local Prototypes */ /********************/ +/* v2 B-tree driver callbacks for 'test' B-trees */ static void *H5B2__test_crt_context(void *udata); static herr_t H5B2__test_dst_context(void *ctx); static herr_t H5B2__test_store(void *nrecord, const void *udata); @@ -69,13 +70,21 @@ static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx); static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx); static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); -static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); + +/* v2 B-tree driver callbacks for 'test2' B-trees */ +static herr_t H5B2__test2_store(void *nrecord, const void *udata); +static herr_t H5B2__test2_compare(const void *rec1, const void *rec2); +static herr_t H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *ctx); +static herr_t H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *ctx); +static herr_t H5B2__test2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /*********************/ /* Package Variables */ /*********************/ +/* Class structure for testing simple B-tree records */ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2_TEST_ID, /* Type of B-tree */ "H5B2_TEST_ID", /* Name of B-tree class */ @@ -86,9 +95,21 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2__test_compare, /* Record comparison callback */ H5B2__test_encode, /* Record encoding callback */ H5B2__test_decode, /* Record decoding callback */ - H5B2__test_debug, /* Record debugging callback */ - H5B2__test_crt_dbg_context, /* Create debugging context */ - H5B2__test_dst_context /* Destroy debugging context */ + H5B2__test_debug /* Record debugging callback */ +}}; + +/* Class structure for testing key/value B-tree records */ +const H5B2_class_t H5B2_TEST2[1]={{ /* B-tree class information */ + H5B2_TEST2_ID, /* Type of B-tree */ + "H5B2_TEST2_ID", /* Name of B-tree class */ + sizeof(H5B2_test_rec_t), /* Size of native record */ + H5B2__test_crt_context, /* Create client callback context */ + H5B2__test_dst_context, /* Destroy client callback context */ + H5B2__test2_store, /* Record storage callback */ + H5B2__test2_compare, /* Record comparison callback */ + H5B2__test2_encode, /* Record encoding callback */ + H5B2__test2_decode, /* Record decoding callback */ + H5B2__test2_debug /* Record debugging callback */ }}; @@ -310,42 +331,139 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, /*------------------------------------------------------------------------- - * Function: H5B2__test_crt_dbg_context + * Function: H5B2__test2_store * - * Purpose: Create context for debugging callback + * Purpose: Store native information into record for B-tree * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol - * Tuesday, December 1, 2009 + * Friday, December 25, 2015 * *------------------------------------------------------------------------- */ -static void * -H5B2__test_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +static herr_t +H5B2__test2_store(void *nrecord, const void *udata) { - H5B2_test_ctx_t *ctx; /* Callback context structure */ - void *ret_value = NULL; /* Return value */ + FUNC_ENTER_STATIC_NOERR - FUNC_ENTER_STATIC + *(H5B2_test_rec_t *)nrecord = *(const H5B2_test_rec_t *)udata; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_store() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_compare + * + * Purpose: Compare two native information records, according to some key + * + * Return: <0 if rec1 < rec2 + * =0 if rec1 == rec2 + * >0 if rec1 > rec2 + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_compare(const void *rec1, const void *rec2) +{ + FUNC_ENTER_STATIC_NOERR + + FUNC_LEAVE_NOAPI((herr_t)(((const H5B2_test_rec_t *)rec1)->key - ((const H5B2_test_rec_t *)rec2)->key)) +} /* H5B2__test2_compare() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_encode + * + * Purpose: Encode native information into raw form for storing on disk + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx) +{ + H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ + + FUNC_ENTER_STATIC_NOERR /* Sanity check */ - HDassert(f); + HDassert(ctx); - /* Allocate callback context */ - if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context") + H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); + H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); - /* Determine the size of addresses & lengths in the file */ - ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_encode() */ - /* Set return value */ - ret_value = ctx; + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_decode + * + * Purpose: Decode raw disk form of record into native form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx) +{ + H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2__test_crt_dbg_context() */ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); + H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_debug + * + * Purpose: Debug native form of record + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, + const void H5_ATTR_UNUSED *_udata) +{ + FUNC_ENTER_STATIC_NOERR + + HDassert(record); + + HDfprintf(stream, "%*s%-*s (%Hu, %Hu)\n", indent, "", fwidth, "Record:", + ((const H5B2_test_rec_t *)record)->key, + ((const H5B2_test_rec_t *)record)->val); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_debug() */ /*------------------------------------------------------------------------- diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index b464930..1a99b12 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -114,9 +114,7 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ H5G_dense_btree2_name_compare, /* Record comparison callback */ H5G_dense_btree2_name_encode, /* Record encoding callback */ H5G_dense_btree2_name_decode, /* Record decoding callback */ - H5G_dense_btree2_name_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5G_dense_btree2_name_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing 'creation order' field of links */ @@ -130,9 +128,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ H5G_dense_btree2_corder_compare, /* Record comparison callback */ H5G_dense_btree2_corder_encode, /* Record encoding callback */ H5G_dense_btree2_corder_decode, /* Record decoding callback */ - H5G_dense_btree2_corder_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5G_dense_btree2_corder_debug /* Record debugging callback */ }}; /*****************************/ diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index d82de93..a79bf58 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -71,7 +71,6 @@ typedef struct H5HF_huge_bt2_ctx_t { /* Common callbacks */ static void *H5HF__huge_bt2_crt_context(void *udata); static herr_t H5HF__huge_bt2_dst_context(void *ctx); -static void *H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /* Callbacks for indirect objects */ static herr_t H5HF__huge_bt2_indir_store(void *native, const void *udata); @@ -127,9 +126,7 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_indir_compare, /* Record comparison callback */ H5HF__huge_bt2_indir_encode, /* Record encoding callback */ H5HF__huge_bt2_indir_decode, /* Record decoding callback */ - H5HF__huge_bt2_indir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_indir_debug /* Record debugging callback */ }}; /* v2 B-tree class for indirectly accessed, filtered 'huge' objects */ @@ -143,9 +140,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_filt_indir_compare, /* Record comparison callback */ H5HF__huge_bt2_filt_indir_encode, /* Record encoding callback */ H5HF__huge_bt2_filt_indir_decode, /* Record decoding callback */ - H5HF__huge_bt2_filt_indir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_filt_indir_debug /* Record debugging callback */ }}; /* v2 B-tree class for directly accessed 'huge' objects */ @@ -159,9 +154,7 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_dir_compare, /* Record comparison callback */ H5HF__huge_bt2_dir_encode, /* Record encoding callback */ H5HF__huge_bt2_dir_decode, /* Record decoding callback */ - H5HF__huge_bt2_dir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_dir_debug /* Record debugging callback */ }}; /* v2 B-tree class for directly accessed, filtered 'huge' objects */ @@ -175,9 +168,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_filt_dir_compare, /* Record comparison callback */ H5HF__huge_bt2_filt_dir_encode, /* Record encoding callback */ H5HF__huge_bt2_filt_dir_decode, /* Record decoding callback */ - H5HF__huge_bt2_filt_dir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_filt_dir_debug /* Record debugging callback */ }}; /*****************************/ @@ -270,46 +261,6 @@ H5HF__huge_bt2_dst_context(void *_ctx) /*------------------------------------------------------------------------- - * Function: H5HF__huge_bt2_crt_dbg_context - * - * Purpose: Create context for debugging callback - * - * Return: Success: non-NULL - * Failure: NULL - * - * Programmer: Quincey Koziol - * Tuesday, December 1, 2009 - * - *------------------------------------------------------------------------- - */ -static void * -H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) -{ - H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(f); - - /* Allocate callback context */ - if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") - - /* Determine the size of addresses & lengths in the file */ - ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); - ctx->sizeof_size = H5F_SIZEOF_SIZE(f); - - /* Set return value */ - ret_value = ctx; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF__huge_bt2_crt_dbg_context() */ - - -/*------------------------------------------------------------------------- * Function: H5HF__huge_bt2_indir_found * * Purpose: Retrieve record for indirectly accessed 'huge' object, when diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index e533ae8..0110c1e 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -50,7 +50,6 @@ static herr_t H5SM__bt2_dst_context(void *ctx); static herr_t H5SM__bt2_store(void *native, const void *udata); static herr_t H5SM__bt2_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); -static void *H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*****************************/ @@ -67,9 +66,7 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ H5SM__message_compare, /* Record comparison callback */ H5SM__message_encode, /* Record encoding callback */ H5SM__message_decode, /* Record decoding callback */ - H5SM__bt2_debug, /* Record debugging callback */ - H5SM__bt2_crt_dbg_context, /* Create debugging context */ - H5SM__bt2_dst_context /* Destroy debugging context */ + H5SM__bt2_debug /* Record debugging callback */ }}; @@ -218,45 +215,6 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth, /*------------------------------------------------------------------------- - * Function: H5SM__bt2_crt_dbg_context - * - * Purpose: Create context for debugging callback - * - * Return: Success: non-NULL - * Failure: NULL - * - * Programmer: Quincey Koziol - * Tuesday, December 1, 2009 - * - *------------------------------------------------------------------------- - */ -static void * -H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) -{ - H5SM_bt2_ctx_t *ctx; /* Callback context structure */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(f); - - /* Allocate callback context */ - if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") - - /* Determine the size of addresses & lengths in the file */ - ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); - - /* Set return value */ - ret_value = ctx; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5SM__bt2_crt_dbg_context() */ - - -/*------------------------------------------------------------------------- * Function: H5SM_bt2_convert_to_list_op * * Purpose: An H5B2_remove_t callback function to convert a SOHM diff --git a/test/btree2.c b/test/btree2.c index 7a2432c..04c94fd 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -36,8 +36,11 @@ const char *FILENAME[] = { }; #define INSERT_SPLIT_ROOT_NREC 63 -#define INSERT_MANY (1000*1000) -#define FIND_MANY (INSERT_MANY/100) +#define INSERT_SPLIT_ROOT_NREC_REC 64 +#define INSERT_MANY (1000 * 1000) +#define INSERT_MANY_REC (2600 * 1000) +#define FIND_MANY (INSERT_MANY / 100) +#define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 #define DELETE_SMALL 20 #define DELETE_MEDIUM 200 @@ -63,7 +66,7 @@ typedef struct bt2_test_param_t { *------------------------------------------------------------------------- */ static int -init_cparam(H5B2_create_t *cparam) +init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2) { /* Wipe out background */ HDmemset(cparam, 0, sizeof(*cparam)); @@ -75,6 +78,16 @@ init_cparam(H5B2_create_t *cparam) cparam->split_percent = 100; cparam->merge_percent = 40; + /* Wipe out background */ + HDmemset(cparam2, 0, sizeof(*cparam2)); + + /* General parameters */ + cparam2->cls = H5B2_TEST2; + cparam2->node_size = (size_t)1024; + cparam2->rrec_size = (size_t)16; + cparam2->split_percent = 100; + cparam2->merge_percent = 40; + return(0); } /* init_cparam() */ @@ -154,6 +167,47 @@ error: /*------------------------------------------------------------------------- + * Function: reopen_file + * + * Purpose: Re-open the file + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Monday, December 28, 2015 + * + *------------------------------------------------------------------------- + */ +static int +reopen_file(hid_t *file, H5F_t **f, hid_t fapl) +{ + char filename[1024]; /* Filename to use */ + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Create the file to work on */ + if((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (*f = (H5F_t *)H5I_object(*file))) + STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(*f) < 0) + STACK_ERROR + + /* Success */ + return(0); + +error: + return(-1); +} /* end create_file() */ + + +/*------------------------------------------------------------------------- * Function: reopen_btree * * Purpose: Perform common "re-open" operations on B-tree for testing @@ -237,11 +291,11 @@ error: *------------------------------------------------------------------------- */ static int -check_node_depth(H5B2_t *bt2, hid_t dxpl, hsize_t record, unsigned depth) +check_node_depth(H5B2_t *bt2, hid_t dxpl, void *record, unsigned depth) { int rec_depth; /* Depth of record in B-tree */ - if((rec_depth = H5B2_get_node_depth_test(bt2, dxpl, &record)) < 0) + if((rec_depth = H5B2_get_node_depth_test(bt2, dxpl, record)) < 0) FAIL_STACK_ERROR if((unsigned)rec_depth != depth) TEST_ERROR @@ -285,7 +339,7 @@ check_node_info(H5B2_t *bt2, hid_t dxpl, hsize_t record, error: return(-1); -} /* end check_node_depth() */ +} /* end check_node_info() */ /*------------------------------------------------------------------------- @@ -294,7 +348,6 @@ error: * Purpose: v2 B-tree iterator callback * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol @@ -317,12 +370,41 @@ iter_cb(const void *_record, void *_op_data) /*------------------------------------------------------------------------- + * Function: iter_rec_cb + * + * Purpose: v2 B-tree iterator callback for H5B2_test_rec_t records + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +iter_rec_cb(const void *_record, void *_op_data) +{ + const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record; + H5B2_test_rec_t *idx = (H5B2_test_rec_t *)_op_data; + + if(record->key != idx->key) + return(H5_ITER_ERROR); + if(record->val != idx->val) + return(H5_ITER_ERROR); + + idx->key++; + idx->val += 2; + return(H5_ITER_CONT); +} /* end iter_rec_cb() */ + + +/*------------------------------------------------------------------------- * Function: find_cb * * Purpose: v2 B-tree find callback * * Return: Success: TRUE/FALSE - * * Failure: FAIL * * Programmer: Quincey Koziol @@ -344,6 +426,33 @@ find_cb(const void *_record, void *_op_data) /*------------------------------------------------------------------------- + * Function: find_rec_cb + * + * Purpose: v2 B-tree find callback for H5B2_test_rec_t records + * + * Return: Success: TRUE/FALSE + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +find_rec_cb(const void *_record, void *_op_data) +{ + const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record; + H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data; + + if(record->key != search->key) + return(FALSE); + + search->val = record->val; + return(TRUE); +} /* end find_rec_cb() */ + + +/*------------------------------------------------------------------------- * Function: find_dec_cb * * Purpose: v2 B-tree find callback for indexing in decreasing order @@ -372,6 +481,34 @@ find_dec_cb(const void *_record, void *_op_data) /*------------------------------------------------------------------------- + * Function: index_rec_cb + * + * Purpose: v2 B-tree index callback for H5B2_test_rec_t records + * + * Return: Success: TRUE/FALSE + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +index_rec_cb(const void *_record, void *_op_data) +{ + const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record; + H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data; + + HDassert(record); + HDassert(search); + + search->key = record->key; + search->val = record->val; + return(TRUE); +} /* end index_rec_cb() */ + + +/*------------------------------------------------------------------------- * Function: neighbor_cb * * Purpose: v2 B-tree neighbor callback @@ -425,6 +562,57 @@ modify_cb(void *_record, void *_op_data, hbool_t *changed) /*------------------------------------------------------------------------- + * Function: modify_rec_cb + * + * Purpose: v2 B-tree modify callback for H5B2_test_rec_t records + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +modify_rec_cb(void *_record, void *_op_data, hbool_t *changed) +{ + H5B2_test_rec_t *record = (H5B2_test_rec_t *)_record; + H5B2_test_rec_t *modify = (H5B2_test_rec_t *)_op_data; + + HDassert(record->key == modify->key); + record->val = modify->val; + *changed = TRUE; + + return(0); +} /* end modify_rec_cb() */ + + +/*------------------------------------------------------------------------- + * Function: no_modify_cb + * + * Purpose: v2 B-tree modify callback for updates which shouldn't change + * the record (ie. inserting not modifying) + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Wednesday, December 23, 2015 + * + *------------------------------------------------------------------------- + */ +static int +no_modify_cb(void H5_ATTR_UNUSED *_record, void H5_ATTR_UNUSED *_op_data, + hbool_t *changed) +{ + *changed = FALSE; + + return(1); +} /* end no_modify_cb() */ + + +/*------------------------------------------------------------------------- * Function: remove_cb * * Purpose: v2 B-tree remove callback @@ -717,7 +905,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC - 1); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)0) < 0) + record = (hsize_t)33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -734,7 +923,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0) + record = (hsize_t)33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -755,7 +945,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + 2); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0) + record = (hsize_t)33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -889,7 +1080,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)INSERT_SPLIT_ROOT_NREC, (unsigned)1) < 0) + record = (hsize_t)INSERT_SPLIT_ROOT_NREC; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -909,7 +1101,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0) + record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -940,7 +1133,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2), (unsigned)1) < 0) + record = (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -959,7 +1153,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0) + record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -1041,7 +1236,7 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1061,10 +1256,10 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 31; - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 63; - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -1096,7 +1291,7 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1115,9 +1310,11 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0) + record = 62; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0) + record = 94; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -1202,7 +1399,7 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (2 * INSERT_SPLIT_ROOT_NREC); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1222,10 +1419,10 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1244,9 +1441,11 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)52, (unsigned)1) < 0) + record = 52; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)105, (unsigned)1) < 0) + record = 105; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1343,7 +1542,7 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1362,11 +1561,14 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0) + record = 62; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0) + record = 94; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)126, (unsigned)1) < 0) + record = 126; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1464,7 +1666,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0) + record = 948; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1513,7 +1716,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, FAIL_STACK_ERROR /* Check with B-tree */ - if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0) + record = 948; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR /* Attempt to find existant record in internal node of level-2 B-tree */ @@ -1522,7 +1726,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, FAIL_STACK_ERROR /* Check with B-tree */ - if(check_node_depth(bt2, dxpl, (hsize_t)505, (unsigned)1) < 0) + record = 505; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Attempt to find existant record in leaf of level-2 B-tree */ @@ -1531,7 +1736,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, FAIL_STACK_ERROR /* Check with B-tree */ - if(check_node_depth(bt2, dxpl, (hsize_t)555, (unsigned)0) < 0) + record = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Attempt to index non-existant record in level-2 B-tree */ @@ -1642,11 +1848,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1859, (unsigned)1) < 0) + record = 1859; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1921, (unsigned)0) < 0) + record = 1921; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1663,11 +1872,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1875, (unsigned)1) < 0) + record = 1875; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1922, (unsigned)0) < 0) + record = 1922; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1683,11 +1895,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0) + record = 94; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)32, (unsigned)0) < 0) + record = 32; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Add more records to left-most leaf, to force a 2->1 split and then a @@ -1704,11 +1919,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)47, (unsigned)1) < 0) + record = 47; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)0, (unsigned)0) < 0) + record = 0; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1724,13 +1942,17 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */ + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) /* Record in root node */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)535, (unsigned)1) < 0) /* Record in middle node before insertion point */ + record = 535; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)630, (unsigned)1) < 0) /* Record in middle node after insertion point */ + record = 630; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ + record = 568; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ TEST_ERROR /* Add more records to middle leaf, to force a split and a 3 node redistribution on middle leaf */ @@ -1745,13 +1967,17 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */ + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) /* Record in root node */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)524, (unsigned)1) < 0) /* Record in middle node before insertion point */ + record = 524; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)577, (unsigned)1) < 0) /* Record in middle node after insertion point */ + record = 577; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ + record = 568; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1851,13 +2077,13 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 1797; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1859; /* Right-most record in right-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1877,16 +2103,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 1828; /* Next-to-right-most record in right-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1860; /* Right-most record in right-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1891; /* Right-most record in right-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1903,13 +2129,13 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 63; /* Left-most record in left-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1; /* Left-most record in left-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Add another record to left-most leaf, to force a 1->2 node split on left leaf */ @@ -1923,16 +2149,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 63; /* Left-most record in left-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 32; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 0; /* Left-most record in left-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1949,16 +2175,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 504; /* Record in internal node just before insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 568; /* Record in internal node just after insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 506; /* Record in leaf node just after insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Add another record to middle leaf, to force a node split on middle leaf */ @@ -1972,19 +2198,19 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 504; /* Left-most record of split in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 537; /* Middle record of split in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 568; /* Right-most record of split in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 506; /* Record in leaf node just after insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2081,13 +2307,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1318; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3114; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3145; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2105,13 +2331,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1822; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3114; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3146; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -2128,13 +2354,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1822; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 436; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 374; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Force left-most internal node to redistribute */ @@ -2150,13 +2376,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1570; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 61; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 0; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2253,13 +2479,13 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 2759; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 4555; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 4586; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2277,16 +2503,16 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 2759; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3704; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 4555; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 4387; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -2303,13 +2529,13 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 2759; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 932; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 870; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Force left-most internal node to split */ @@ -2325,16 +2551,16 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 870; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 1814; /* Next-to-left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 61; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 0; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2436,19 +2662,19 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 2267; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3199; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3137; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2468,19 +2694,19 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3104; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3137; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3135; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2498,21 +2724,21 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1574; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3104; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR #ifdef NONE record = 2862; /* Record to left of insertion point in right internal node (now) */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR #endif /* NONE */ record = 3137; /* Record to right of insertion point in right internal node (now) */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3135; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2588,126 +2814,2129 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam, */ TESTING("B-tree insert: split 3 internals to 4 in level 2 B-tree"); - /* Create the file for the test */ - if(create_file(&file, &f, fapl) < 0) + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 3 internal nodes */ + /* (and fill right internal node) */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 31); u++) { + record = u; + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC * 74); u++) { + record = u + ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3); + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 74; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record = 1889; /* Left record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 3703; /* Right record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 1952; /* Record to left of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2884; /* Record to right of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2822; /* Record just after insertion point in leaf node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Insert records to fill up middle internal node */ + for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) { + record = u + (INSERT_SPLIT_ROOT_NREC * 31); + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record = 1889; /* Left record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 3703; /* Right record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 2789; /* Record to left of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2822; /* Record to right of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2823; /* Record just above insertion point in leaf node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert record to split middle internal node */ + record = u + (INSERT_SPLIT_ROOT_NREC * 31); + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record = 1889; /* Left record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 2789; /* Middle record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 3703; /* Right record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR +#ifdef NONE + record = 3049; /* Record to left of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR +#endif /* NONE */ + record = 2822; /* Record to right of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2823; /* Record just above insertion point in leaf node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx = 0; + if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_insert_level2_3internal_split() */ + + +/*------------------------------------------------------------------------- + * Function: test_insert_lots + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts many + * records in random order, enough to make at a level 4 B-tree. + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, February 19, 2005 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + char filename[1024]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + hsize_t record; /* Record to insert into tree */ + hsize_t idx; /* Index within B-tree, for iterator */ + time_t curr_time; /* Current time, for seeding random number generator */ + hsize_t *records; /* Record #'s for random insertion */ + unsigned u; /* Local index variable */ + unsigned swap_idx; /* Location to swap with when shuffling */ + hsize_t temp_rec; /* Temporary record */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + hsize_t nrec; /* Number of records in B-tree */ + herr_t ret; /* Generic error return value */ + + /* Initialize random number seed */ + curr_time=HDtime(NULL); +#ifdef QAK +curr_time=1109170019; +HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); +#endif /* QAK */ + HDsrandom((unsigned)curr_time); + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree insert: create random level 4 B-tree"); + + /* Allocate space for the records */ + if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY))) + TEST_ERROR + + /* Initialize record #'s */ + for(u = 0; u < INSERT_MANY; u++) + records[u] = u; + + /* Shuffle record #'s */ + for(u = 0; u < INSERT_MANY; u++) { + swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u; + temp_rec = records[u]; + records[u] = records[swap_idx]; + records[swap_idx] = temp_rec; + } /* end for */ + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Create the file to work on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) + STACK_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert random records */ + for(u = 0; u < INSERT_MANY; u++) { + record = records[u]; + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 4; + bt2_stat.nrecords = INSERT_MANY; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + STACK_ERROR + + /* Re-open the file */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) + STACK_ERROR + + /* Re-open v2 B-tree */ + if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) + FAIL_STACK_ERROR + + /* Check up on B-tree after re-open */ + bt2_stat.depth = 4; + bt2_stat.nrecords = INSERT_MANY; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx = 0; + if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx != INSERT_MANY) + TEST_ERROR + + /* Attempt to find non-existant record in level-4 B-tree */ + /* (Should not be found, but not fail) */ + idx = INSERT_MANY * 2; + if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE) + TEST_ERROR + + /* Find random records */ + for(u = 0; u < FIND_MANY; u++) { + /* Pick random record */ + idx = (hsize_t)(HDrandom()%INSERT_MANY); + + /* Attempt to find existant record in root of level-4 B-tree */ + if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE) + FAIL_STACK_ERROR + } /* end for */ + + /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Find random records */ + for(u = 0; u < FIND_MANY; u++) { + /* Pick random record */ + idx = (hsize_t)(HDrandom() % INSERT_MANY); + + /* Attempt to find existant record in root of level-4 B-tree */ + /* (in increasing order) */ + if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, find_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Attempt to find existant record in root of level-4 B-tree */ + /* (in decreasing order) */ + if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0) + FAIL_STACK_ERROR + } /* end for */ + + PASSED(); + + TESTING("B-tree insert: attempt duplicate record in level 4 B-tree"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + record = INSERT_MANY / 2; + H5E_BEGIN_TRY { + ret = H5B2_insert(bt2, dxpl, &record); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Query the number of records in the B-tree */ + if(H5B2_get_nrec(bt2, &nrec) < 0) + FAIL_STACK_ERROR + + /* Make certain that the # of records is correct */ + if(nrec != INSERT_MANY) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + TEST_ERROR + + PASSED(); + + HDfree(records); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + HDfree(records); + return 1; +} /* test_insert_lots() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_basic + * + * Purpose: Basic tests for the v2 B-tree update operation + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Wednesday, December 23, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_basic(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t modify; /* Modified value */ + H5B2_test_rec_t find; /* Record to find */ + herr_t ret; /* Generic error return value */ + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* + * Test insert record into empty v2 B-tree + */ + TESTING("B-tree update: inserting first record in empty B-tree"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + record.key = 42; + record.val = 72; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in B-tree with 1 record */ + /* (Should not be found, but not fail) */ + find.key = 10; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Try again with NULL 'op' */ + /* (Should not be found, but not fail) */ + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in B-tree with 1 record */ + find.key = 42; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != 72) + TEST_ERROR + + /* Try again with NULL 'op' */ + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != TRUE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with 1 record */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with 1 record */ + find.key = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 72) + TEST_ERROR + + PASSED(); + + + /* + * Test update only record into v2 B-tree + */ + TESTING("B-tree update: update only record in B-tree"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + modify.key = 42; + modify.val = 43; + if(H5B2_update(bt2, dxpl, &modify, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in B-tree with 1 record */ + /* (Should not be found, but not fail) */ + find.key = 10; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Try again with NULL 'op' */ + /* (Should not be found, but not fail) */ + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find modified record in B-tree with 1 record */ + find.key = 42; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != 43) + TEST_ERROR + + /* Try again with NULL 'op' */ + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != TRUE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with 1 record */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with 1 record */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 43) + TEST_ERROR + + PASSED(); + + + /* + * Test inserting more records into v2 B-tree + */ + TESTING("B-tree update: insert several records"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* + * Test inserting second record into v2 B-tree, before all other records + */ + record.key = 34; + record.val = 11; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* + * Test inserting third record into v2 B-tree, after all other records + */ + record.key = 56; + record.val = 12; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* + * Test inserting fourth record into v2 B-tree, in the middle of other records + */ + record.key = 38; + record.val = 13; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in level-0 B-tree with several records */ + /* (Should not be found, but not fail) */ + find.key = 10; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in level-0 B-tree with several records */ + find.key = 56; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + TEST_ERROR + if(find.val != 12) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with several records */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with several records */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 34) + TEST_ERROR + if(find.val != 11) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 38) + TEST_ERROR + if(find.val != 13) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 43) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 56) + TEST_ERROR + if(find.val != 12) + TEST_ERROR + + PASSED(); + + + /* + * Test updating all existing records in v2 B-tree + */ + TESTING("B-tree update: update several records"); + + record.key = 34; + modify.key = 34; + modify.val = 21; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + record.key = 38; + modify.key = 38; + modify.val = 23; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + record.key = 42; + modify.key = 42; + modify.val = 24; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + record.key = 56; + modify.key = 56; + modify.val = 22; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in level-0 B-tree with several records */ + /* (Should not be found, but not fail) */ + find.key = 41; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in level-0 B-tree with several record */ + find.key = 56; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + TEST_ERROR + if(find.val != 22) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with several records */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with several records */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 34) + TEST_ERROR + if(find.val != 21) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 38) + TEST_ERROR + if(find.val != 23) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 24) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 56) + TEST_ERROR + if(find.val != 22) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close the file */ + if(H5Fclose(file) < 0) + TEST_ERROR + + PASSED(); + + + /* All tests passed */ + return(0); + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return(1); +} /* test_update_basic() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_split_root + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It also continues to add a few more records to each of the + * left and right leaf nodes after the split + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Wednesday, December 23, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t modify; /* Modified value */ + H5B2_test_rec_t find; /* Record to find */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic error return value */ + + /* + * Test inserting enough records into v2 B-tree to split the root node + */ + TESTING("B-tree update: split root"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert records to fill root leaf node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC - 1); u++) { + record.key = u + 2; + record.val = u * 2 + 4; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 0; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC - 1); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert record to split root leaf node */ + record.key = INSERT_SPLIT_ROOT_NREC_REC + 1; + record.val = (INSERT_SPLIT_ROOT_NREC_REC - 1) * 2 + 4; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 2; + idx.val = 4; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2)) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Modify all records */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + 2; + modify.key = u + 2; + modify.val = u * 2 + 5; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 2; + idx.val = 5; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2)) + TEST_ERROR + + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert a couple more records, on the left side of the B-tree */ + record.key = 0; + record.val = 1; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = 1; + record.val = 3; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + 2); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 1; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2)) + TEST_ERROR + + /* Attempt to find non-existant record in level-1 B-tree */ + /* (Should not be found, but not fail) */ + find.key = 800; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in root of level-1 B-tree */ + find.key = 33; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.key != 33) + TEST_ERROR + if(find.val != 67) + TEST_ERROR + + /* Attempt to find existant record in leaf of level-1 B-tree */ + find.key = 56; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.key != 56) + TEST_ERROR + if(find.val != 113) + TEST_ERROR + + /* Attempt to index non-existant record in level-1 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC + 2), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in root of level-1 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)33, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 33) + TEST_ERROR + if(find.val != 67) + TEST_ERROR + + /* Attempt to index existing record in left leaf of level-1 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 0) + TEST_ERROR + if(find.val != 1) + TEST_ERROR + + /* Attempt to index existing record in right leaf of level-1 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)50, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 50) + TEST_ERROR + if(find.val != 101) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + if(H5Fclose(file) < 0) + TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_split_root() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_2leaf_redistrib + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * redistribution + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (l->r)"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + record.val = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = INSERT_SPLIT_ROOT_NREC_REC; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Force redistribution from left node into right node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) { + record.key = u; + record.val = u + 9; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (r->l)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = u + 9; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force redistribution from left node into right node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 9; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_2leaf_redistrib() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_side_split + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * split, adding another node to the B-tree + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (l->r)"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force left node to split */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = u + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 31; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 64; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (r->l)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = u + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force right node to split */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 63; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 95; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_side_split() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_3leaf_redistrib + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * split, adding another node to the B-tree, then continues to + * add records until a 3 node redistribution occurs + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: redistribute 3 leaves in level 1 B-tree"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force left node to split */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert records to force middle node to redistribute */ + for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 52; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 107; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 2) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_3leaf_redistrib() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_middle_split + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * split, adding another node to the B-tree, then continues to + * add records until a 3 node split occurs + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: split middle leaf into 2 leaves in level 1 B-tree"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + (INSERT_SPLIT_ROOT_NREC_REC * 2); + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force split from left node into right node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 2); u++) { + record.key = u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 63; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 95; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 128; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC * 3)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_middle_split() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_make_level2 + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to make a level 2 B-tree + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t find; /* Record to find */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic error return value */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: make level 2 B-tree (l->r)"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 internal nodes */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) { + record.key = u + 2; /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) { + record.key = u + 4; /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 1347; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Add some extra records to left-most leaf */ + record.key = 0; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = 1; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to middle leaf */ + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 2; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 3; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4)) + TEST_ERROR + + /* Attempt to find non-existant record in level-2 B-tree */ + /* (Should not be found, but not fail) */ + find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in root of level-2 B-tree */ + find.key = 1347; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (1347 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 1347; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Attempt to find existant record in internal node of level-2 B-tree */ + find.key = 513; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (513 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 513; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Attempt to find existant record in leaf of level-2 B-tree */ + find.key = 555; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (555 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Attempt to index non-existant record in level-2 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in root of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1347, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 1347) + TEST_ERROR + if(find.val != (1347 * 2)) + TEST_ERROR + + /* Attempt to index existing record in internal node of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 513) + TEST_ERROR + if(find.val != (513 * 2)) + TEST_ERROR + + /* Attempt to index existing record in leaf of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 555) + TEST_ERROR + if(find.val != (555 * 2)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: make level 2 B-tree (r->l)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 internal nodes */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) { + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) { + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - (u +2); /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 1344; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Add some extra records to right-most leaf */ + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 2; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 3; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to middle leaf */ + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)); + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 1; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4)) + TEST_ERROR + + /* Attempt to find non-existant record in level-2 B-tree */ + /* (Should not be found, but not fail) */ + find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in root of level-2 B-tree */ + find.key = 1344; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (1344 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 1344; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Attempt to find existant record in internal node of level-2 B-tree */ + find.key = 512; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (512 * 2)) TEST_ERROR - /* Create the v2 B-tree & get its address */ - if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + /* Check with B-tree */ + record.key = 512; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - /* Insert enough records to force root to split into 3 internal nodes */ - /* (and fill right internal node) */ - for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 31); u++) { - record = u; - if(H5B2_insert(bt2, dxpl, &record) < 0) - FAIL_STACK_ERROR - } /* end for */ - for(; u < (INSERT_SPLIT_ROOT_NREC * 74); u++) { - record = u + ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3); - if(H5B2_insert(bt2, dxpl, &record) < 0) - FAIL_STACK_ERROR - } /* end for */ + /* Attempt to find existant record in leaf of level-2 B-tree */ + find.key = 555; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (555 * 2)) + TEST_ERROR - /* Check for closing & re-opening the B-tree */ - if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + /* Check with B-tree */ + record.key = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR - /* Check up on B-tree */ - bt2_stat.depth = 2; - bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 74; - if(check_stats(bt2, &bt2_stat) < 0) + /* Attempt to index non-existant record in level-2 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) TEST_ERROR - record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + + /* Attempt to index existing record in root of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1344, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 1344) TEST_ERROR - record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(find.val != (1344 * 2)) TEST_ERROR - record = 1952; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + + /* Attempt to index existing record in internal node of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)512, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 512) TEST_ERROR - record = 2884; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(find.val != (512 * 2)) TEST_ERROR - record = 2822; /* Record just after insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + + /* Attempt to index existing record in leaf of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 555) + TEST_ERROR + if(find.val != (555 * 2)) TEST_ERROR - /* Insert records to fill up middle internal node */ - for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) { - record = u + (INSERT_SPLIT_ROOT_NREC * 31); - if(H5B2_insert(bt2, dxpl, &record) < 0) + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: make level 2 B-tree (l+r->middle)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 internal nodes */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) { + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 3) - u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) { + record.key = u - ((INSERT_SPLIT_ROOT_NREC_REC * 9) - 2); /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) FAIL_STACK_ERROR } /* end for */ /* Check up on B-tree */ bt2_stat.depth = 2; - bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) - TEST_ERROR - record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) - TEST_ERROR - record = 2789; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) - TEST_ERROR - record = 2822; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + record.key = 1345; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - record = 2823; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) TEST_ERROR + /* Add some extra records to right-most leaf */ + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 4; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 5; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to middle leaf */ + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 2; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 3; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to left-most leaf */ + record.key = 0; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = 1; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + /* Check for closing & re-opening the B-tree */ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) TEST_ERROR - /* Insert record to split middle internal node */ - record = u + (INSERT_SPLIT_ROOT_NREC * 31); - if(H5B2_insert(bt2, dxpl, &record) < 0) + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) FAIL_STACK_ERROR - /* Check up on B-tree */ - bt2_stat.depth = 2; - bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3; - if(check_stats(bt2, &bt2_stat) < 0) + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 6)) TEST_ERROR - record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + + /* Attempt to find non-existant record in level-2 B-tree */ + /* (Should not be found, but not fail) */ + find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) TEST_ERROR - record = 2789; /* Middle record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(find.val != (hsize_t)-1) TEST_ERROR - record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + + /* Attempt to find existant record in root of level-2 B-tree */ + find.key = 1345; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (1345 * 2)) TEST_ERROR -#ifdef NONE - record = 3049; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + + /* Check with B-tree */ + record.key = 1345; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR -#endif /* NONE */ - record = 2822; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + + /* Attempt to find existant record in internal node of level-2 B-tree */ + find.key = 513; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (513 * 2)) TEST_ERROR - record = 2823; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + + /* Check with B-tree */ + record.key = 513; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - /* Check for closing & re-opening the B-tree */ - if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + /* Attempt to find existant record in leaf of level-2 B-tree */ + find.key = 555; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (555 * 2)) TEST_ERROR - /* Iterate over B-tree to check records have been inserted correctly */ - idx = 0; - if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + /* Check with B-tree */ + record.key = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Attempt to index non-existant record in level-2 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1345, index_rec_cb, &find) < 0) FAIL_STACK_ERROR + if(find.key != 1345) + TEST_ERROR + if(find.val != (1345 * 2)) + TEST_ERROR - /* Make certain that the index is correct */ - if(idx != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3)) + /* Attempt to index existing record in internal node of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 513) + TEST_ERROR + if(find.val != (513 * 2)) + TEST_ERROR + + /* Attempt to index existing record in leaf of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 555) + TEST_ERROR + if(find.val != (555 * 2)) TEST_ERROR /* Close the v2 B-tree */ @@ -2730,103 +4959,95 @@ error: H5Fclose(file); } H5E_END_TRY; return 1; -} /* test_insert_level2_3internal_split() */ +} /* test_update_make_level2() */ /*------------------------------------------------------------------------- - * Function: test_insert_lots + * Function: test_update_lots * * Purpose: Basic tests for the B-tree v2 code. This test inserts many * records in random order, enough to make at a level 4 B-tree. * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol - * Saturday, February 19, 2005 + * Sunday, December 27, 2015 * *------------------------------------------------------------------------- */ static unsigned -test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, +test_update_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { hid_t file = -1; /* File ID */ - char filename[1024]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ - hsize_t record; /* Record to insert into tree */ - hsize_t idx; /* Index within B-tree, for iterator */ time_t curr_time; /* Current time, for seeding random number generator */ - hsize_t *records; /* Record #'s for random insertion */ - unsigned u; /* Local index variable */ - unsigned swap_idx; /* Location to swap with when shuffling */ - hsize_t temp_rec; /* Temporary record */ + H5B2_test_rec_t *records; /* Record #'s for random insertion */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t modify; /* Modified value */ + H5B2_test_rec_t find; /* Record to find */ + H5B2_test_rec_t iter; /* Index within B-tree, for iterator */ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ hsize_t nrec; /* Number of records in B-tree */ + unsigned u; /* Local index variable */ herr_t ret; /* Generic error return value */ /* Initialize random number seed */ - curr_time=HDtime(NULL); + curr_time = HDtime(NULL); #ifdef QAK -curr_time=1109170019; -HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); +curr_time = 1451342093; +HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); #endif /* QAK */ HDsrandom((unsigned)curr_time); /* * Test inserting many records into v2 B-tree */ - TESTING("B-tree insert: create random level 4 B-tree"); + TESTING("B-tree update: create random level 4 B-tree"); /* Allocate space for the records */ - if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY))) + if(NULL == (records = (H5B2_test_rec_t *)HDmalloc(sizeof(H5B2_test_rec_t) * INSERT_MANY_REC))) TEST_ERROR /* Initialize record #'s */ - for(u = 0; u < INSERT_MANY; u++) - records[u] = u; + for(u = 0; u < INSERT_MANY_REC; u++) { + records[u].key = u; + records[u].val = u * 2; + } /* end for */ /* Shuffle record #'s */ - for(u = 0; u < INSERT_MANY; u++) { - swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u; + for(u = 0; u < INSERT_MANY_REC; u++) { + H5B2_test_rec_t temp_rec; /* Temporary record */ + unsigned swap_idx; /* Location to swap with when shuffling */ + + swap_idx = ((unsigned)HDrandom() % (INSERT_MANY_REC - u)) + u; temp_rec = records[u]; records[u] = records[swap_idx]; records[swap_idx] = temp_rec; } /* end for */ - /* Set the filename to use for this test (dependent on fapl) */ - h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); - - /* Create the file to work on */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) TEST_ERROR - /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) - STACK_ERROR - - /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) - STACK_ERROR - /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR /* Insert random records */ - for(u = 0; u < INSERT_MANY; u++) { + for(u = 0; u < INSERT_MANY_REC; u++) { record = records[u]; - if(H5B2_insert(bt2, dxpl, &record) < 0) + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) FAIL_STACK_ERROR } /* end for */ /* Check up on B-tree */ bt2_stat.depth = 4; - bt2_stat.nrecords = INSERT_MANY; + bt2_stat.nrecords = INSERT_MANY_REC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR @@ -2838,18 +5059,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Close file */ if(H5Fclose(file) < 0) STACK_ERROR + file = -1; - /* Re-open the file */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR - - /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) - FAIL_STACK_ERROR - - /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) - STACK_ERROR + /* Re-open the file for the test */ + if(reopen_file(&file, &f, fapl) < 0) + TEST_ERROR /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) @@ -2857,87 +5071,110 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Check up on B-tree after re-open */ bt2_stat.depth = 4; - bt2_stat.nrecords = INSERT_MANY; + bt2_stat.nrecords = INSERT_MANY_REC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR /* Iterate over B-tree to check records have been inserted correctly */ - idx = 0; - if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + iter.key = 0; + iter.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &iter) < 0) FAIL_STACK_ERROR /* Make certain that the index is correct */ - if(idx != INSERT_MANY) + if(iter.key != INSERT_MANY_REC) TEST_ERROR /* Attempt to find non-existant record in level-4 B-tree */ /* (Should not be found, but not fail) */ - idx = INSERT_MANY * 2; - if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE) + find.key = INSERT_MANY_REC * 2; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) TEST_ERROR /* Find random records */ - for(u = 0; u < FIND_MANY; u++) { + for(u = 0; u < FIND_MANY_REC; u++) { /* Pick random record */ - idx = (hsize_t)(HDrandom()%INSERT_MANY); + find.key = (hsize_t)(HDrandom() % INSERT_MANY_REC); + find.val = (hsize_t)-1; - /* Attempt to find existant record in root of level-4 B-tree */ - if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE) + /* Attempt to find existant record in level-4 B-tree */ + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) FAIL_STACK_ERROR + if(find.val != (find.key * 2)) + TEST_ERROR } /* end for */ /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) TEST_ERROR H5E_BEGIN_TRY { - ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) TEST_ERROR /* Find random records */ - for(u = 0; u < FIND_MANY; u++) { + for(u = 0; u < FIND_MANY_REC; u++) { + hsize_t idx; /* Record index */ + /* Pick random record */ - idx = (hsize_t)(HDrandom() % INSERT_MANY); + idx = (hsize_t)(HDrandom() % INSERT_MANY_REC); - /* Attempt to find existant record in root of level-4 B-tree */ + /* Reset find record */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + + /* Attempt to find existant record in level-4 B-tree */ /* (in increasing order) */ - if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, find_cb, &idx) < 0) + if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, index_rec_cb, &find) < 0) FAIL_STACK_ERROR + if(find.key != idx) + TEST_ERROR + if(find.val != (find.key * 2)) + TEST_ERROR - /* Attempt to find existant record in root of level-4 B-tree */ + /* Reset find record */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + + /* Attempt to find existant record in level-4 B-tree */ /* (in decreasing order) */ - if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0) + if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, index_rec_cb, &find) < 0) FAIL_STACK_ERROR + if(find.key != (INSERT_MANY_REC - (idx + 1))) + TEST_ERROR + if(find.val != (find.key * 2)) + TEST_ERROR } /* end for */ PASSED(); - TESTING("B-tree insert: attempt duplicate record in level 4 B-tree"); + TESTING("B-tree update: update record in level 4 B-tree"); /* Check for closing & re-opening the B-tree */ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) TEST_ERROR - record = INSERT_MANY / 2; - H5E_BEGIN_TRY { - ret = H5B2_insert(bt2, dxpl, &record); - } H5E_END_TRY; - /* Should fail */ - if(ret != FAIL) - TEST_ERROR + record.key = INSERT_MANY_REC / 2; + modify.key = INSERT_MANY_REC / 2; + modify.val = record.key * 3; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR /* Query the number of records in the B-tree */ if(H5B2_get_nrec(bt2, &nrec) < 0) FAIL_STACK_ERROR /* Make certain that the # of records is correct */ - if(nrec != INSERT_MANY) + if(nrec != INSERT_MANY_REC) TEST_ERROR /* Close the v2 B-tree */ @@ -2956,14 +5193,16 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); return 0; error: + HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2, dxpl); H5Fclose(file); } H5E_END_TRY; HDfree(records); + return 1; -} /* test_insert_lots() */ +} /* test_update_lots() */ /*------------------------------------------------------------------------- @@ -3365,13 +5604,13 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check up on B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC * 2) - 2; - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR rrecord = 0; @@ -3384,10 +5623,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Make certain that the leaf nodes didn't redistribute */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3409,7 +5648,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check up on B-tree */ record = 0; - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR rrecord = 1; @@ -3422,10 +5661,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Make certain that the leaf nodes didn't redistribute */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3447,7 +5686,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check up on B-tree */ record = INSERT_SPLIT_ROOT_NREC; - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR rrecord = 0; @@ -3460,10 +5699,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Make certain that the leaf nodes didn't redistribute */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3545,10 +5784,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3593,10 +5832,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 90; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR PASSED(); @@ -3629,10 +5868,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 64; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 90; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR PASSED(); @@ -3665,10 +5904,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 64; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 91; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -3742,7 +5981,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -3815,7 +6054,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -3921,7 +6160,7 @@ test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4047,13 +6286,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 125; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4093,13 +6332,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 125; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4139,13 +6378,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 63; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 125; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4181,13 +6420,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 63; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 126; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4274,7 +6513,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4335,7 +6574,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4422,7 +6661,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4483,7 +6722,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 39; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4570,7 +6809,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4715,7 +6954,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4999,7 +7238,7 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5285,7 +7524,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t * /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5435,7 +7674,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t * /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5585,7 +7824,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5736,7 +7975,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5887,7 +8126,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -6013,7 +8252,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -6139,7 +8378,7 @@ test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -6266,7 +8505,7 @@ test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -7750,7 +9989,7 @@ error: int main(void) { - H5B2_create_t cparam; /* Creation parameters for v2 B-tree */ + H5B2_create_t cparam, cparam2; /* Creation parameters for v2 B-tree */ bt2_test_param_t tparam; /* Test parameters for v2 B-tree */ hid_t fapl = -1; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ @@ -7770,8 +10009,7 @@ main(void) printf("***Express test mode on. Some tests may be skipped\n"); /* Initialize v2 B-tree creation parameters */ - init_cparam(&cparam); - + init_cparam(&cparam, &cparam2); /* Loop over re-opening B-tree during tests */ for(reopen = FALSE; reopen <= TRUE; reopen++) { @@ -7785,7 +10023,7 @@ main(void) } /* end else */ /* Test B-tree record insertion */ - /* Iteration, find & index routines tested in these routines as well */ + /* (Iteration, find & index routines exercised in these routines as well) */ nerrors += test_insert_basic(fapl, &cparam, &tparam); nerrors += test_insert_split_root(fapl, &cparam, &tparam); nerrors += test_insert_level1_2leaf_redistrib(fapl, &cparam, &tparam); @@ -7804,6 +10042,20 @@ main(void) else nerrors += test_insert_lots(fapl, &cparam, &tparam); + /* Test B-tree record update (ie. insert/modify) */ + /* (Iteration, find & index routines exercised in these routines as well) */ + nerrors += test_update_basic(fapl, &cparam2, &tparam); + nerrors += test_update_split_root(fapl, &cparam2, &tparam); + nerrors += test_update_level1_2leaf_redistrib(fapl, &cparam2, &tparam); + nerrors += test_update_level1_side_split(fapl, &cparam2, &tparam); + nerrors += test_update_level1_3leaf_redistrib(fapl, &cparam2, &tparam); + nerrors += test_update_level1_middle_split(fapl, &cparam2, &tparam); + nerrors += test_update_make_level2(fapl, &cparam2, &tparam); + if(ExpressMode > 1) + printf("***Express test mode on. test_update_lots skipped\n"); + else + nerrors += test_update_lots(fapl, &cparam2, &tparam); + /* Test B-tree record removal */ /* Querying the number of records routine also tested in these routines as well */ nerrors += test_remove_basic(fapl, &cparam, &tparam); diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index aac14db..b4cbfee 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -129,6 +129,10 @@ get_H5B2_class(const uint8_t *sig) cls = H5D_BT2_FILT; break; + case H5B2_TEST2_ID: + cls = H5B2_TEST2; + break; + case H5B2_NUM_BTREE_ID: default: HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype)); -- cgit v0.12 From 9b9b8e383e8bad502594a9d8be6c80b15b8c6b08 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 29 Dec 2015 16:05:03 -0500 Subject: [svn-r28746] Description: Now that v2 B-trees can perform 'update' operations, remove 'need_modify' flag from chunk information and switch v2 B-tree chunk index to use update operation. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5B2int.c | 4 ---- src/H5Dbtree2.c | 31 ++++++++++++++++++------------- src/H5Dchunk.c | 38 +++++++++++++------------------------- src/H5Dpkg.h | 1 - test/btree2.c | 2 +- 5 files changed, 32 insertions(+), 44 deletions(-) diff --git a/src/H5B2int.c b/src/H5B2int.c index 251080d..972b91c 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -880,10 +880,6 @@ done: if(right_child && H5AC_unprotect(hdr->f, dxpl_id, child_class, right_addr, right_child, right_child_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") - /* Release grandchild node if protected (only on error) */ - if(grandchild && H5AC_unprotect(hdr->f, dxpl_id, grandchild_class, left_node_ptrs[u].addr, grandchild, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - /* Unprotect the grandchild on error */ if(grandchild) { HDassert(ret_value < 0); diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index f286db2..99dac25 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -963,9 +963,23 @@ H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage) static herr_t H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed) { + H5D_bt2_ud_t *op_data = (H5D_bt2_ud_t *)_op_data; /* User data for v2 B-tree calls */ + H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* Chunk record */ + FUNC_ENTER_STATIC_NOERR - *(H5D_chunk_rec_t *)_record = *(H5D_chunk_rec_t *)_op_data; +/* Sanity check */ +#ifndef NDEBUG +{ + unsigned u; /* Local index variable */ + + for(u = 0; u < op_data->ndims; u++) + HDassert(record->scaled[u] == op_data->rec.scaled[u]); +} +#endif /* NDEBUG */ + + /* Modify record */ + *record = op_data->rec; /* Note that the record changed */ *changed = TRUE; @@ -1036,18 +1050,9 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, for(u = 0; u < (idx_info->layout->ndims - 1); u++) bt2_udata.rec.scaled[u] = udata->common.scaled[u]; - if(udata->need_modify) { - HDassert(idx_info->pline->nused > 0); - - /* Modify record for v2 B-tree */ - if(H5B2_modify(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata.rec) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree") - } /* end if */ - else { - /* Insert record for object in v2 B-tree */ - if(H5B2_insert(bt2, idx_info->dxpl_id, &bt2_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "couldn't insert record in v2 B-tree") - } /* end else */ + /* Update record for v2 B-tree (could be insert or modify) */ + if(H5B2_update(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 7b5df07..b1073ab 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -268,7 +268,7 @@ static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk); static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert, - hbool_t *need_bt2_modify, hsize_t scaled[]); + hsize_t scaled[]); #ifdef H5_HAVE_PARALLEL static herr_t H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, H5D_chunk_coll_info_t *chunk_info, size_t chunk_size, const void *fill_buf); @@ -401,7 +401,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, &udata.need_modify, scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") /* Make sure the address of the chunk is returned. */ @@ -428,7 +428,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ - if((need_insert || udata.need_modify) && layout->storage.u.chunk.ops->insert) { + if(need_insert && layout->storage.u.chunk.ops->insert) { /* Set the chunk's filter mask to the new settings */ udata.filter_mask = filters; @@ -2105,7 +2105,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size; /* Allocate the chunk */ - if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, &udata.need_modify, chunk_info->scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Make sure the address of the chunk is returned. */ @@ -2137,7 +2137,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") } /* end if */ else { - if((need_insert || udata.need_modify) && io_info->dset->shared->layout.storage.u.chunk.ops->insert) + if(need_insert && io_info->dset->shared->layout.storage.u.chunk.ops->insert) if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") } /* end else */ @@ -2605,7 +2605,6 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, udata->chunk_block.length = 0; udata->filter_mask = 0; udata->new_unfilt_chunk = FALSE; - udata->need_modify = FALSE; /* Check for chunk in cache */ if(dset->shared->cache.chunk.nslots > 0) { @@ -2703,7 +2702,6 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t udata.chunk_block.length = dset->shared->layout.u.chunk.size; udata.filter_mask = 0; udata.chunk_idx = ent->chunk_idx; - udata.need_modify = FALSE; /* Should the chunk be filtered before writing it to disk? */ if(dset->shared->dcpl_cache.pline.nused @@ -2781,7 +2779,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert, &udata.need_modify, ent->scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert, ent->scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Update the chunk entry's info, in case it was allocated or relocated */ @@ -2796,7 +2794,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ - if((need_insert || udata.need_modify) && dset->shared->layout.storage.u.chunk.ops->insert) + if(need_insert && dset->shared->layout.storage.u.chunk.ops->insert) if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") @@ -3957,10 +3955,9 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, udata.chunk_block.offset = HADDR_UNDEF; H5_CHECKED_ASSIGN(udata.chunk_block.length, uint32_t, chunk_size, size_t); udata.filter_mask = filter_mask; - udata.need_modify = FALSE; /* Allocate the chunk (with all processes) */ - if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, &udata.need_modify, scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") HDassert(H5F_addr_defined(udata.chunk_block.offset)); @@ -3997,7 +3994,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end if */ /* Insert the chunk record into the index */ - if((need_insert || udata.need_modify) && ops->insert) + if(need_insert && ops->insert) if((ops->insert)(&idx_info, &udata, dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") @@ -5420,7 +5417,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata_dst.common.layout->down_chunks, udata_dst.common.scaled); /* Allocate chunk in the file */ - if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert, &udata_dst.need_modify, udata_dst.common.scaled) < 0) + if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert, udata_dst.common.scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Write chunk data to destination file */ @@ -5432,7 +5429,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5_BEGIN_TAG(udata->idx_info_dst->dxpl_id, H5AC__COPIED_TAG, H5_ITER_ERROR); /* Insert chunk record into index */ - if((need_insert || udata_dst.need_modify) && udata->idx_info_dst->storage->ops->insert) + if(need_insert && udata->idx_info_dst->storage->ops->insert) if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst, NULL) < 0) HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk addr into index") @@ -6113,7 +6110,7 @@ done: */ static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, - H5F_block_t *new_chunk, hbool_t *need_insert, hbool_t *need_modify, hsize_t scaled[]) + H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]) { hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ herr_t ret_value = SUCCEED; /* Return value */ @@ -6128,9 +6125,7 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old HDassert(idx_info->storage); HDassert(new_chunk); HDassert(need_insert); - HDassert(need_modify); - *need_modify = FALSE; /* this is mainly for V2-btree */ *need_insert = FALSE; /* Check for filters on chunks */ @@ -6174,7 +6169,6 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, old_chunk->offset, old_chunk->length) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") alloc_chunk = TRUE; - *need_modify = TRUE; } /* end if */ else { /* Don't need to reallocate chunk, but send its address back up */ @@ -6218,13 +6212,7 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length); if(!H5F_addr_defined(new_chunk->offset)) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") - if(idx_info->storage->idx_type == H5D_CHUNK_IDX_BT2) { - /* This can be done together with other index types when Quincy checks into H5B2_modify() */ - if(!(*need_modify)) - *need_insert = TRUE; - } else - *need_insert = TRUE; - + *need_insert = TRUE; break; case H5D_CHUNK_IDX_NTYPES: diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index fe38dd4..ad16003 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -288,7 +288,6 @@ typedef struct H5D_chunk_ud_t { unsigned filter_mask; /*excluded filters */ hbool_t new_unfilt_chunk; /*whether the chunk just became unfiltered */ hsize_t chunk_idx; /*chunk index for EA, FA indexing */ - hbool_t need_modify; } H5D_chunk_ud_t; /* Typedef for "generic" chunk callbacks */ diff --git a/test/btree2.c b/test/btree2.c index 04c94fd..8a08d3d 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2600 * 1000) +#define INSERT_MANY_REC (2610 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 -- cgit v0.12 From a93b688efb56a779faf1453d98567cf03a8e14b8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 30 Dec 2015 13:49:03 -0500 Subject: [svn-r28755] Description: Minor cleanups, and remove debugging context create/destroy callbacks from dataset v2 B-tree class structures. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Dbtree2.c | 135 ++++++-------------------------------------------------- src/H5Dchunk.c | 114 ++++++++++++++++++++++++----------------------- src/H5Dpkg.h | 12 ++--- 3 files changed, 77 insertions(+), 184 deletions(-) diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index 99dac25..2aa4701 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -90,8 +90,6 @@ static void *H5D__bt2_crt_context(void *udata); static herr_t H5D__bt2_dst_context(void *ctx); static herr_t H5D__bt2_store(void *native, const void *udata); static herr_t H5D__bt2_compare(const void *rec1, const void *rec2); -static void *H5D__bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); -static herr_t H5D__bt2_dst_dbg_context(void *_u_ctx); /* v2 B-tree class for indexing non-filtered chunked datasets */ static herr_t H5D__bt2_unfilt_encode(uint8_t *raw, const void *native, void *ctx); @@ -189,9 +187,7 @@ const H5B2_class_t H5D_BT2[1] = {{ /* B-tree class information */ H5D__bt2_compare, /* Record comparison callback */ H5D__bt2_unfilt_encode, /* Record encoding callback */ H5D__bt2_unfilt_decode, /* Record decoding callback */ - H5D__bt2_unfilt_debug, /* Record debugging callback */ - H5D__bt2_crt_dbg_context, /* Create debugging context */ - H5D__bt2_dst_dbg_context /* Destroy debugging context */ + H5D__bt2_unfilt_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing filtered chunked datasets */ @@ -205,9 +201,7 @@ const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */ H5D__bt2_compare, /* Record comparison callback */ H5D__bt2_filt_encode, /* Record encoding callback */ H5D__bt2_filt_decode, /* Record decoding callback */ - H5D__bt2_filt_debug, /* Record debugging callback */ - H5D__bt2_crt_dbg_context, /* Create debugging context */ - H5D__bt2_dst_dbg_context /* Destroy debugging context */ + H5D__bt2_filt_debug /* Record debugging callback */ }}; @@ -377,110 +371,6 @@ H5D__bt2_compare(const void *_udata, const void *_rec2) /*------------------------------------------------------------------------- - * Function: H5D__bt2_crt_dbg_context - * - * Purpose: Create user data for debugged callback context - * - * Return: Success: non-NULL - * Failure: NULL - * - * Programmer: Vailin Choi; June 2010 - * - *------------------------------------------------------------------------- - */ -static void * -H5D__bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t obj_addr) -{ - H5D_bt2_ctx_ud_t *u_ctx = NULL; /* User data for creating callback context */ - H5O_loc_t obj_loc; /* Pointer to an object's location */ - hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */ - H5O_layout_t layout; /* Layout message */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(f); - HDassert(H5F_addr_defined(obj_addr)); - - /* Set up the object header location info */ - H5O_loc_reset(&obj_loc); - obj_loc.file = f; - obj_loc.addr = obj_addr; - - /* Open the object header where the layout message resides */ - if(H5O_open(&obj_loc) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header") - obj_opened = TRUE; - - /* Read the layout message */ - if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info") - - /* close the object header */ - if(H5O_close(&obj_loc) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") - - /* Allocate structure for storing user data to create callback context */ - if(NULL == (u_ctx = H5FL_MALLOC(H5D_bt2_ctx_ud_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate user data context structure ") - - /* Set information for context structure */ - u_ctx->f = f; - u_ctx->chunk_size = layout.u.chunk.size; - u_ctx->ndims = layout.u.chunk.ndims - 1; - - /* Set return value */ - ret_value = u_ctx; - -done: - /* Cleanup on error */ - if(ret_value == NULL) { - /* Release context structure */ - if(u_ctx) - u_ctx = H5FL_FREE(H5D_bt2_ctx_ud_t, u_ctx); - - /* Close object header */ - if(obj_opened) { - if(H5O_close(&obj_loc) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") - } /* end if */ - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__bt2_crt_dbg_context() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__bt2_dst_dbg_context - * - * Purpose: Destroy client callback context - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Vailin Choi; June 2010 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__bt2_dst_dbg_context(void *_u_ctx) -{ - H5D_bt2_ctx_ud_t *u_ctx = (H5D_bt2_ctx_ud_t *)_u_ctx; /* User data for creating callback context */ - - FUNC_ENTER_STATIC_NOERR - - /* Sanity check */ - HDassert(u_ctx); - - /* Release user data for creating callback context */ - u_ctx = H5FL_FREE(H5D_bt2_ctx_ud_t, u_ctx); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5D__bt2_dst_dbg_context() */ - - -/*------------------------------------------------------------------------- * Function: H5D__bt2_unfilt_encode * * Purpose: Encode native information into raw form for storing on disk @@ -565,23 +455,24 @@ H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx) */ static herr_t H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, - const void *_record, const void *_u_ctx) + const void *_record, const void *_ctx) { const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ - const H5D_bt2_ctx_ud_t *u_ctx = (const H5D_bt2_ctx_ud_t *)_u_ctx; /* User data for creating callback context */ + const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */ unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(record); - HDassert(u_ctx->chunk_size == record->nbytes); + HDassert(ctx->chunk_size == record->nbytes); HDassert(0 == record->filter_mask); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); - for(u = 0; u < u_ctx->ndims; u++) - HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * u_ctx->dim[u]); + for(u = 0; u < ctx->ndims; u++) + HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -671,7 +562,7 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx) /*------------------------------------------------------------------------- * Function: H5D__bt2_filt_debug * - * Purpose: Debug native form of record (filterd) + * Purpose: Debug native form of record (filtered) * * Return: Success: non-negative * Failure: negative @@ -682,10 +573,10 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx) */ static herr_t H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, - const void *_record, const void *_u_ctx) + const void *_record, const void *_ctx) { const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ - const H5D_bt2_ctx_ud_t *u_ctx = (const H5D_bt2_ctx_ud_t *)_u_ctx; /* User data for creating callback context */ + const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */ unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -700,8 +591,8 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); - for(u = 0; u < u_ctx->ndims; u++) - HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * u_ctx->dim[u]); + for(u = 0; u < ctx->ndims; u++) + HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index b1073ab..0f6504a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -261,13 +261,13 @@ static herr_t H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t reset); static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t flush); -static hbool_t H5D__chunk_is_partial_edge_chunk(const hsize_t *chunk_scaled, - unsigned dset_ndims, const hsize_t *dset_dims, const uint32_t *chunk_dims); +static hbool_t H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, + const uint32_t *chunk_dims, const hsize_t *chunk_scaled, const hsize_t *dset_dims); static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size); static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk); static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, - const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert, + const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]); #ifdef H5_HAVE_PARALLEL static herr_t H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, @@ -1763,11 +1763,12 @@ htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op) { const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ - hbool_t no_filters = TRUE; + hbool_t has_filters = FALSE; /* Whether there are filters on the chunk or not */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE + /* Sanity check */ HDassert(io_info); HDassert(dataset); @@ -1777,16 +1778,19 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_ if(dataset->shared->dcpl_cache.pline.nused > 0) { if(dataset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { - no_filters = H5D__chunk_is_partial_edge_chunk( - io_info->store->chunk.scaled, io_info->dset->shared->ndims, - io_info->dset->shared->curr_dims, - io_info->dset->shared->layout.u.chunk.dim); + has_filters = !H5D__chunk_is_partial_edge_chunk( + io_info->dset->shared->ndims, + io_info->dset->shared->layout.u.chunk.dim, + io_info->store->chunk.scaled, + io_info->dset->shared->curr_dims); } /* end if */ else - no_filters = FALSE; + has_filters = TRUE; } /* end if */ - if(no_filters) { + if(has_filters) + ret_value = TRUE; + else { #ifdef H5_HAVE_PARALLEL /* If MPI based VFD is used and the file is opened for write access, must * bypass the chunk-cache scheme because other MPI processes could @@ -1827,9 +1831,7 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_ #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ - } /* end if */ - else - ret_value = TRUE; + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2582,13 +2584,14 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_chunk_ud_t *udata) { H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ - hbool_t found = FALSE; /* In cache? */ - unsigned u; /* Counter */ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); - herr_t ret_value = SUCCEED; /* Return value */ + unsigned idx; /* Index of chunk in cache, if present */ + hbool_t found = FALSE; /* In cache? */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE + /* Sanity checks */ HDassert(dset); HDassert(dset->shared->layout.u.chunk.ndims > 0); H5D_CHUNK_STORAGE_INDEX_CHK(sc); @@ -2598,7 +2601,7 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, /* Initialize the query information about the chunk we are looking for */ udata->common.layout = &(dset->shared->layout.u.chunk); udata->common.storage = &(dset->shared->layout.storage.u.chunk); - udata->common.scaled = scaled; + udata->common.scaled = scaled; /* Reset information about the chunk we are looking for */ udata->chunk_block.offset = HADDR_UNDEF; @@ -2608,19 +2611,29 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, /* Check for chunk in cache */ if(dset->shared->cache.chunk.nslots > 0) { - udata->idx_hint = H5D__chunk_hash_val(dset->shared, scaled); - ent = dset->shared->cache.chunk.slot[udata->idx_hint]; + /* Determine the chunk's location in the hash table */ + idx = H5D__chunk_hash_val(dset->shared, scaled); + + /* Get the chunk cache entry for that location */ + ent = dset->shared->cache.chunk.slot[idx]; + if(ent) { + unsigned u; /* Counter */ + + /* Speculatively set the 'found' flag */ + found = TRUE; - if(ent) - for(u = 0, found = TRUE; u < dset->shared->ndims; u++) + /* Verify that the cache entry is the correct chunk */ + for(u = 0; u < dset->shared->ndims; u++) if(scaled[u] != ent->scaled[u]) { found = FALSE; break; } /* end if */ + } /* end if */ } /* end if */ - /* Find chunk addr */ + /* Retrieve chunk addr */ if(found) { + udata->idx_hint = idx; udata->chunk_block.offset = ent->chunk_block.offset; udata->chunk_block.length = ent->chunk_block.length;; udata->chunk_idx = ent->chunk_idx; @@ -3222,9 +3235,9 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, else if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { /* Check if this is an edge chunk */ - if(H5D__chunk_is_partial_edge_chunk( - io_info->store->chunk.scaled, io_info->dset->shared->ndims, - io_info->dset->shared->curr_dims, layout->u.chunk.dim)) { + if(H5D__chunk_is_partial_edge_chunk(io_info->dset->shared->ndims, + layout->u.chunk.dim, io_info->store->chunk.scaled, + io_info->dset->shared->curr_dims)) { /* Disable the filters for both writing and reading */ disable_filters = TRUE; old_pline = NULL; @@ -3232,8 +3245,6 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, } /* end if */ } /* end if */ } /* end if */ - else - HDassert(!udata->new_unfilt_chunk && !prev_unfilt_chunk); if(relax) { /* @@ -3461,6 +3472,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, FUNC_ENTER_PACKAGE + /* Sanity check */ HDassert(io_info); HDassert(udata); @@ -3468,24 +3480,20 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, /* * It's not in the cache, probably because it's too big. If it's * dirty then flush it to disk. In any case, free the chunk. - * Note: we have to copy the layout and filter messages so we - * don't discard the `const' qualifier. */ hbool_t is_unfiltered_edge_chunk = FALSE; /* Whether the chunk is an unfiltered edge chunk */ /* Check if we should disable filters on this chunk */ if(udata->new_unfilt_chunk) { - HDassert(layout->u.chunk.flags - & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); is_unfiltered_edge_chunk = TRUE; } /* end if */ - else if(layout->u.chunk.flags - & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { + else if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { /* Check if the chunk is an edge chunk, and disable filters if so */ is_unfiltered_edge_chunk = H5D__chunk_is_partial_edge_chunk( - io_info->store->chunk.scaled, io_info->dset->shared->ndims, - io_info->dset->shared->curr_dims, layout->u.chunk.dim); + io_info->dset->shared->ndims, layout->u.chunk.dim, + io_info->store->chunk.scaled, io_info->dset->shared->curr_dims); } /* end if */ if(dirty) { @@ -3498,7 +3506,6 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, if(udata->new_unfilt_chunk) fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); - HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); HDassert(layout->u.chunk.size > 0); fake_ent.chunk_idx = udata->chunk_idx; fake_ent.chunk_block.offset = udata->chunk_block.offset; @@ -4014,7 +4021,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, && scaled[i] < edge_chunk_scaled[i]) { nunfilt_edge_chunk_dims--; if(should_fill && nunfilt_edge_chunk_dims == 0 && !fb_info.has_vlen_fill_type) { - HDassert(!H5D__chunk_is_partial_edge_chunk(scaled, space_ndims, space_dim, chunk_dim)); + HDassert(!H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim)); fill_buf = &fb_info.fill_buf; chunk_size = orig_chunk_size; } /* end if */ @@ -4026,7 +4033,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, HDassert(edge_chunk_scaled[i] == max_unalloc[i]); nunfilt_edge_chunk_dims++; if(should_fill && nunfilt_edge_chunk_dims == 1 && !fb_info.has_vlen_fill_type) { - HDassert(H5D__chunk_is_partial_edge_chunk(scaled, space_ndims, space_dim, chunk_dim)); + HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim)); fill_buf = &unfilt_fill_buf; chunk_size = layout->u.chunk.size; } /* end if */ @@ -4200,8 +4207,8 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hid_t dxpl_id, hsize_t old_dim[]) int i; /* Local index variable */ /* Make sure the chunk is really a former edge chunk */ - HDassert(H5D__chunk_is_partial_edge_chunk(chunk_sc, space_ndims, old_dim, chunk_dim) - && !H5D__chunk_is_partial_edge_chunk(chunk_sc, space_ndims, space_dim, chunk_dim)); + HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, old_dim) + && !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, space_dim)); /* Lookup the chunk */ if(H5D__chunk_lookup(dset, dxpl_id, chunk_sc, &chk_udata) < 0) @@ -4742,7 +4749,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Determine if partial edge chunk filters are disabled */ disable_edge_filters = (layout->u.chunk.flags - & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && (idx_info.pline->nused > 0); /* @@ -4776,8 +4783,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* If necessary, check if chunks in this dimension that need to * be filled are new partial edge chunks */ - if(disable_edge_filters && old_dim[op_dim] - >= (min_mod_chunk_sc[op_dim] + 1)) + if(disable_edge_filters && old_dim[op_dim] >= (min_mod_chunk_sc[op_dim] + 1)) new_unfilt_dim[op_dim] = TRUE; else new_unfilt_dim[op_dim] = FALSE; @@ -4837,8 +4843,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HDassert(scaled[op_dim] == min_mod_chunk_sc[op_dim]); /* Make sure this is an edge chunk */ - HDassert(H5D__chunk_is_partial_edge_chunk(scaled, - space_ndims, space_dim, layout->u.chunk.dim)); + HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, space_dim)); /* Determine if the chunk just became an unfiltered chunk */ if(new_unfilt_dim[op_dim]) { @@ -4853,8 +4858,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Make sure that, if we think this is a new unfiltered chunk, * it was previously not an edge chunk */ HDassert(!new_unfilt_dim[op_dim] || (!new_unfilt_chunk != - !H5D__chunk_is_partial_edge_chunk(scaled, - space_ndims, old_dim, layout->u.chunk.dim))); + !H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, old_dim))); HDassert(!new_unfilt_chunk || new_unfilt_dim[op_dim]); /* Fill the unused parts of the chunk */ @@ -5300,8 +5304,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if(udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { /* Check if the chunk is an edge chunk, and disable filters if so */ - if(!H5D__chunk_is_partial_edge_chunk(chunk_rec->scaled, udata->dset_ndims, - udata->dset_dims, udata->common.layout->dim)) + if(!H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) must_filter = TRUE; } /* end if */ else @@ -6070,8 +6073,8 @@ done: *------------------------------------------------------------------------- */ static hbool_t -H5D__chunk_is_partial_edge_chunk(const hsize_t scaled[], unsigned dset_ndims, - const hsize_t *dset_dims, const uint32_t *chunk_dims) +H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims, + const hsize_t scaled[], const hsize_t *dset_dims) { unsigned u; /* Local index variable */ hbool_t ret_value = FALSE; /* Return value */ @@ -6130,9 +6133,8 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { - - HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE); /* Sanity/error checking block */ + HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE); { unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */ unsigned new_chunk_size_len; /* Size of encoded chunk size */ @@ -6228,6 +6230,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D__chunk_file_alloc() */ + /*------------------------------------------------------------------------- * Function: H5D__chunk_format_convert_cb * @@ -6259,9 +6262,8 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) chunk_addr = chunk_rec->chunk_addr; if(new_idx_info->pline->nused && - (new_idx_info->layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && - (H5D__chunk_is_partial_edge_chunk(chunk_rec->scaled, udata->dset_ndims, udata->dset_dims, - new_idx_info->layout->dim)) ) { + (new_idx_info->layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && + (H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, new_idx_info->layout->dim, chunk_rec->scaled, udata->dset_dims))) { /* This is a partial non-filtered edge chunk */ /* Convert the chunk to a filtered edge chunk for v1 B-tree chunk index */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index ad16003..46f2ba9 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -272,7 +272,6 @@ typedef struct H5D_chunk_rec_t { * to which the index points. */ typedef struct H5D_chunk_common_ud_t { - /* downward */ const H5O_layout_chunk_t *layout; /* Chunk layout description */ const H5O_storage_chunk_t *storage; /* Chunk storage description */ const hsize_t *scaled; /* Scaled coordinates for a chunk */ @@ -280,14 +279,15 @@ typedef struct H5D_chunk_common_ud_t { /* B-tree callback info for various operations */ typedef struct H5D_chunk_ud_t { + /* Downward */ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */ /* Upward */ - unsigned idx_hint; /*index of chunk in cache, if present */ - H5F_block_t chunk_block; /*offset/length of chunk in file */ - unsigned filter_mask; /*excluded filters */ - hbool_t new_unfilt_chunk; /*whether the chunk just became unfiltered */ - hsize_t chunk_idx; /*chunk index for EA, FA indexing */ + unsigned idx_hint; /* Index of chunk in cache, if present */ + H5F_block_t chunk_block; /* Offset/length of chunk in file */ + unsigned filter_mask; /* Excluded filters */ + hbool_t new_unfilt_chunk; /* Whether the chunk just became unfiltered */ + hsize_t chunk_idx; /* Chunk index for EA, FA indexing */ } H5D_chunk_ud_t; /* Typedef for "generic" chunk callbacks */ -- cgit v0.12 From aa047685a9acbdc73d2dc79962a984ed53b28128 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 1 Jan 2016 01:43:47 -0500 Subject: [svn-r28762] Description: Bring r28761 from the trunk to the revise_chunks branch. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- fortran/src/H5Pf.c | 2 +- src/H5.c | 5 +- src/H5L.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++----- src/H5Lprivate.h | 2 + src/H5Ocopy.c | 24 ++----- src/H5TS.c | 17 +++-- src/H5Tvlen.c | 8 +-- src/H5Ztrans.c | 4 +- test/btree2.c | 2 +- test/dtypes.c | 99 +++++++++++++++++++++++++--- test/fheap.c | 10 +-- test/file_image.c | 4 +- test/links.c | 57 ++++++++++------ test/objcopy.c | 150 ++++++++++++++++++++++++++++++++++++------ test/tgenprop.c | 4 +- test/tmisc.c | 16 ++++- test/tvlstr.c | 11 ++-- tools/h5ls/h5ls.c | 5 +- 18 files changed, 483 insertions(+), 123 deletions(-) diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 523ed0b..3989512 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -5273,7 +5273,7 @@ h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr) *buf_len_ptr=(size_t_f)c_buf_len_ptr; ret_value = 0; - if(c_buf_ptr) HDfree(c_buf_ptr); + if(c_buf_ptr) H5free_memory(c_buf_ptr); return ret_value; } diff --git a/src/H5.c b/src/H5.c index 33ac340..2086ce8 100644 --- a/src/H5.c +++ b/src/H5.c @@ -942,7 +942,6 @@ H5allocate_memory(size_t size, hbool_t clear) ret_value = H5MM_malloc(size); FUNC_LEAVE_API(ret_value) - } /* end H5allocate_memory() */ @@ -981,7 +980,6 @@ H5resize_memory(void *mem, size_t size) ret_value = H5MM_realloc(mem, size); FUNC_LEAVE_API(ret_value) - } /* end H5resize_memory() */ @@ -1004,10 +1002,9 @@ H5free_memory(void *mem) H5TRACE1("e", "*x", mem); /* At this time, it is impossible for this to fail. */ - HDfree(mem); + H5MM_xfree(mem); FUNC_LEAVE_API(SUCCEED) - } /* end H5free_memory() */ diff --git a/src/H5L.c b/src/H5L.c index a1f3b6e..9daf948 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -93,6 +93,17 @@ typedef struct { hid_t dxpl_id; /* Dataset transfer property list */ } H5L_trav_mv2_t; +/* User data for path traversal routine for checking if a link exists */ +typedef struct { + /* Down */ + char *sep; /* Pointer to next separator in the string */ + hid_t lapl_id; /* Link access property list */ + hid_t dxpl_id; /* Dataset transfer property list */ + + /* Up */ + hbool_t exists; /* Whether the link exists or not */ +} H5L_trav_le_t; + /* User data for path traversal routine for getting link value */ typedef struct { size_t size; /* Size of user buffer */ @@ -170,10 +181,13 @@ static herr_t H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_exists_cb(H5G_loc_t *grp_loc/*in*/, const char *name, +static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, + H5G_own_loc_t *own_loc/*out*/); +static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, +static htri_t H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id); static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, @@ -827,7 +841,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check for the existence of the link */ - if((ret_value = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5L__exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -2716,9 +2730,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_exists_cb + * Function: H5L__exists_final_cb * - * Purpose: Callback for checking whether a link exists + * Purpose: Callback for checking whether a link exists, as the final + * component of a path * * Return: Non-negative on success/Negative on failure * @@ -2728,30 +2743,162 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, +H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { - hbool_t *udata = (hbool_t *)_udata; /* User data passed in */ + H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check if the name in this group resolved to a valid link */ - *udata = (hbool_t)(lnk != NULL); + udata->exists = (hbool_t)(lnk != NULL); /* Indicate that this callback didn't take ownership of the group * * location for the object */ *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5L_exists_cb() */ +} /* end H5L__exists_final_cb() */ /*------------------------------------------------------------------------- - * Function: H5L_exists + * Function: H5L__exists_inter_cb + * + * Purpose: Callback for checking whether a link exists, as an intermediate + * component of a path + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, December 31 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, + H5G_own_loc_t *own_loc/*out*/) +{ + H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if(lnk != NULL) { + /* Check for more components to the path */ + if(udata->sep) { + H5G_traverse_t cb_func; /* Callback function for tranversal */ + char *next; /* Pointer to next component name */ + + /* Look for another separator */ + next = udata->sep; + if(NULL == (udata->sep = HDstrchr(udata->sep, '/'))) + cb_func = H5L__exists_final_cb; + else { + /* Chew through adjacent separators, if present */ + do { + *udata->sep = '\0'; + udata->sep++; + } while('/' == *udata->sep); + cb_func = H5L__exists_inter_cb; + } /* end else */ + if(H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata, udata->lapl_id, udata->dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine if link exists") + } /* end if */ + else + udata->exists = TRUE; + } /* end if */ + else + udata->exists = FALSE; + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__exists_inter_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5L_exists_tolerant * * Purpose: Returns whether a link exists in a group * + * Note: Same as H5L_exists, except that missing links are reported + * as 'FALSE' instead of causing failures + * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, December 31 2015 + * + *------------------------------------------------------------------------- + */ +htri_t +H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) +{ + H5L_trav_le_t udata; /* User data for traversal */ + H5G_traverse_t cb_func; /* Callback function for tranversal */ + char *name_copy = NULL; /* Duplicate of name */ + char *name_trav; /* Name to traverse */ + htri_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(loc); + HDassert(name); + + /* Copy the name and skip leading '/'s */ + name_trav = name_copy = H5MM_strdup(name); + while('/' == *name_trav) + name_trav++; + + /* A path of "/" will always exist in a file */ + if('\0' == *name_trav) + HGOTO_DONE(TRUE) + + /* Set up user data & correct callback */ + udata.lapl_id = lapl_id; + udata.dxpl_id = dxpl_id; + udata.exists = FALSE; + if(NULL == (udata.sep = HDstrchr(name_trav, '/'))) + cb_func = H5L__exists_final_cb; + else { + /* Chew through adjacent separators, if present */ + do { + *udata.sep = '\0'; + udata.sep++; + } while('/' == *udata.sep); + cb_func = H5L__exists_inter_cb; + } /* end else */ + + /* Traverse the group hierarchy to locate the link to check */ + if(H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata, lapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine if link exists") + + /* Set return value */ + ret_value = (htri_t)udata.exists; + +done: + /* Release duplicated string */ + H5MM_xfree(name_copy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5L_exists_tolerant() */ + + +/*------------------------------------------------------------------------- + * Function: H5L__exists + * + * Purpose: Returns whether a link exists in a group + * + * Note: Same as H5L_exists_tolerant, except that missing links are reported + * as failures + * * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol @@ -2760,23 +2907,28 @@ H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static htri_t -H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) +H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { - hbool_t exists = FALSE; /* Whether the link exists in the group */ + H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + + /* A path of "/" will always exist in a file */ + if(0 == HDstrcmp(name, "/")) + HGOTO_DONE(TRUE) /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_exists_cb, &exists, lapl_id, dxpl_id) < 0) + udata.exists = FALSE; + if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "path doesn't exist") /* Set return value */ - ret_value = (htri_t)exists; + ret_value = (htri_t)udata.exists; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_exists() */ +} /* H5L__exists() */ /*------------------------------------------------------------------------- diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index f3079bc..1c8690b 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -81,6 +81,8 @@ H5_DLL hid_t H5L_get_default_lcpl(void); H5_DLL herr_t H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); +H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id, + hid_t dxpl_id); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index aaafd72..2879823 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -213,10 +213,10 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* for opening the destination object */ H5G_name_t src_path; /* Opened source object hier. path */ H5O_loc_t src_oloc; /* Opened source object object location */ + htri_t dst_exists; /* Does destination name exist already? */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hbool_t obj_open = FALSE; /* Entry at 'name' found */ - - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, @@ -233,22 +233,10 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") /* check if destination name already exists */ - { - H5G_name_t tmp_path; - H5O_loc_t tmp_oloc; - H5G_loc_t tmp_loc; - - /* Set up group location */ - tmp_loc.oloc = &tmp_oloc; - tmp_loc.path = &tmp_path; - H5G_loc_reset(&tmp_loc); - - /* Check if object already exists in destination */ - if(H5G_loc_find(&dst_loc, dst_name, &tmp_loc, H5P_DEFAULT, H5AC_ind_dxpl_id) >= 0) { - H5G_name_free(&tmp_path); - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "destination object already exists") - } /* end if */ - } + if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") + if(TRUE == dst_exists) + HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") /* Set up opened group location to fill in */ src_loc.oloc = &src_oloc; diff --git a/src/H5TS.c b/src/H5TS.c index 987bead..6a64a14 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -255,19 +255,18 @@ H5TS_cancel_count_inc(void) if (!cancel_counter) { /* - * First time thread calls library - create new counter and associate + * First time thread calls library - create new counter and associate * with key */ - cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t)); + cancel_counter = (H5TS_cancel_t *)HDcalloc(1, sizeof(H5TS_cancel_t)); - if (!cancel_counter) { - H5E_push_stack(NULL, "H5TS_cancel_count_inc", - __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); - return FAIL; - } + if (!cancel_counter) { + H5E_push_stack(NULL, "H5TS_cancel_count_inc", __FILE__, __LINE__, + H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); + return FAIL; + } - ret_value = pthread_setspecific(H5TS_cancel_key_g, - (void *)cancel_counter); + ret_value = pthread_setspecific(H5TS_cancel_key_g, (void *)cancel_counter); } if (cancel_counter->cancel_count == 0) diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 2abdf6f..0ed8209 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -465,7 +465,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end if */ else { /* Default to system malloc */ - if(NULL==(vl.p=H5MM_malloc(len))) + if(NULL == (vl.p = HDmalloc(len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end else */ @@ -691,7 +691,7 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end if */ else { /* Default to system malloc */ - if(NULL==(t = (char *)H5MM_malloc((seq_len+1)*base_size))) + if(NULL == (t = (char *)HDmalloc((seq_len + 1) * base_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end else */ @@ -1073,14 +1073,14 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi if(free_func != NULL) (*free_func)(vl->p, free_info); else - H5MM_xfree(vl->p); + HDfree(vl->p); } /* end if */ } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { /* Free the VL string */ if(free_func != NULL) (*free_func)(*(char **)elem, free_info); else - H5MM_xfree(*(char **)elem); + HDfree(*(char **)elem); } else { HDassert(0 && "Invalid VL type"); } /* end else */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 0a9a4da..2627a29 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -1032,7 +1032,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size /* Free the temporary arrays we used */ if(data_xform_prop->dat_val_pointers->num_ptrs > 1) for(i=0; idat_val_pointers->num_ptrs; i++) - HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); + H5MM_xfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); } /* end else */ done: @@ -1042,7 +1042,7 @@ done: if(data_xform_prop->dat_val_pointers->num_ptrs > 1) for(i = 0; i < data_xform_prop->dat_val_pointers->num_ptrs; i++) if(data_xform_prop->dat_val_pointers->ptr_dat_val[i]) - HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); + H5MM_xfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/test/btree2.c b/test/btree2.c index 8a08d3d..b0c0ac3 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2610 * 1000) +#define INSERT_MANY_REC (2650 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 diff --git a/test/dtypes.c b/test/dtypes.c index 326294f..984b6c6 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1789,6 +1789,13 @@ test_compound_9(void) goto error; } /* end if */ + if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim read data\n"); + goto error; + } /* end if */ + rdata.str = NULL; + if(H5Dclose(dset_id) < 0) goto error; if(H5Tclose(cmpd_tid) < 0) @@ -1815,6 +1822,12 @@ test_compound_9(void) goto error; } /* end if */ + if((space_id = H5Dget_space(dset_id)) < 0) { + H5_FAILED(); AT(); + printf("Can't get space\n"); + goto error; + } /* end if */ + if((cmpd_tid = H5Dget_type(dset_id)) < 0) { H5_FAILED(); AT(); printf("cannot open dataset\n"); @@ -1842,10 +1855,19 @@ test_compound_9(void) goto error; } /* end if */ + if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { + H5_FAILED(); AT(); + printf("Can't read data\n"); + goto error; + } /* end if */ + rdata.str = NULL; + if(rdata.str) HDfree(rdata.str); if(H5Dclose(dset_id) < 0) goto error; + if(H5Sclose(space_id) < 0) + goto error; if(H5Tclose(cmpd_tid) < 0) goto error; if(H5Tclose(dup_tid) < 0) @@ -2020,12 +2042,17 @@ test_compound_10(void) printf("incorrect VL read data\n"); goto error; } - - HDfree(t1); - HDfree(t2); - HDfree(wdata[i].str); - HDfree(rdata[i].str); } /* end for */ + if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim read data\n"); + goto error; + } /* end if */ + if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim read data\n"); + goto error; + } /* end if */ if(H5Dclose(dset_id) < 0) goto error; @@ -2090,6 +2117,8 @@ test_compound_11(void) hid_t big_tid, little_tid; /* Datatype IDs for type conversion */ hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */ hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */ + hid_t space_id; /* Dataspace for buffer elements */ + hsize_t dim[1]; /* Dimensions for dataspace */ void *buf = NULL; /* Conversion buffer */ void *buf_orig = NULL; /* Copy of original conversion buffer */ void *bkg = NULL; /* Background buffer */ @@ -2138,6 +2167,13 @@ test_compound_11(void) /* Make copy of buffer before conversion */ HDmemcpy(buf_orig,buf,sizeof(big_t)*NTESTELEM); + dim[0] = NTESTELEM; + if((space_id = H5Screate_simple(1, dim, NULL)) < 0) { + H5_FAILED(); AT(); + printf("Can't create space\n"); + goto error; + } /* end if */ + /* Make copies of the 'big' and 'little' datatypes, so the type * conversion routine doesn't use the same ones this time and next time */ @@ -2169,8 +2205,12 @@ test_compound_11(void) (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - HDfree(((little_t *)buf)[u].s1); } /* end for */ + if(H5Dvlen_reclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim data\n"); + goto error; + } /* end if */ /* Build source and destination types for conversion routine */ if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR @@ -2209,8 +2249,12 @@ test_compound_11(void) (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - HDfree(((little_t *)buf)[u].s1); } /* end for */ + if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim data\n"); + goto error; + } /* end if */ /* Unregister the conversion routine */ if(H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR @@ -2243,12 +2287,17 @@ test_compound_11(void) (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - HDfree(((little_t *)buf)[u].s1); } /* end for */ + if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim data\n"); + goto error; + } /* end if */ /* Free everything */ for(u=0; udel_dir == FHEAP_DEL_FORWARD) if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL) - str = HDstrdup("(all - forward)"); + str = H5MM_strdup("(all - forward)"); else - str = HDstrdup("(half, refill, all - forward)"); + str = H5MM_strdup("(half, refill, all - forward)"); else if(tparam->del_dir == FHEAP_DEL_REVERSE) if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL) - str = HDstrdup("(all - reverse)"); + str = H5MM_strdup("(all - reverse)"); else - str = HDstrdup("(half, refill, all - reverse)"); + str = H5MM_strdup("(half, refill, all - reverse)"); else - str = HDstrdup("(all - deleting heap)"); + str = H5MM_strdup("(all - deleting heap)"); return(str); } /* get_del_string() */ diff --git a/test/file_image.c b/test/file_image.c index 52d0b28..6d1845f 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -156,8 +156,8 @@ error: if(H5Pclose(fapl_1) < 0) retval = 1; if(H5Pclose(fapl_2) < 0) retval = 1; HDfree(buffer); - HDfree(temp); - HDfree(temp2); + H5free_memory(temp); + H5free_memory(temp2); if(retval == 0) PASSED(); diff --git a/test/links.c b/test/links.c index 7e63bfa..db43cf3 100644 --- a/test/links.c +++ b/test/links.c @@ -140,7 +140,7 @@ const char *FILENAME[] = { #define H5L_DIM1 100 #define H5L_DIM2 100 -#define FILTER_FILESIZE_MAX_FRACTION 0.9F +#define FILTER_FILESIZE_MAX_FRACTION (double)0.9F /* Creation order macros */ #define CORDER_GROUP_NAME "corder_group" @@ -552,8 +552,27 @@ cklinks(hid_t fapl, hbool_t new_format) HDputs(" expected file location."); TEST_ERROR } /* end if */ + if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + H5E_BEGIN_TRY { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + H5E_BEGIN_TRY { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -11085,6 +11104,7 @@ link_info_by_idx(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ herr_t ret; /* Generic return value */ /* Loop over creating hard or soft links */ @@ -11126,9 +11146,9 @@ link_info_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -11168,9 +11188,9 @@ link_info_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { @@ -11210,9 +11230,9 @@ link_info_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -11267,6 +11287,7 @@ link_info_by_idx_old(hid_t fapl) char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ herr_t ret; /* Generic return value */ /* Loop over creating hard or soft links */ @@ -11378,9 +11399,9 @@ link_info_by_idx_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Verify state of group */ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR @@ -12138,7 +12159,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip); + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR @@ -12166,11 +12187,11 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ - iter_info->nskipped = gskip = max_links / 2; + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip); + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR @@ -12211,7 +12232,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = gskip = 0; + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; @@ -12568,7 +12589,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ - iter_info->nskipped = gskip = 0; + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12588,7 +12609,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip); + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR @@ -12616,11 +12637,11 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ - iter_info->nskipped = gskip = max_links / 2; + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip); + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR @@ -12661,7 +12682,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = gskip = 0; + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; diff --git a/test/objcopy.c b/test/objcopy.c index 4c10602..241f30b 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -218,7 +218,7 @@ addr_insert(H5O_info_t *oi) * *------------------------------------------------------------------------- */ -static hbool_t +static H5_ATTR_PURE hbool_t addr_lookup(H5O_info_t *oi) { size_t n; @@ -533,8 +533,12 @@ test_copy_attach_attribute_vl(hid_t loc_id) ret_value = 0; done: - if(tid >0 && sid > 0) - H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + if(tid >0 && sid > 0) { + hid_t dxpl_id = H5Pcreate(H5P_DATASET_XFER); + H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL); + H5Dvlen_reclaim(tid, sid, dxpl_id, buf); + H5Pclose(dxpl_id); + } if(sid > 0) H5Sclose(sid); if(tid > 0) @@ -5030,6 +5034,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ hid_t tid = -1; /* Datatype ID */ hid_t sid = -1; /* Dataspace ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -5113,7 +5118,12 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -5129,6 +5139,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -5160,6 +5171,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */ @@ -5289,7 +5301,12 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -5305,6 +5322,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -5336,6 +5355,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -5426,7 +5446,12 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -5442,6 +5467,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -5589,6 +5615,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t tid = -1; /* Datatype ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ hsize_t dim2d[2]; /* Dataset dimensions */ hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */ hvl_t buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */ @@ -5688,7 +5715,12 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if(H5Fclose(fid_dst) < 0) TEST_ERROR /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -5707,6 +5739,7 @@ error: H5Dclose(did); H5Pclose(pid); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -7396,6 +7429,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7495,7 +7529,12 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -7512,6 +7551,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -7543,6 +7583,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl hid_t tid = -1, tid_copy=-1; /* Datatype ID */ hid_t sid = -1; /* Dataspace ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7635,7 +7676,12 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -7651,6 +7697,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -7683,6 +7730,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7783,7 +7831,12 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -7800,6 +7853,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -7832,6 +7886,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7933,7 +7988,12 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -7950,6 +8010,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -7982,6 +8043,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -8088,7 +8150,12 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if(H5Fclose(fid_dst) < 0) TEST_ERROR /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -8105,6 +8172,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -8137,6 +8206,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -8242,7 +8312,12 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h if(H5Fclose(fid_dst) < 0) TEST_ERROR /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -8259,6 +8334,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -8291,6 +8368,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -8435,7 +8513,12 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -8453,6 +8536,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -8485,6 +8569,7 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -8592,7 +8677,12 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -8610,6 +8700,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -8652,6 +8743,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t sid = -1; /* Dataspace ID */ hid_t did = -1; /* Dataset ID */ hid_t did2 = -1; /* Dataset ID */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -8741,7 +8833,12 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid2) < 0) TEST_ERROR @@ -8758,6 +8855,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid2); H5Tclose(tid); H5Sclose(sid); @@ -8790,6 +8888,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */ @@ -8887,7 +8986,12 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid2) < 0) TEST_ERROR @@ -8904,6 +9008,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid2); H5Tclose(tid); H5Sclose(sid); @@ -8936,6 +9042,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -9032,7 +9139,12 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid2) < 0) TEST_ERROR @@ -9049,6 +9161,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid2); H5Tclose(tid); H5Sclose(sid); diff --git a/test/tgenprop.c b/test/tgenprop.c index c4f3a3f..b670c0d 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1780,7 +1780,7 @@ test_genprop_path(void) CHECK_PTR(path, "H5P_get_class_path_test"); if(HDstrcmp(path,CLASS1_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); - HDfree(path); + H5free_memory(path); /* Create another new generic class, derived from first class */ cid2 = H5Pcreate_class(cid1,CLASS2_NAME, NULL, NULL, NULL, NULL, NULL, NULL); @@ -1805,7 +1805,7 @@ test_genprop_path(void) VERIFY(ret, 1, "H5Pequal"); /* Release the path string */ - HDfree(path); + H5free_memory(path); /* Close class */ ret = H5Pclose_class(cid3); diff --git a/test/tmisc.c b/test/tmisc.c index 1298f6b..011486a 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -462,7 +462,8 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att1, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); ret = H5Aclose(att1); CHECK(ret, FAIL, "HAclose"); @@ -487,7 +488,8 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att2, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); ret = H5Aclose(att2); CHECK(ret, FAIL, "HAclose"); @@ -514,6 +516,7 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name { hid_t file, root, att; hid_t type; + hid_t space; herr_t ret; misc2_struct data_check; @@ -528,10 +531,17 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name att = H5Aopen(root, att_name, H5P_DEFAULT); CHECK(att, FAIL, "H5Aopen"); + space = H5Aget_space(att); + CHECK(space, FAIL, "H5Aget_space"); + ret = H5Aread(att, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); + + ret = H5Sclose(space); + CHECK(ret, FAIL, "H5Sclose"); ret = H5Aclose(att); CHECK(ret, FAIL, "H5Aclose"); diff --git a/test/tvlstr.c b/test/tvlstr.c index 02bd59d..dbc3083 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -604,7 +604,7 @@ static void test_write_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att) != 0) TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; ret = H5Aclose(att); @@ -626,7 +626,7 @@ static void test_write_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att_write) != 0) TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; /* The attribute string written is freed below, in the test_read_vl_string_attribute() test */ @@ -687,7 +687,7 @@ static void test_read_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att) != 0) TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; ret = H5Aclose(att); @@ -704,7 +704,7 @@ static void test_read_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att_write) != 0) TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; } @@ -762,7 +762,8 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch if(HDstrcmp(data, data_read)) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); - HDfree(data_read); + ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_read); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); } /**************************************************************** diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index c962e80..91e1c93 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -974,7 +974,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /* Release resources */ for(i = 0; i < (unsigned)nmembs; i++) - HDfree(name[i]); + H5free_memory(name[i]); HDfree(name); HDfree(value); } @@ -1857,13 +1857,10 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) if (vmaps) { size_t next; - ssize_t ssize_out; h5tools_str_append(&buffer, " %-10s {%ld} Source {\n", "Maps:", vmaps); for (next = 0; next < (unsigned) vmaps; next++) { - ssize_out = H5Pget_virtual_filename(dcpl, next, NULL, 0); H5Pget_virtual_filename(dcpl, next, f_name, sizeof(f_name)); - ssize_out = H5Pget_virtual_dsetname(dcpl, next, NULL, 0); H5Pget_virtual_dsetname(dcpl, next, dset_name, sizeof(dset_name)); h5tools_str_append(&buffer, " %-10s ", " "); print_string(&buffer, f_name, TRUE); -- cgit v0.12 From b9ba373c8ce8123d70878739c160892c63e5627e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 1 Jan 2016 21:14:52 -0500 Subject: [svn-r28766] Description: Bring r28765 from trunk to branch (bump # of records for level 4 B-tree updates) Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- test/btree2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/btree2.c b/test/btree2.c index b0c0ac3..3278b67 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2650 * 1000) +#define INSERT_MANY_REC (2675 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 -- cgit v0.12 From f56120fdc30ea5a10d6c2b3e42d272d800fc8231 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 2 Jan 2016 20:16:35 -0500 Subject: [svn-r28770] Description: Bring r28769 from trunk to revise_chunks branch: More memory cleanups and leak elimination. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Dcompact.c | 1 + src/H5Eint.c | 5 +++++ tools/h5repack/h5repacktst.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index e2dc36f..df2a740 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -440,6 +440,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst HDassert(storage_src); HDassert(f_dst); HDassert(storage_dst); + HDassert(storage_dst->buf); HDassert(dt_src); /* Create datatype ID for src datatype, so it gets freed */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 6e84a09..6ed405f 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -743,8 +743,13 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin done: if(va_started) va_end(ap); +#ifdef H5_HAVE_VASPRINTF + if(tmp) + HDfree(tmp); +#else /* H5_HAVE_VASPRINTF */ if(tmp) H5MM_xfree(tmp); +#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 030b052..07ea676 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -1603,6 +1603,8 @@ int main (void) puts("All h5repack tests passed."); + h5tools_close(); + return 0; error: -- cgit v0.12 From fc758c5cbe1018d11c7f97a162e80fbddda66789 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 3 Jan 2016 09:25:06 -0500 Subject: [svn-r28774] Description: Bring r28773 from trunk to revise_chunks branch: Clear memory for shared message info when "deferring" and using memory checker, so valgrind doesn't whine. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5SM.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/H5SM.c b/src/H5SM.c index 4a562dd..413ad1f 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -1375,11 +1375,23 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, } /* end else */ } /* end else */ - if(found) + if(found) { /* If the message was found, it's shared in the heap (now). Set up a * shared message so we can mark it as shared. */ shared.type = H5O_SHARE_TYPE_SOHM; + +#ifdef H5_USING_MEMCHECKER + /* Reset the shared message payload if deferring. This doesn't matter + * in the long run since the payload will get overwritten when the + * non-deferred call to this routine occurs, but it stops memory + * checkers like valgrind from whining when the partially initialized + * shared message is serialized. -QAK + */ + if(defer) + HDmemset(&shared.u, 0, sizeof(shared.u)); +#endif /* H5_USING_MEMCHECKER */ + } /* end if */ else { htri_t share_in_ohdr; /* Whether the new message can be shared in another object's header */ -- cgit v0.12 From e7f7337d5b950ce66aa78b270ea2696939a13dac Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 3 Jan 2016 17:08:44 -0500 Subject: [svn-r28778] Description: Clean up object header proxy code, while tracking down the v2 B-tree SWMR failures. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5O.c | 11 +- src/H5Ocache.c | 4 +- src/H5Ochunk.c | 2 +- src/H5Ocopy.c | 2 +- src/H5Opkg.h | 10 +- src/H5Oproxy.c | 312 ++++++++++++++++++++++++--------------------------------- 6 files changed, 144 insertions(+), 197 deletions(-) diff --git a/src/H5O.c b/src/H5O.c index 788d657..2988567 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1278,7 +1278,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc, /* Create object header proxy if doing SWMR writes */ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) { - if(H5O_proxy_create(f, dxpl_id, oh) < 0) + if(H5O__proxy_create(f, dxpl_id, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy") } /* end if */ else @@ -3701,7 +3701,7 @@ H5O_pin_flush_dep_proxy(H5O_loc_t *loc, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") /* Pin object header proxy */ - if(NULL == (proxy = H5O_proxy_pin(loc->file, dxpl_id, oh))) + if(NULL == (proxy = H5O__proxy_pin(loc->file, dxpl_id, oh))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header proxy") /* Set the return value */ @@ -3713,7 +3713,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") if(!ret_value) - if(proxy && H5O_proxy_unpin(proxy) < 0) + if(proxy && H5O__proxy_unpin(proxy) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, NULL, "unable to release object header proxy") FUNC_LEAVE_NOAPI(ret_value) @@ -3747,11 +3747,10 @@ H5O_pin_flush_dep_proxy_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh) HDassert(oh); /* Pin object header proxy */ - if(NULL == (ret_value = H5O_proxy_pin(f, dxpl_id, oh))) + if(NULL == (ret_value = H5O__proxy_pin(f, dxpl_id, oh))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header proxy") done: - FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pin_flush_dep_proxy_oh() */ @@ -3779,7 +3778,7 @@ H5O_unpin_flush_dep_proxy(H5O_proxy_t *proxy) HDassert(proxy); /* Unin object header proxy */ - if(H5O_proxy_unpin(proxy) < 0) + if(H5O__proxy_unpin(proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header proxy") done: diff --git a/src/H5Ocache.c b/src/H5Ocache.c index fb12a06..28de0eb 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -467,7 +467,7 @@ H5O__cache_deserialize(const void *_image, size_t len, void *_udata, /* Create object header proxy if doing SWMR writes */ HDassert(!oh->proxy_present); if(H5F_INTENT(udata->common.f) & H5F_ACC_SWMR_WRITE) { - if(H5O_proxy_create(udata->common.f, udata->common.dxpl_id, oh) < 0) + if(H5O__proxy_create(udata->common.f, udata->common.dxpl_id, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, NULL, "can't create object header proxy") } /* end if */ else @@ -1122,7 +1122,7 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) /* Add flush dependency on object header proxy, if proxy exists */ if(chk_proxy->oh->proxy_present) - if(H5O_proxy_depend(chk_proxy->f, H5AC_ind_dxpl_id, chk_proxy->oh, chk_proxy) < 0) + if(H5O__proxy_depend(chk_proxy->f, H5AC_ind_dxpl_id, chk_proxy->oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "can't create flush dependency on object header proxy") case H5AC_NOTIFY_ACTION_AFTER_FLUSH: diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 2ccb2f3..bec6a99 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -410,7 +410,7 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) { /* Remove flush dependency on object header proxy, if proxy exists */ if(oh->proxy_present) - if(H5O_proxy_undepend(f, dxpl_id, oh, chk_proxy) < 0) + if(H5O__proxy_undepend(f, dxpl_id, oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "can't destroy flush dependency on object header proxy") } /* end if */ else diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2879823..b1d38f4 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -463,7 +463,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Create object header proxy if doing SWMR writes */ if(H5F_INTENT(oloc_dst->file) & H5F_ACC_SWMR_WRITE) { - if(H5O_proxy_create(oloc_dst->file, dxpl_id, oh_dst) < 0) + if(H5O__proxy_create(oloc_dst->file, dxpl_id, oh_dst) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy") } /* end if */ else diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 8ce2718..c98aca2 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -710,11 +710,11 @@ H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs); /* Object header proxy operators */ -H5_DLL herr_t H5O_proxy_create(H5F_t *f, hid_t dxpl_id, H5O_t *oh); -H5_DLL H5O_proxy_t *H5O_proxy_pin(H5F_t *f, hid_t dxpl_id, H5O_t *oh); -H5_DLL herr_t H5O_proxy_unpin(H5O_proxy_t *proxy); -H5_DLL herr_t H5O_proxy_depend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent); -H5_DLL herr_t H5O_proxy_undepend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent); +H5_DLL herr_t H5O__proxy_create(H5F_t *f, hid_t dxpl_id, H5O_t *oh); +H5_DLL H5O_proxy_t *H5O__proxy_pin(H5F_t *f, hid_t dxpl_id, H5O_t *oh); +H5_DLL herr_t H5O__proxy_unpin(H5O_proxy_t *proxy); +H5_DLL herr_t H5O__proxy_depend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent); +H5_DLL herr_t H5O__proxy_undepend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent); /* Testing functions */ #ifdef H5O_TESTING diff --git a/src/H5Oproxy.c b/src/H5Oproxy.c index 811e73e..67388fb 100644 --- a/src/H5Oproxy.c +++ b/src/H5Oproxy.c @@ -71,19 +71,20 @@ /********************/ /* Metadata cache (H5AC) callbacks */ -static herr_t H5O__cache_proxy_get_load_size(const void *image, void *udata, +static herr_t H5O__proxy_get_load_size(const void *image, void *udata, size_t *image_len, size_t *actual_len, hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); -static void *H5O__cache_proxy_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5O__cache_proxy_image_len(const void *thing, size_t *image_len, hbool_t *compressed_ptr, +static void *H5O__proxy_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); +static herr_t H5O__proxy_image_len(const void *thing, size_t *image_len, hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); -static herr_t H5O__cache_proxy_serialize(const H5F_t *f, void *image, size_t len, void *thing); -static herr_t H5O__cache_proxy_notify(H5AC_notify_action_t action, void *thing); -static herr_t H5O__cache_proxy_free_icr(void *thing); +static herr_t H5O__proxy_serialize(const H5F_t *f, void *image, size_t len, void *thing); +static herr_t H5O__proxy_notify(H5AC_notify_action_t action, void *thing); +static herr_t H5O__proxy_free_icr(void *thing); -static herr_t H5O_proxy_depend_core(void *parent, H5O_proxy_t *proxy); -static herr_t H5O__cache_proxy_dest(H5O_proxy_t *proxy); -static herr_t H5O_proxy_undepend_core(void *parent, H5O_proxy_t *proxy); +/* Helper routines */ +static herr_t H5O__proxy_depend_core(void *parent, H5O_proxy_t *proxy); +static herr_t H5O__proxy_dest(H5O_proxy_t *proxy); +static herr_t H5O__proxy_undepend_core(void *parent, H5O_proxy_t *proxy); /*********************/ /* Package Variables */ @@ -94,14 +95,14 @@ const H5AC_class_t H5AC_OHDR_PROXY[1] = {{ "Object header proxy", /* Metadata client name (for debugging) */ H5FD_MEM_OHDR, /* File space memory type for client */ H5AC__CLASS_SKIP_READS|H5AC__CLASS_SKIP_WRITES, /* Client class behavior flags */ - H5O__cache_proxy_get_load_size, /* 'get_load_size' callback */ + H5O__proxy_get_load_size, /* 'get_load_size' callback */ NULL, /* 'verify_chksum' callback */ - H5O__cache_proxy_deserialize, /* 'deserialize' callback */ - H5O__cache_proxy_image_len, /* 'image_len' callback */ + H5O__proxy_deserialize, /* 'deserialize' callback */ + H5O__proxy_image_len, /* 'image_len' callback */ NULL, /* 'pre_serialize' callback */ - H5O__cache_proxy_serialize, /* 'serialize' callback */ - H5O__cache_proxy_notify, /* 'notify' callback */ - H5O__cache_proxy_free_icr, /* 'free_icr' callback */ + H5O__proxy_serialize, /* 'serialize' callback */ + H5O__proxy_notify, /* 'notify' callback */ + H5O__proxy_free_icr, /* 'free_icr' callback */ NULL, /* 'clear' callback */ NULL, /* 'fsf_size' callback */ }}; @@ -133,7 +134,7 @@ H5FL_BLK_DEFINE_STATIC(parent_ptr); /*------------------------------------------------------------------------- - * Function: H5O__cache_proxy_get_load_size + * Function: H5O__proxy_get_load_size * * Purpose: Compute the size of the data structure on disk. * @@ -146,7 +147,7 @@ H5FL_BLK_DEFINE_STATIC(parent_ptr); *------------------------------------------------------------------------- */ static herr_t -H5O__cache_proxy_get_load_size(const void *_image, void H5_ATTR_UNUSED *_udata, +H5O__proxy_get_load_size(const void *_image, void H5_ATTR_UNUSED *_udata, size_t *image_len, size_t H5_ATTR_UNUSED *actual_len, hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) @@ -162,17 +163,17 @@ H5O__cache_proxy_get_load_size(const void *_image, void H5_ATTR_UNUSED *_udata, /* Set the image length size */ /* Object header proxies are represented as 1 byte in cache */ /* (would be 0 bytes, but cache won't allow it currently. See - * H5D_cache_proxy_size) */ + * H5D_proxy_size) */ *image_len = 1; } /* Nothing to do for non-NULL image: no need to compute actual_len */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O__cache_proxy_get_load_size() */ +} /* end H5O__proxy_get_load_size() */ /*------------------------------------------------------------------------- - * Function: H5O__cache_proxy_deserialize + * Function: H5O__proxy_deserialize * * Purpose: Creates an object header proxy and creates flush * dependencies from all object header chunks on this proxy. @@ -186,7 +187,7 @@ H5O__cache_proxy_get_load_size(const void *_image, void H5_ATTR_UNUSED *_udata, *------------------------------------------------------------------------- */ static void * -H5O__cache_proxy_deserialize(const void H5_ATTR_UNUSED *_image, size_t H5_ATTR_UNUSED len, void *_udata, +H5O__proxy_deserialize(const void H5_ATTR_UNUSED *_image, size_t H5_ATTR_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5O_proxy_t *proxy = NULL; /* Object header proxy */ @@ -219,15 +220,15 @@ H5O__cache_proxy_deserialize(const void H5_ATTR_UNUSED *_image, size_t H5_ATTR_U done: if(!ret_value && proxy) - if(H5O__cache_proxy_dest(proxy) < 0) + if(H5O__proxy_dest(proxy) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to destroy object header proxy") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__cache_proxy_deserialize() */ +} /* end H5O__proxy_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5B2__cache_hdr_image_len + * Function: H5O__proxy_image_len * * Purpose: Compute the size of the data structure on disk. * @@ -240,7 +241,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__cache_proxy_image_len(const void H5_ATTR_UNUSED *_thing, size_t *image_len, +H5O__proxy_image_len(const void H5_ATTR_UNUSED *_thing, size_t *image_len, hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) { FUNC_ENTER_STATIC_NOERR @@ -251,15 +252,15 @@ H5O__cache_proxy_image_len(const void H5_ATTR_UNUSED *_thing, size_t *image_len, /* Set the image length size */ /* Object header proxies are represented as 1 byte in cache */ /* (would be 0 bytes, but cache won't allow it currently. See - * H5D_cache_proxy_size) */ + * H5D_proxy_size) */ *image_len = 1; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O__cache_proxy_image_len() */ +} /* end H5O__proxy_image_len() */ /*------------------------------------------------------------------------- - * Function: H5O__cache_proxy_serialize + * Function: H5O__proxy_serialize * * Purpose: A no-op * @@ -272,7 +273,7 @@ H5O__cache_proxy_image_len(const void H5_ATTR_UNUSED *_thing, size_t *image_len, *------------------------------------------------------------------------- */ static herr_t -H5O__cache_proxy_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *_image, size_t H5_ATTR_UNUSED len, +H5O__proxy_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *_image, size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *_thing) { FUNC_ENTER_STATIC_NOERR @@ -280,11 +281,11 @@ H5O__cache_proxy_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *_ /* A no-op */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5O__cache_proxy_serialize() */ +} /* H5O__proxy_serialize() */ /*------------------------------------------------------------------------- - * Function: H5O__cache_proxy_notify + * Function: H5O__proxy_notify * * Purpose: Handle cache action notifications * @@ -297,14 +298,14 @@ H5O__cache_proxy_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *_ *------------------------------------------------------------------------- */ static herr_t -H5O__cache_proxy_notify(H5AC_notify_action_t action, void *_thing) +H5O__proxy_notify(H5AC_notify_action_t action, void *_thing) { H5O_proxy_t *proxy = (H5O_proxy_t *)_thing; H5O_chunk_proxy_t *chk_proxy = NULL; /* Object header chunk proxy */ - unsigned i; /* Local index variable */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -318,15 +319,15 @@ H5O__cache_proxy_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_AFTER_INSERT: case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on object header chunk 0 */ - if(H5O_proxy_depend_core(proxy->oh, proxy) < 0) + if(H5O__proxy_depend_core(proxy->oh, proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") /* Create flush dependencies on all other object header chunks */ - for(i = 1; i < proxy->oh->nchunks; i++) { - if(NULL == (chk_proxy = H5O_chunk_protect(proxy->f, H5AC_ind_dxpl_id, proxy->oh, i))) + for(u = 1; u < proxy->oh->nchunks; u++) { + if(NULL == (chk_proxy = H5O_chunk_protect(proxy->f, H5AC_ind_dxpl_id, proxy->oh, u))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") /* same as before, but looks backward...need to check into that..(proxy, chk_proxy) */ - if(H5O_proxy_depend_core(chk_proxy, proxy) < 0) + if(H5O__proxy_depend_core(chk_proxy, proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") if(H5O_chunk_unprotect(proxy->f, H5AC_ind_dxpl_id, chk_proxy, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") @@ -346,16 +347,15 @@ H5O__cache_proxy_notify(H5AC_notify_action_t action, void *_thing) HDassert(proxy->oh_fd_parent_addr != HADDR_UNDEF); HDassert(proxy->oh_fd_parent_ptr != NULL); - if(H5O_proxy_undepend_core(proxy->oh_fd_parent_ptr, proxy) < 0) + if(H5O__proxy_undepend_core(proxy->oh_fd_parent_ptr, proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency with object header") - while(proxy->chk_fd_parent_count > 0){ - - i = proxy->chk_fd_parent_count - 1; + while(proxy->chk_fd_parent_count > 0) { + u = proxy->chk_fd_parent_count - 1; - if(H5O_proxy_undepend_core(proxy->chk_fd_parent_ptrs[i], proxy)<0) + if(H5O__proxy_undepend_core(proxy->chk_fd_parent_ptrs[u], proxy)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency with object header continuation chunk") - } + } /* end while */ /* Mark proxy as not present on the object header */ proxy->oh->proxy_present = FALSE; @@ -377,12 +377,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5O__cache_proxy_notify() */ +} /* end H5O__proxy_notify() */ /*------------------------------------------------------------------------- - * Function: H5O__cache_proxy_free_icr + * Function: H5O__proxy_free_icr * * Purpose: Destroy/release an "in core representation" of a data * structure @@ -395,23 +394,23 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__cache_proxy_free_icr(void *_thing) +H5O__proxy_free_icr(void *_thing) { H5O_proxy_t *proxy = (H5O_proxy_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - if(H5O__cache_proxy_dest(proxy) < 0) + if(H5O__proxy_dest(proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header proxy") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O__cache_proxy_free_icr() */ +} /* H5O__proxy_free_icr() */ /*------------------------------------------------------------------------- - * Function: H5O_cache_proxy_dest + * Function: H5O_proxy_dest * * Purpose: Destroys an object header proxy in memory. * @@ -423,11 +422,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__cache_proxy_dest(H5O_proxy_t *proxy) +H5O__proxy_dest(H5O_proxy_t *proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(proxy); HDassert(proxy->oh); @@ -436,11 +435,11 @@ H5O__cache_proxy_dest(H5O_proxy_t *proxy) proxy = H5FL_FREE(H5O_proxy_t, proxy); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__cache_proxy_dest() */ +} /* end H5O__proxy_dest() */ /*------------------------------------------------------------------------- - * Function: H5O_proxy_create + * Function: H5O__proxy_create * * Purpose: Allocate temporary space for the object header proxy. We * save the actual creation of the proxy to the "load" @@ -459,11 +458,11 @@ H5O__cache_proxy_dest(H5O_proxy_t *proxy) *------------------------------------------------------------------------- */ herr_t -H5O_proxy_create(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t *oh) +H5O__proxy_create(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t *oh) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(f); HDassert(oh); @@ -474,11 +473,11 @@ H5O_proxy_create(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_proxy_create() */ +} /* end H5O__proxy_create() */ /*------------------------------------------------------------------------- - * Function: H5O_proxy_pin + * Function: H5O__proxy_pin * * Purpose: Returns the proxy object for the specified object header, * pinned. This proxy can be used as a flush dependency @@ -493,13 +492,13 @@ done: *------------------------------------------------------------------------- */ H5O_proxy_t * -H5O_proxy_pin(H5F_t *f, hid_t dxpl_id, H5O_t *oh) +H5O__proxy_pin(H5F_t *f, hid_t dxpl_id, H5O_t *oh) { H5O_proxy_t *proxy = NULL; /* Object header proxy */ H5O_proxy_cache_ud_t udata; /* User-data for callback */ H5O_proxy_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(f); HDassert(oh); @@ -527,11 +526,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_proxy_pin() */ +} /* end H5O__proxy_pin() */ /*------------------------------------------------------------------------- - * Function: H5O_proxy_unpin + * Function: H5O__proxy_unpin * * Purpose: Unpins the specified object header proxy from the cache. * @@ -543,11 +542,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_proxy_unpin(H5O_proxy_t *proxy) +H5O__proxy_unpin(H5O_proxy_t *proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(proxy); @@ -557,11 +556,11 @@ H5O_proxy_unpin(H5O_proxy_t *proxy) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_proxy_unpin() */ +} /* end H5O__proxy_unpin() */ /*------------------------------------------------------------------------- - * Function: H5O_proxy_depend + * Function: H5O__proxy_depend * * Purpose: Creates a flush dependency between the object header proxy * (as child) and the specified object (as parent). @@ -574,33 +573,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_proxy_depend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent) +H5O__proxy_depend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent) { H5O_proxy_t *proxy = NULL; /* Object header proxy */ H5O_proxy_cache_ud_t udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(f); HDassert(oh); HDassert(H5F_addr_defined(oh->proxy_addr)); HDassert(parent); - HDassert(((H5C_cache_entry_t *)parent)->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(((H5C_cache_entry_t *)parent)->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(((H5C_cache_entry_t *)parent)->type); HDassert((((H5C_cache_entry_t *)(parent))->type->id == H5AC_OHDR_ID) || (((H5C_cache_entry_t *)(parent))->type->id == H5AC_OHDR_CHK_ID)); + /* Protect the object header proxy */ udata.f = f; udata.oh = oh; - /* Protect the object header proxy */ if(NULL == (proxy = (H5O_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_PROXY, oh->proxy_addr, &udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header proxy"); /* Add the flush dependency on the parent object */ - if(H5O_proxy_depend_core(parent, proxy) < 0) + if(H5O__proxy_depend_core(parent, proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") /* Unprotect the object header proxy */ @@ -609,19 +607,15 @@ H5O_proxy_depend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent) proxy = NULL; done: - if(proxy) { - HDassert(ret_value < 0); - if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_PROXY, oh->proxy_addr, proxy, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header proxy"); - } /* end if */ + if(proxy && H5AC_unprotect(f, dxpl_id, H5AC_OHDR_PROXY, oh->proxy_addr, proxy, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header proxy") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_proxy_depend() */ - +} /* end H5O__proxy_depend() */ /*------------------------------------------------------------------------- - * Function: H5O_proxy_depend_core + * Function: H5O__proxy_depend_core * * Purpose: Creates a flush dependency between the object header proxy * (as child) and the specified object (as parent). @@ -642,11 +636,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_proxy_depend_core(void *parent, H5O_proxy_t *proxy) +H5O__proxy_depend_core(void *parent, H5O_proxy_t *proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(parent); HDassert(((H5C_cache_entry_t *)parent)->magic == @@ -729,15 +723,12 @@ H5O_proxy_depend_core(void *parent, H5O_proxy_t *proxy) } done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5O_proxy_depend_core() */ - +} /* end H5O__proxy_depend_core() */ /*------------------------------------------------------------------------- - * Function: H5O_proxy_undepend + * Function: H5O__proxy_undepend * * Purpose: Destroys the flush dependency between the object header * proxy (as child) and the specified object (as parent). @@ -754,27 +745,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_proxy_undepend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent) +H5O__proxy_undepend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent) { H5O_proxy_t *proxy = NULL; /* Object header proxy */ H5O_proxy_cache_ud_t udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE + /* Sanity checks */ HDassert(f); HDassert(oh); HDassert(H5F_addr_defined(oh->proxy_addr)); HDassert(parent); + /* Protect the object header proxy */ udata.f = f; udata.oh = oh; - /* Protect the object header proxy */ if(NULL == (proxy = (H5O_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_PROXY, oh->proxy_addr, &udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header proxy"); - /* destroy the flush dependency on the parent object */ - if(H5O_proxy_undepend_core(parent, proxy) < 0) + /* Destroy the flush dependency on the parent object */ + if(H5O__proxy_undepend_core(parent, proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") /* Unprotect the object header proxy */ @@ -783,19 +775,15 @@ H5O_proxy_undepend(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *parent) proxy = NULL; done: - if(proxy) { - HDassert(ret_value < 0); - if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_PROXY, oh->proxy_addr, proxy, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header proxy"); - } /* end if */ + if(proxy && H5AC_unprotect(f, dxpl_id, H5AC_OHDR_PROXY, oh->proxy_addr, proxy, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header proxy"); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_proxy_undepend() */ - +} /* end H5O__proxy_undepend() */ /*------------------------------------------------------------------------- - * Function: H5O_proxy_undepend_core + * Function: H5O__proxy_undepend_core * * Purpose: Destroys the flush dependency between the object header * proxy (as child) and the specified object (as parent). @@ -818,34 +806,30 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_proxy_undepend_core(void *parent, H5O_proxy_t *proxy) +H5O__proxy_undepend_core(void *parent, H5O_proxy_t *proxy) { - unsigned i; + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(parent); #ifndef NDEBUG - /* do sanity checks */ + /* Sanity checks */ HDassert(parent); - HDassert(((H5C_cache_entry_t *)parent)->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(((H5C_cache_entry_t *)parent)->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(((H5C_cache_entry_t *)parent)->type); HDassert((((H5C_cache_entry_t *)(parent))->type->id == H5AC_OHDR_ID) || (((H5C_cache_entry_t *)(parent))->type->id == H5AC_OHDR_CHK_ID)); if ( (((H5C_cache_entry_t *)(parent))->type->id == H5AC_OHDR_ID) ) { - HDassert(proxy->oh_fd_parent_addr != HADDR_UNDEF); HDassert(proxy->oh_fd_parent_ptr != NULL); - HDassert(proxy->oh_fd_parent_addr == - (((H5C_cache_entry_t *)(parent))->addr)); + HDassert(proxy->oh_fd_parent_addr == (((H5C_cache_entry_t *)(parent))->addr)); HDassert(proxy->oh_fd_parent_ptr == parent); - - } else { - + } /* end if */ + else { hbool_t found = FALSE; HDassert(proxy->chk_fd_parent_alloc > 0); @@ -853,100 +837,64 @@ H5O_proxy_undepend_core(void *parent, H5O_proxy_t *proxy) HDassert(proxy->chk_fd_parent_addrs); HDassert(proxy->chk_fd_parent_ptrs); - for( i = 0; i < proxy->chk_fd_parent_count; i++ ) { - - if ( proxy->chk_fd_parent_ptrs[i] == parent ) { - + for(u = 0; u < proxy->chk_fd_parent_count; u++) + if(proxy->chk_fd_parent_ptrs[u] == parent) { found = TRUE; break; - } - } + } /* end if */ HDassert(found); - HDassert(proxy->chk_fd_parent_addrs[i] == - (((H5C_cache_entry_t *)(parent))->addr)); - } + HDassert(proxy->chk_fd_parent_addrs[u] == (((H5C_cache_entry_t *)(parent))->addr)); + } /* end else */ #endif /* NDEBUG */ - /* destroy the flush dependency on the parent object */ + /* Destroy the flush dependency on the parent object */ if(H5AC_destroy_flush_dependency(parent, proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") - /* delete parent from object header's list of parents */ - if ( (((H5C_cache_entry_t *)(parent))->type->id == H5AC_OHDR_ID) ) { - + /* Delete parent from object header's list of parents */ + if((((H5C_cache_entry_t *)(parent))->type->id == H5AC_OHDR_ID)) { proxy->oh_fd_parent_addr = HADDR_UNDEF; proxy->oh_fd_parent_ptr = NULL; - - } else { - - /* find parent in parent ptrs array */ - for ( i = 0; i < proxy->chk_fd_parent_count; i++ ) { - - if ( proxy->chk_fd_parent_ptrs[i] == parent ) { - + } /* end if */ + else { + /* Find parent in parent ptrs array */ + for(u = 0; u < proxy->chk_fd_parent_count; u++) + if(proxy->chk_fd_parent_ptrs[u] == parent) break; - } - } - - if ( i == proxy->chk_fd_parent_count ) - + if(u == proxy->chk_fd_parent_count) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't in chunk fd parent list") /* Remove parent entry from chunk fd parent ptr and addr lists */ - if ( i < proxy->chk_fd_parent_count - 1 ) { + if(u < proxy->chk_fd_parent_count - 1) { + HDmemmove(&proxy->chk_fd_parent_addrs[u], + &proxy->chk_fd_parent_addrs[u + 1], + (proxy->chk_fd_parent_count - u - 1) * sizeof(proxy->chk_fd_parent_addrs[0])); - HDmemmove(&proxy->chk_fd_parent_addrs[i], - &proxy->chk_fd_parent_addrs[i+1], - (proxy->chk_fd_parent_count - i - 1) - * sizeof(proxy->chk_fd_parent_addrs[0])); - - HDmemmove(&proxy->chk_fd_parent_ptrs[i], - &proxy->chk_fd_parent_ptrs[i+1], - (proxy->chk_fd_parent_count - i - 1) - * sizeof(proxy->chk_fd_parent_ptrs[0])); - } + HDmemmove(&proxy->chk_fd_parent_ptrs[u], + &proxy->chk_fd_parent_ptrs[u + 1], + (proxy->chk_fd_parent_count - u - 1) * sizeof(proxy->chk_fd_parent_ptrs[0])); + } /* end if */ proxy->chk_fd_parent_count--; /* shrink or free the fd parent ptr and addr lists as appropriate */ - if( proxy->chk_fd_parent_count == 0 ) { - - proxy->chk_fd_parent_addrs = (haddr_t *) - H5FL_BLK_FREE(parent_addr, proxy->chk_fd_parent_addrs); - - proxy->chk_fd_parent_ptrs = (void **) - H5FL_BLK_FREE(parent_ptr, proxy->chk_fd_parent_ptrs); - + if(proxy->chk_fd_parent_count == 0) { + proxy->chk_fd_parent_addrs = (haddr_t *)H5FL_BLK_FREE(parent_addr, proxy->chk_fd_parent_addrs); + proxy->chk_fd_parent_ptrs = (void **)H5FL_BLK_FREE(parent_ptr, proxy->chk_fd_parent_ptrs); proxy->chk_fd_parent_alloc = 0; - - } - else if ( ( proxy->chk_fd_parent_count > H5O_FD_PAR_LIST_BASE ) && - ( proxy->chk_fd_parent_count <= - (proxy->chk_fd_parent_alloc / 4) ) ) { - - if ( NULL == (proxy->chk_fd_parent_addrs = (haddr_t *) - H5FL_BLK_REALLOC(parent_addr, proxy->chk_fd_parent_addrs, - (proxy->chk_fd_parent_alloc / 4) * - sizeof(haddr_t))) ) - + } /* end if */ + else if((proxy->chk_fd_parent_count > H5O_FD_PAR_LIST_BASE) && + (proxy->chk_fd_parent_count <= (proxy->chk_fd_parent_alloc / 4))) { + if(NULL == (proxy->chk_fd_parent_addrs = (haddr_t *)H5FL_BLK_REALLOC(parent_addr, proxy->chk_fd_parent_addrs, (proxy->chk_fd_parent_alloc / 4) * sizeof(haddr_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for chk fd parent addr list") - - if ( NULL == (proxy->chk_fd_parent_ptrs = (void **) - H5FL_BLK_REALLOC(parent_ptr, proxy->chk_fd_parent_ptrs, - (proxy->chk_fd_parent_alloc / 4) * - sizeof(void *))) ) - + if(NULL == (proxy->chk_fd_parent_ptrs = (void **)H5FL_BLK_REALLOC(parent_ptr, proxy->chk_fd_parent_ptrs, (proxy->chk_fd_parent_alloc / 4) * sizeof(void *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for chk fd parent ptr list") - proxy->chk_fd_parent_alloc /= 4; - } /* end if */ - } + } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5O_proxy_undepend_core() */ +} /* end H5O__proxy_undepend_core() */ -- cgit v0.12 From f28ded12d554ec4062ce38d571ea6dbebdb89cfa Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 09:52:39 -0500 Subject: [svn-r28782] Description: Bring r28777 from trunk to revise_chunks branch: Add --enable-memory-alloc-sanity-check option to configure, to track and sanity check memory allocations within the library. This is orthogonal to the --enable-using-memchecker option and can be used with/without it. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- CMakeLists.txt | 8 + config/cmake/cacheinit.cmake | 2 + config/cmake/libhdf5.settings.cmake.in | 1 + config/cmake/mccacheinit.cmake | 2 + configure.ac | 31 ++++ release_docs/INSTALL_CMake.txt | 2 + src/H5.c | 5 + src/H5Dchunk.c | 38 +++- src/H5Dpkg.h | 31 +--- src/H5MM.c | 323 +++++++++++++++++++++++++++++++-- src/H5MMprivate.h | 13 +- src/libhdf5.settings.in | 1 + 12 files changed, 403 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65124ab..23b55c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -376,6 +376,14 @@ if (HDF5_ENABLE_USING_MEMCHECKER) endif (HDF5_ENABLE_USING_MEMCHECKER) #----------------------------------------------------------------------------- +# Option to indicate internal memory allocation sanity checks are enabled +#----------------------------------------------------------------------------- +option (HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF) +if (HDF5_MEMORY_ALLOC_SANITY_CHECK) + set (H5_MEMORY_ALLOC_SANITY_CHECK 1) +endif (HDF5_MEMORY_ALLOC_SANITY_CHECK) + +#----------------------------------------------------------------------------- # Option to use deprecated public API symbols #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 4bef99f..5cae21b 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -36,6 +36,8 @@ set (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and set (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE) +set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memory allocation sanity checks are enabled" FORCE) + set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index ba764a4..cc6ae3e 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -65,6 +65,7 @@ Features: dmalloc: @H5_HAVE_LIBDMALLOC@ Clear file buffers before write: @HDF5_Enable_Clear_File_Buffers@ Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@ +Memory allocation sanity checks: @HDF5_MEMORY_ALLOC_SANITY_CHECK@ Function Stack Tracing: @HDF5_ENABLE_CODESTACK@ Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @HDF5_Enable_Instrument@ diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 19ecc15..e54db1f 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -48,6 +48,8 @@ set (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and set (HDF5_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker is used" FORCE) +set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memory allocation sanity checks are enabled" FORCE) + set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) diff --git a/configure.ac b/configure.ac index 8e0b3a6..28a479e 100644 --- a/configure.ac +++ b/configure.ac @@ -2044,6 +2044,8 @@ AC_ARG_ENABLE([using-memchecker], library. Enabling this causes the library to be more picky about it's memory operations and also disables the library's free space manager code. + This option is orthogonal to the + --enable-memory-alloc-sanity-check option. Default=no.])], [USINGMEMCHECKER=$enableval]) @@ -2062,6 +2064,35 @@ case "X-$USINGMEMCHECKER" in ;; esac +## ---------------------------------------------------------------------- +## Check if they would like to enable the internal memory allocation sanity +## checking code. +## +AC_SUBST([MEMORYALLOCSANITYCHECK]) +AC_MSG_CHECKING([whether internal memory allocation sanity checking is used]) +AC_ARG_ENABLE([memory-alloc-sanity-check], + [AS_HELP_STRING([--enable-memory-alloc-sanity-check], + [Enable this option to turn on internal memory + allocation sanity checking. This could cause + more memory use and somewhat slower allocation. + This option is orthogonal to the + --enable-using-memchecker option. + Default=no.])], + [MEMORYALLOCSANITYCHECK=$enableval]) + +case "X-$MEMORYALLOCSANITYCHECK" in + X-yes) + MEMORYALLOCSANITYCHECK=yes + AC_MSG_RESULT([yes]) + AC_DEFINE([MEMORY_ALLOC_SANITY_CHECK], [1], + [Define to enable internal memory allocation sanity checking.]) + ;; + *) + MEMORYALLOCSANITYCHECK=no + AC_MSG_RESULT([no]) + ;; +esac + ## Checkpoint the cache AC_CACHE_SAVE diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index e745084..37326ed 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -411,6 +411,7 @@ These five steps are described in detail below. set (HDF5_BUILD_PARALLEL_ALL OFF CACHE BOOL "Build Parallel Programs" FORCE) set (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE) set (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE) + set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memory allocation sanity checks are enabled" FORCE) set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) set (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE) @@ -587,6 +588,7 @@ HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF HDF5_ENABLE_TRACE "Enable API tracing capability" OFF HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF +HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF HDF5_NO_PACKAGES "Do not include CPack Packaging" OFF HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF diff --git a/src/H5.c b/src/H5.c index 2086ce8..a522398 100644 --- a/src/H5.c +++ b/src/H5.c @@ -396,6 +396,11 @@ H5_term_library(void) (void)H5MM_free(tmp_open_stream); } /* end while */ +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + /* Sanity check memory allocations */ + H5MM_final_sanity_check(); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + /* Reset flag indicating that the library is being shut down */ H5_TERM_GLOBAL = FALSE; diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 0f6504a..23c744c 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -107,11 +107,36 @@ /*#define H5D_CHUNK_DEBUG */ +/* Flags for the "edge_chunk_state" field below */ +#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */ +#define H5D_RDCC_NEWLY_DISABLED_FILTERS 0x02u /* Filters have been disabled since + * the last flush */ + /******************/ /* Local Typedefs */ /******************/ +/* Raw data chunks are cached. Each entry in the cache is: */ +typedef struct H5D_rdcc_ent_t { + hbool_t locked; /*entry is locked in cache */ + hbool_t dirty; /*needs to be written to disk? */ + hbool_t deleted; /*chunk about to be deleted */ + unsigned edge_chunk_state; /*states related to edge chunks (see above) */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */ + uint32_t rd_count; /*bytes remaining to be read */ + uint32_t wr_count; /*bytes remaining to be written */ + H5F_block_t chunk_block; /*offset/length of chunk in file */ + hsize_t chunk_idx; /*index of chunk in dataset */ + uint8_t *chunk; /*the unfiltered chunk data */ + unsigned idx; /*index in hash table */ + struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */ + struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */ + struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */ + struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */ +} H5D_rdcc_ent_t; +typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */ + /* Callback info for iteration to prune chunks */ typedef struct H5D_chunk_it_ud1_t { H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */ @@ -263,6 +288,11 @@ static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t flush); static hbool_t H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims, const hsize_t *chunk_scaled, const hsize_t *dset_dims); +static void *H5D__chunk_lock(const H5D_io_info_t *io_info, + H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk); +static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, + const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, + uint32_t naccessed); static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size); static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk); @@ -3068,7 +3098,7 @@ done: * *------------------------------------------------------------------------- */ -void * +static void * H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk) { @@ -3086,7 +3116,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, void *chunk = NULL; /*the file chunk */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC HDassert(io_info); HDassert(io_info->dxpl_cache); @@ -3462,7 +3492,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, uint32_t naccessed) { @@ -3470,7 +3500,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Sanity check */ HDassert(io_info); diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 46f2ba9..49d3461 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -403,6 +403,7 @@ typedef struct H5D_virtual_held_file_t { } H5D_virtual_held_file_t; /* The raw data chunk cache */ +struct H5D_rdcc_ent_t; /* Forward declaration of struct used below */ typedef struct H5D_rdcc_t { struct { unsigned ninits; /* Number of chunk creations */ @@ -534,31 +535,6 @@ typedef struct { hsize_t size; /* Accumulated number of bytes for the selection */ } H5D_vlen_bufsize_t; -/* Flags for the "edge_chunk_state" field below */ -#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */ -#define H5D_RDCC_NEWLY_DISABLED_FILTERS 0x02u /* Filters have been disabled since - * the last flush */ - -/* Raw data chunks are cached. Each entry in the cache is: */ -typedef struct H5D_rdcc_ent_t { - hbool_t locked; /*entry is locked in cache */ - hbool_t dirty; /*needs to be written to disk? */ - hbool_t deleted; /*chunk about to be deleted */ - unsigned edge_chunk_state; /*states related to edge chunks (see above) */ - hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */ - uint32_t rd_count; /*bytes remaining to be read */ - uint32_t wr_count; /*bytes remaining to be written */ - H5F_block_t chunk_block; /*offset/length of chunk in file */ - hsize_t chunk_idx; /*index of chunk in dataset */ - uint8_t *chunk; /*the unfiltered chunk data */ - unsigned idx; /*index in hash table */ - struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */ - struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */ - struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */ - struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */ -} H5D_rdcc_ent_t; -typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */ - /*****************************/ /* Package Private Variables */ @@ -684,11 +660,6 @@ H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset); H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_chunk_ud_t *udata); -H5_DLL void *H5D__chunk_lock(const H5D_io_info_t *io_info, - H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk); -H5_DLL herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, - const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, - uint32_t naccessed); H5_DLL herr_t H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes); H5_DLL herr_t H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hsize_t old_dim[]); diff --git a/src/H5MM.c b/src/H5MM.c index a37bbff..05bfb9e 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -25,9 +25,195 @@ */ -#include "H5private.h" -#include "H5Eprivate.h" -#include "H5MMprivate.h" +/****************/ +/* Module Setup */ +/****************/ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ + + +/****************/ +/* Local Macros */ +/****************/ +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +#define H5MM_SIG_SIZE 4 +#define H5MM_HEAD_GUARD_SIZE 8 +#define H5MM_TAIL_GUARD_SIZE 8 +#define H5MM_BLOCK_FROM_BUF(mem) ((H5MM_block_t *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE))) +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +/******************/ +/* Local Typedefs */ +/******************/ + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +/* Memory allocation "block", wrapped around each allocation */ +struct H5MM_block_t; /* Forward declaration for typedef */ +typedef struct H5MM_block_t { + unsigned char sig[H5MM_SIG_SIZE]; /* Signature for the block, to indicate it was allocated with H5MM* interface */ + struct H5MM_block_t *next; /* Pointer to next block in the list of allocated blocks */ + struct H5MM_block_t *prev; /* Pointer to previous block in the list of allocated blocks */ + size_t size; + hbool_t in_use; + unsigned char b[]; +} H5MM_block_t; +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +/********************/ +/* Local Prototypes */ +/********************/ +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +static hbool_t H5MM__is_our_block(void *mem); +static void H5MM__sanity_check_block(const H5MM_block_t *block); +static void H5MM__sanity_check(void *mem); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +/* Constant strings for block signature, head & tail guards */ +static const char H5MM_block_signature_s[H5MM_SIG_SIZE] = {'H', '5', 'M', 'M'}; +static const char H5MM_block_head_guard_s[H5MM_HEAD_GUARD_SIZE] = {'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F'}; +static const char H5MM_block_tail_guard_s[H5MM_TAIL_GUARD_SIZE] = {'B', 'E', 'E', 'F', 'D', 'E', 'A', 'D'}; + +/* Flag to indicate the the interface has been initialized */ +static hbool_t H5MM_init_s = FALSE; + +/* Head of the list of allocated blocks */ +static H5MM_block_t H5MM_block_head_s; + +/* Statistics about block allocations */ +static unsigned long long H5MM_total_alloc_bytes_s = 0; +static unsigned long long H5MM_curr_alloc_bytes_s = 0; +static unsigned long long H5MM_peak_alloc_bytes_s = 0; +static size_t H5MM_max_block_size_s = 0; +static size_t H5MM_total_alloc_blocks_count_s = 0; +static size_t H5MM_curr_alloc_blocks_count_s = 0; +static size_t H5MM_peak_alloc_blocks_count_s = 0; +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + +/*------------------------------------------------------------------------- + * Function: H5MM__is_our_block + * + * Purpose: Try to determine if a memory buffer has been allocated through + * the H5MM* interface, instead of the system's malloc() routines. + * + * Return: Success: TRUE/FALSE + * Failure: (Can't fail) + * + * Programmer: Quincey Koziol + * Dec 30 2015 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5MM__is_our_block(void *mem) +{ + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + + return(0 == HDmemcmp(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE)); +} + + +/*------------------------------------------------------------------------- + * Function: H5MM__sanity_check_block + * + * Purpose: Check a block wrapper around a buffer to validate it. + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Dec 30 2015 + * + *------------------------------------------------------------------------- + */ +static void +H5MM__sanity_check_block(const H5MM_block_t *block) +{ + HDassert(block->size > 0); + HDassert(block->in_use); + /* Check for head & tail guards, if not head of linked list */ + if(block->size != SIZE_T_MAX) { + HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE)); + HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); + } +} + + +/*------------------------------------------------------------------------- + * Function: H5MM__sanity_check + * + * Purpose: Check a buffer to validate it (just calls + * H5MM__sanity_check_block after finding block for buffer) + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Dec 30 2015 + * + *------------------------------------------------------------------------- + */ +static void +H5MM__sanity_check(void *mem) +{ + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + + H5MM__sanity_check_block(block); +} + + +/*------------------------------------------------------------------------- + * Function: H5MM_final_sanity_check + * + * Purpose: Final sanity checks on memory allocation. + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Jan 1 2016 + * + *------------------------------------------------------------------------- + */ +void +H5MM_final_sanity_check(void) +{ + HDassert(0 == H5MM_curr_alloc_bytes_s); + HDassert(0 == H5MM_curr_alloc_blocks_count_s); + HDassert(H5MM_block_head_s.next == &H5MM_block_head_s); + HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s); +#ifdef H5MM_PRINT_MEMORY_STATS + HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s); + HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %llu\n", __func__, H5MM_peak_alloc_bytes_s); + HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s); + HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__, H5MM_total_alloc_blocks_count_s); + HDfprintf(stderr, "%s: H5MM_peak_alloc_blocks_count_s = %zu\n", __func__, H5MM_peak_alloc_blocks_count_s); +#endif /* H5MM_PRINT_MEMORY_STATS */ +} +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ /*------------------------------------------------------------------------- @@ -42,7 +228,6 @@ * bytes usually indicate problems. * * Return: Success: Pointer new memory - * * Failure: NULL * * Programmer: Quincey Koziol @@ -60,12 +245,61 @@ H5MM_malloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if(size) +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + /* Initialize block list head singleton */ + if(!H5MM_init_s) { + HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); + H5MM_block_head_s.next = &H5MM_block_head_s; + H5MM_block_head_s.prev = &H5MM_block_head_s; + H5MM_block_head_s.size = SIZE_T_MAX; + H5MM_block_head_s.in_use = TRUE; + + H5MM_init_s = TRUE; + } /* end if */ +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + if(size) { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + H5MM_block_t *block; + size_t alloc_size = sizeof(H5MM_block_t) + size + H5MM_HEAD_GUARD_SIZE + H5MM_TAIL_GUARD_SIZE; + + if(NULL != (block = (H5MM_block_t *)HDmalloc(alloc_size))) { + /* Set up block */ + HDmemcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE); + block->next = H5MM_block_head_s.next; + H5MM_block_head_s.next = block; + block->next->prev = block; + block->prev = &H5MM_block_head_s; + block->size = size; + block->in_use = TRUE; + HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE); + HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE); + + /* Update statistics */ + H5MM_total_alloc_bytes_s += size; + H5MM_curr_alloc_bytes_s += size; + if(H5MM_curr_alloc_bytes_s > H5MM_peak_alloc_bytes_s) + H5MM_peak_alloc_bytes_s = H5MM_curr_alloc_bytes_s; + if(size > H5MM_max_block_size_s) + H5MM_max_block_size_s = size; + H5MM_total_alloc_blocks_count_s++; + H5MM_curr_alloc_blocks_count_s++; + if(H5MM_curr_alloc_blocks_count_s > H5MM_peak_alloc_blocks_count_s) + H5MM_peak_alloc_blocks_count_s = H5MM_curr_alloc_blocks_count_s; + + /* Set buffer to return */ + ret_value = block->b + H5MM_HEAD_GUARD_SIZE; + } /* end if */ + else + ret_value = NULL; +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ ret_value = HDmalloc(size); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end if */ else ret_value = NULL; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_malloc() */ @@ -83,7 +317,6 @@ H5MM_malloc(size_t size) * * * Return: Success: Pointer new memory - * * Failure: NULL * * Programmer: Quincey Koziol @@ -101,12 +334,18 @@ H5MM_calloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if(size) + if(size) { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(NULL != (ret_value = H5MM_malloc(size))) + HDmemset(ret_value, 0, size); +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ ret_value = HDcalloc((size_t)1, size); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end if */ else ret_value = NULL; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_calloc() */ @@ -123,9 +362,7 @@ H5MM_calloc(size_t size) * Note that the (NULL, 0) combination is undefined behavior * in the C standard. * - * Return: Success: Ptr to new memory if size > 0 - * NULL if size is zero - * + * Return: Success: Ptr to new memory if size > 0, NULL if size is zero * Failure: NULL (input buffer is unchanged on failure) * * Programmer: Robb Matzke @@ -143,17 +380,39 @@ H5MM_realloc(void *mem, size_t size) HDassert(mem || size); - if(NULL == mem && 0 == size) { + if(NULL == mem && 0 == size) /* Not defined in the standard, return NULL */ ret_value = NULL; - } else { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(size > 0) { + if(mem) { + if(H5MM__is_our_block(mem)) { + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + size_t old_size = block->size; + + H5MM__sanity_check(mem); + + ret_value = H5MM_malloc(size); + HDmemcpy(ret_value, mem, MIN(size, old_size)); + H5MM_xfree(mem); + } /* end if */ + else + ret_value = HDrealloc(mem, size); + } + else + ret_value = H5MM_malloc(size); + } + else + ret_value = H5MM_xfree(mem); +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ ret_value = HDrealloc(mem, size); /* Some platforms do not return NULL if size is zero. */ if(0 == size) ret_value = NULL; - } +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end else */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_realloc() */ @@ -250,8 +509,38 @@ H5MM_xfree(void *mem) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if(mem) + if(mem) { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(H5MM__is_our_block(mem)) { + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + + /* Run sanity checks on this block and its neighbors */ + H5MM__sanity_check(mem); + H5MM__sanity_check_block(block->next); + H5MM__sanity_check_block(block->prev); + + /* Update statistics */ + H5MM_curr_alloc_bytes_s -= block->size; + H5MM_curr_alloc_blocks_count_s--; + + /* Reset block info */ + HDmemset(block->sig, 0, H5MM_SIG_SIZE); + block->next->prev = block->prev; + block->prev->next = block->next; + block->next = NULL; + block->prev = NULL; + block->in_use = FALSE; + + /* Free the block (finally!) */ + HDfree(block); + } + else + HDfree(mem); +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ HDfree(mem); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end if */ - FUNC_LEAVE_NOAPI(NULL); + FUNC_LEAVE_NOAPI(NULL) } /* end H5MM_xfree() */ + diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 0d608b2..c494a60 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -21,8 +21,6 @@ * * Purpose: Private header for memory management. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MMprivate_H @@ -33,7 +31,12 @@ /* Private headers needed by this file */ #include "H5private.h" +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +/*#define H5MM_PRINT_MEMORY_STATS */ +#define H5MM_free(Z) H5MM_xfree(Z) +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ #define H5MM_free(Z) HDfree(Z) +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ /* * Library prototypes... @@ -44,5 +47,9 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size); H5_DLL char *H5MM_xstrdup(const char *s); H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +H5_DLL void H5MM_final_sanity_check(void); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + +#endif /* _H5MMprivate_H */ -#endif diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 2355543..90224c1 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -66,6 +66,7 @@ Features: dmalloc: @HAVE_DMALLOC@ Clear file buffers before write: @CLEARFILEBUF@ Using memory checker: @USINGMEMCHECKER@ +Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ Function Stack Tracing: @CODESTACK@ Strict File Format Checks: @STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @INSTRUMENT@ -- cgit v0.12 From 5bf1c024503fac87e4504f91bf821d43507c4508 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 10:36:23 -0500 Subject: [svn-r28783] Description: Comment out v2 B-tree test while I debug it. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- test/testswmr.sh.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index 5165fd1..c0f70b6 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -124,7 +124,9 @@ while [ $# -gt 0 ]; do done # Loop over index types -for index_type in "-i ea" "-i b2" +# Comment out until I figure out the v2 B-tree bug -QAK +#for index_type in "-i ea" "-i b2" +for index_type in "-i ea" do # Try with and without compression for compress in "" "-c 5" -- cgit v0.12 From fd24af380a6666b94491614d3cece80aa3ed763d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 16:06:42 -0500 Subject: [svn-r28791] Description: Portability fix from 'SIZE_T_MAX' to 'SIZET_MAX'. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel Linux/32 2.6.x (jam) w/serial --- src/H5MM.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index 05bfb9e..b6e77eb 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -157,7 +157,7 @@ H5MM__sanity_check_block(const H5MM_block_t *block) HDassert(block->size > 0); HDassert(block->in_use); /* Check for head & tail guards, if not head of linked list */ - if(block->size != SIZE_T_MAX) { + if(block->size != SIZET_MAX) { HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE)); HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); } @@ -251,7 +251,7 @@ H5MM_malloc(size_t size) HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); H5MM_block_head_s.next = &H5MM_block_head_s; H5MM_block_head_s.prev = &H5MM_block_head_s; - H5MM_block_head_s.size = SIZE_T_MAX; + H5MM_block_head_s.size = SIZET_MAX; H5MM_block_head_s.in_use = TRUE; H5MM_init_s = TRUE; -- cgit v0.12 From 1b00123b2a0a2d77f1c19a473fce465cfa2bba9a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 21:48:22 -0500 Subject: [svn-r28796] Description: Bring r28795 from trunk to revise_chunks branch: Clean up more memory allocation mis-matches. Tested on: Linux/32 2.6.x (jam) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5E.c | 5 +++++ src/H5PL.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/H5E.c b/src/H5E.c index 4374f1d..efa83e4 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1417,8 +1417,13 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, done: if(va_started) va_end(ap); +#ifdef H5_HAVE_VASPRINTF + if(tmp) + HDfree(tmp); +#else /* H5_HAVE_VASPRINTF */ if(tmp) H5MM_xfree(tmp); +#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ diff --git a/src/H5PL.c b/src/H5PL.c index 4c35c09..a196884 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -413,9 +413,9 @@ H5PL__init_path_table(void) */ origin_dl_path = HDgetenv("HDF5_PLUGIN_PATH"); if(NULL == origin_dl_path) - dl_path = HDstrdup(H5PL_DEFAULT_PATH); + dl_path = H5MM_strdup(H5PL_DEFAULT_PATH); else - dl_path = HDstrdup(origin_dl_path); + dl_path = H5MM_strdup(origin_dl_path); if(NULL == dl_path) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") @@ -425,7 +425,7 @@ H5PL__init_path_table(void) /* Check for too many directories in path */ if(H5PL_num_paths_g == H5PL_MAX_PATH_NUM) HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "too many directories in path for table") - if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = HDstrdup(dir))) + if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = H5MM_strdup(dir))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") H5PL_num_paths_g++; dir = HDstrtok(NULL, H5PL_PATH_SEPARATOR); -- cgit v0.12 From b5ae4e56edfda4e5a7a0b8d7ad2e7f2c894a850a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 23:24:01 -0500 Subject: [svn-r28803] Description: Bring r28797, r28798, r28800, and r28802 from trunk to revise_chunks branch: Misc. memory allocation cleanups Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5B2.c | 9 +++++---- src/H5B2hdr.c | 15 ++++++--------- src/H5B2int.c | 35 ++++++++++++++--------------------- src/H5Dchunk.c | 4 ++-- src/H5Dmpio.c | 30 +++++++++++++++++------------- src/H5Dvirtual.c | 10 +++++----- src/H5FDlog.c | 14 ++++++-------- src/H5Ocopy.c | 4 ++-- src/H5Pdcpl.c | 4 ++-- 9 files changed, 59 insertions(+), 66 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index a36e2f5..611b0eb 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -42,6 +42,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -641,7 +642,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -649,7 +650,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1315,7 +1316,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1323,7 +1324,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 414d3c3..0676f30 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -38,7 +38,8 @@ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -630,14 +631,10 @@ H5B2__hdr_free(H5B2_hdr_t *hdr) } /* end if */ /* Release the min & max record info, if set */ - if(hdr->min_native_rec) { - HDfree(hdr->min_native_rec); - hdr->min_native_rec = NULL; - } /* end if */ - if(hdr->max_native_rec) { - HDfree(hdr->max_native_rec); - hdr->max_native_rec = NULL; - } /* end if */ + if(hdr->min_native_rec) + hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec); + if(hdr->max_native_rec) + hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec); /* Free B-tree header info */ hdr = H5FL_FREE(H5B2_hdr_t, hdr); diff --git a/src/H5B2int.c b/src/H5B2int.c index 972b91c..e66d430 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -38,7 +38,8 @@ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -2387,7 +2388,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -2395,7 +2396,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -2688,7 +2689,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -2696,7 +2697,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -3348,18 +3349,14 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr /* (Don't use 'else' for the idx check, to allow for root leaf node) */ if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->min_native_rec) { - HDfree(hdr->min_native_rec); - hdr->min_native_rec = NULL; - } /* end if */ + if(hdr->min_native_rec) + hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->max_native_rec) { - HDfree(hdr->max_native_rec); - hdr->max_native_rec = NULL; - } /* end if */ + if(hdr->max_native_rec) + hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec); } /* end if */ } /* end if */ } /* end if */ @@ -3745,18 +3742,14 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* (Don't use 'else' for the idx check, to allow for root leaf node) */ if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->min_native_rec) { - HDfree(hdr->min_native_rec); - hdr->min_native_rec = NULL; - } /* end if */ + if(hdr->min_native_rec) + hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->max_native_rec) { - HDfree(hdr->max_native_rec); - hdr->max_native_rec = NULL; - } /* end if */ + if(hdr->max_native_rec) + hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec); } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 23c744c..a3ef0e5 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4011,7 +4011,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, write collectively at the end */ /* allocate/resize address array if no more space left */ if(0 == chunk_info.num_io % 1024) - if(NULL == (chunk_info.addr = (haddr_t *)HDrealloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t)))) + if(NULL == (chunk_info.addr = (haddr_t *)H5MM_realloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for chunk addresses") /* Store the chunk's address for later */ @@ -4104,7 +4104,7 @@ done: #ifdef H5_HAVE_PARALLEL if(using_mpi && chunk_info.addr) - HDfree(chunk_info.addr); + H5MM_free(chunk_info.addr); #endif FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index a5f34d1..0ba340a 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1680,7 +1680,6 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, MPI_Comm comm; int ic, root; int mpi_code; - hbool_t mem_cleanup = FALSE; #ifdef H5_HAVE_INSTRUMENTED_LIBRARY int new_value; htri_t check_prop; @@ -1715,12 +1714,14 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, threshold_nproc_per_chunk = mpi_size * percent_nproc_per_chunk/100; /* Allocate memory */ - io_mode_info = (uint8_t *)H5MM_calloc(total_chunks); - mergebuf = H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks); + if(NULL == (io_mode_info = (uint8_t *)H5MM_calloc(total_chunks))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate I/O mode info buffer") + if(NULL == (mergebuf = H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mergebuf buffer") tempbuf = mergebuf + total_chunks; if(mpi_rank == root) - recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * mpi_size); - mem_cleanup = TRUE; + if(NULL == (recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * mpi_size))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate recv I/O mode info buffer") /* Obtain the regularity and selection information for all chunks in this process. */ chunk_node = H5SL_first(fm->sel_chunks); @@ -1742,11 +1743,12 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, /* pre-computing: calculate number of processes and regularity of the selection occupied in each chunk */ - nproc_per_chunk = (int*)H5MM_calloc(total_chunks * sizeof(int)); + if(NULL == (nproc_per_chunk = (int*)H5MM_calloc(total_chunks * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate nproc_per_chunk buffer") /* calculating the chunk address */ if(H5D__chunk_addrmap(io_info, chunk_addr) < 0) { - HDfree(nproc_per_chunk); + H5MM_free(nproc_per_chunk); HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") } /* end if */ @@ -1774,7 +1776,7 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, HDmemcpy(mergebuf, assign_io_mode, total_chunks); HDmemcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks); - HDfree(nproc_per_chunk); + H5MM_free(nproc_per_chunk); } /* end if */ /* Broadcasting the MPI_IO option info. and chunk address info. */ @@ -1824,11 +1826,13 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, #endif done: - if(mem_cleanup) { - HDfree(io_mode_info); - HDfree(mergebuf); - if(mpi_rank == root) - HDfree(recv_io_mode_info); + if(io_mode_info) + H5MM_free(io_mode_info); + if(mergebuf) + H5MM_free(mergebuf); + if(recv_io_mode_info) { + HDassert(mpi_rank == root); + H5MM_free(recv_io_mode_info); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 93fc61c..bcafde2 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -449,10 +449,10 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Copy original source names */ if(NULL == (layout->storage.u.virt.list[i].source_file_name - = HDstrdup(orig_list[i].source_file_name))) + = H5MM_strdup(orig_list[i].source_file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") if(NULL == (layout->storage.u.virt.list[i].source_dset_name - = HDstrdup(orig_list[i].source_dset_name))) + = H5MM_strdup(orig_list[i].source_dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") /* Copy source selection */ @@ -491,7 +491,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) } /* end if */ else if(NULL == (layout->storage.u.virt.list[i].source_dset.file_name - = HDstrdup(orig_list[i].source_dset.file_name))) + = H5MM_strdup(orig_list[i].source_dset.file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") } /* end if */ if(orig_list[i].source_dset.dset_name) { @@ -507,7 +507,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) } /* end if */ else if(NULL == (layout->storage.u.virt.list[i].source_dset.dset_name - = HDstrdup(orig_list[i].source_dset.dset_name))) + = H5MM_strdup(orig_list[i].source_dset.dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") } /* end if */ @@ -1127,7 +1127,7 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst, /* Duplicate name segment */ if(p_src->name_segment) { - if(NULL == ((*p_dst)->name_segment = HDstrdup(p_src->name_segment))) + if(NULL == ((*p_dst)->name_segment = H5MM_strdup(p_src->name_segment))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to duplicate name segment") } /* end if */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 1273dba..8ef776d 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -406,7 +406,7 @@ H5FD_log_fapl_copy(const void *_old_fa) /* Deep copy the log file name */ if(old_fa->logfile != NULL) - if(NULL == (new_fa->logfile = H5MM_xstrdup(old_fa->logfile))) + if(NULL == (new_fa->logfile = H5MM_strdup(old_fa->logfile))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate log file name") /* Set return value */ @@ -416,7 +416,7 @@ done: if(NULL == ret_value) if(new_fa) { if(new_fa->logfile) - H5MM_free(new_fa->logfile); + new_fa->logfile = H5MM_xfree(new_fa->logfile); H5MM_free(new_fa); } /* end if */ @@ -445,7 +445,7 @@ H5FD_log_fapl_free(void *_fa) /* Free the fapl information */ if(fa->logfile) - H5MM_xfree(fa->logfile); + fa->logfile = H5MM_xfree(fa->logfile); H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) @@ -594,7 +594,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the flags for logging */ file->fa.flags = fa->flags; if(fa->logfile) - file->fa.logfile = HDstrdup(fa->logfile); + file->fa.logfile = H5MM_strdup(fa->logfile); else file->fa.logfile = NULL; file->fa.buf_size = fa->buf_size; @@ -798,10 +798,8 @@ H5FD_log_close(H5FD_t *_file) HDfclose(file->logfp); } /* end if */ - if(file->fa.logfile) { - HDfree(file->fa.logfile); - file->fa.logfile = NULL; - } + if(file->fa.logfile) + file->fa.logfile = H5MM_xfree(file->fa.logfile); /* Release the file info */ file = H5FL_FREE(H5FD_log_t, file); diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index b1d38f4..a8ee440 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -485,7 +485,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Allocate memory for "deleted" array. This array marks the message in * the source that shouldn't be copied to the destination. */ - if(NULL == (deleted = (hbool_t *)HDmalloc(sizeof(hbool_t) * oh_src->nmesgs))) + if(NULL == (deleted = (hbool_t *)H5MM_malloc(sizeof(hbool_t) * oh_src->nmesgs))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDmemset(deleted, FALSE, sizeof(hbool_t) * oh_src->nmesgs); @@ -892,7 +892,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, done: /* Free deleted array */ if(deleted) - HDfree(deleted); + H5MM_free(deleted); /* Release pointer to source object header and its derived objects */ if(oh_src && H5O_unprotect(oloc_src, dxpl_id, oh_src, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index c6a8f9a..03a4668 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2227,9 +2227,9 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, HDmemset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */ if(NULL == (ent->source_dset.virtual_select = H5S_copy(vspace, FALSE, TRUE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") - if(NULL == (ent->source_file_name = HDstrdup(src_file_name))) + if(NULL == (ent->source_file_name = H5MM_xstrdup(src_file_name))) HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name") - if(NULL == (ent->source_dset_name = HDstrdup(src_dset_name))) + if(NULL == (ent->source_dset_name = H5MM_xstrdup(src_dset_name))) HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name") if(NULL == (ent->source_select = H5S_copy(src_space, FALSE, TRUE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection") -- cgit v0.12 From 282692288961cc76fadafb94a067a8a28b982e9e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 5 Jan 2016 05:39:26 -0500 Subject: [svn-r28806] Merge from trunk: 28792 - H5Epubgen.h extern C fix 28788 - cleanup of new files in tfile.c Merge from hdf5_1_10_alpha: 28706 - only test (release-1) when release # > 0 in major/minor/release checks Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- bin/make_err | 12 ++++++++++++ test/tfile.c | 8 ++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bin/make_err b/bin/make_err index 4b1f474..1b39d53fb 100755 --- a/bin/make_err +++ b/bin/make_err @@ -175,6 +175,12 @@ sub create_public ($) { print_warning(*HEADER); print_startprotect(*HEADER, $file); + # Begin extern C block + print HEADER "\n"; + print HEADER "#ifdef __cplusplus\n"; + print HEADER "extern \"C\" {\n"; + print HEADER "#endif\n"; + # Iterate over all the major errors print HEADER "\n/*********************/\n"; print HEADER "/* Major error codes */\n"; @@ -202,6 +208,12 @@ sub create_public ($) { } } + # End extern C block + print HEADER "\n"; + print HEADER "#ifdef __cplusplus\n"; + print HEADER "}\n"; + print HEADER "#endif\n"; + print_endprotect(*HEADER, $file); # Close header file diff --git a/test/tfile.c b/test/tfile.c index 8180396..3fbfce3 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3435,7 +3435,8 @@ test_libver_macros(void) VERIFY(H5_VERSION_GE(major-1,minor,release+1), TRUE, "H5_VERSION_GE"); VERIFY(H5_VERSION_GE(major,minor-1,release), TRUE, "H5_VERSION_GE"); VERIFY(H5_VERSION_GE(major,minor-1,release+1), TRUE, "H5_VERSION_GE"); - VERIFY(H5_VERSION_GE(major,minor,release-1), TRUE, "H5_VERSION_GE"); + if(H5_VERS_RELEASE > 0) + VERIFY(H5_VERSION_GE(major,minor,release-1), TRUE, "H5_VERSION_GE"); VERIFY(H5_VERSION_GE(major+1,minor,release), FALSE, "H5_VERSION_GE"); VERIFY(H5_VERSION_GE(major+1,minor-1,release), FALSE, "H5_VERSION_GE"); @@ -3457,7 +3458,8 @@ test_libver_macros(void) VERIFY(H5_VERSION_LE(major-1,minor+1,release+1), FALSE, "H5_VERSION_LE"); VERIFY(H5_VERSION_LE(major,minor-1,release), FALSE, "H5_VERSION_LE"); VERIFY(H5_VERSION_LE(major,minor-1,release+1), FALSE, "H5_VERSION_LE"); - VERIFY(H5_VERSION_LE(major,minor,release-1), FALSE, "H5_VERSION_LE"); + if(H5_VERS_RELEASE > 0) + VERIFY(H5_VERSION_LE(major,minor,release-1), FALSE, "H5_VERSION_LE"); } /* test_libver_macros() */ /**************************************************************** @@ -3739,5 +3741,7 @@ cleanup_file(void) HDremove(FILE3); HDremove(FILE4); HDremove(FILE5); + HDremove(FILE6); + HDremove(FILE7); } -- cgit v0.12 From 11c3b4fdeb8c86a782eabd756b8c82a649ab0812 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 10:48:25 -0500 Subject: [svn-r28812] Description: Bring r28811 from trunk to revise_chunks branch: Switch v2 B-tree min & max records to be void*'s to be cleaner and generate less warnings. Tested on: Linux/32 2.6.x (jam) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5B2.c | 8 ++++---- src/H5B2int.c | 8 ++++---- src/H5B2pkg.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 611b0eb..62cd47e 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -642,7 +642,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -650,7 +650,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1316,7 +1316,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1324,7 +1324,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ diff --git a/src/H5B2int.c b/src/H5B2int.c index e66d430..a9c9ecc 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2388,7 +2388,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -2396,7 +2396,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -2689,7 +2689,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -2697,7 +2697,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index b6410fd..46f3d83 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -186,8 +186,8 @@ typedef struct H5B2_hdr_t { hbool_t swmr_write; /* Whether we are doing SWMR writes */ struct H5B2_leaf_t *shadowed_leaf; /* Linked list of shadowed leaf nodes */ struct H5B2_internal_t *shadowed_internal; /* Linked list of shadowed internal nodes */ - uint8_t *min_native_rec; /* Pointer to minimum native record */ - uint8_t *max_native_rec; /* Pointer to maximum native record */ + void *min_native_rec; /* Pointer to minimum native record */ + void *max_native_rec; /* Pointer to maximum native record */ /* Client information (not stored) */ const H5B2_class_t *cls; /* Class of B-tree client */ -- cgit v0.12 From 3d26e47210b85a3d5e82d6a545ac589da96d9bcd Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 6 Jan 2016 12:09:16 -0500 Subject: [svn-r28816] Cleaned up warnings in test/tarray.c before major rework. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- test/tarray.c | 168 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index 9c79f41..28798c2 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -178,7 +178,7 @@ test_array_funcs(void) { hid_t type; /* Datatype ID */ hsize_t tdims1[] = {ARRAY1_DIM1}; - int size; + size_t size; H5T_pad_t inpad; H5T_norm_t norm; H5T_cset_t cset; @@ -190,13 +190,13 @@ test_array_funcs(void) CHECK(type, FAIL, "H5Tarray_create2"); size=H5Tget_precision(type); - CHECK(size, FAIL, "H5Tget_precision"); + CHECK(size, 0, "H5Tget_precision"); size=H5Tget_size(type); - CHECK(size, FAIL, "H5Tget_size"); + CHECK(size, 0, "H5Tget_size"); size=H5Tget_ebias(type); - CHECK(size, FAIL, "H5Tget_ebias"); + CHECK(size, 0, "H5Tget_ebias"); ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); CHECK(ret, FAIL, "H5Tset_pad"); @@ -541,7 +541,7 @@ test_array_compound_atomic(void) 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].f = (float)i * 2.5F + (float)j; } /* end for */ /* Create file */ @@ -745,7 +745,7 @@ test_array_compound_array(void) for(j=0; jnsubfields = 3; /* Initialize the offsets */ /* ----------------------- */ - dtsinfo.offset[0] = HOFFSET(CmpField, a); - dtsinfo.offset[1] = HOFFSET(CmpField, b); - dtsinfo.offset[2] = HOFFSET(CmpField, c); + dtsinfo->offset[0] = HOFFSET(CmpField, a); + dtsinfo->offset[1] = HOFFSET(CmpField, b); + dtsinfo->offset[2] = HOFFSET(CmpField, c); /* Initialize the data type IDs */ /* ---------------------------- */ - dtsinfo.datatype[0] = H5T_NATIVE_INT; - dtsinfo.datatype[1] = H5T_NATIVE_FLOAT; - dtsinfo.datatype[2] = H5T_NATIVE_DOUBLE; + dtsinfo->datatype[0] = H5T_NATIVE_INT; + dtsinfo->datatype[1] = H5T_NATIVE_FLOAT; + dtsinfo->datatype[2] = H5T_NATIVE_DOUBLE; /* Initialize the names of data members */ /* ------------------------------------ */ - for (i = 0; i < dtsinfo.nsubfields; i++) - dtsinfo.name[i] = (char *)HDcalloc((size_t)20, sizeof(char)); + for (i = 0; i < dtsinfo->nsubfields; i++) + dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char)); - strcpy(dtsinfo.name[0], "One"); - strcpy(dtsinfo.name[1], "Two"); - strcpy(dtsinfo.name[2], "Three"); + strcpy(dtsinfo->name[0], "One"); + strcpy(dtsinfo->name[1], "Two"); + strcpy(dtsinfo->name[2], "Three"); /* Create file */ @@ -1585,17 +1584,16 @@ test_array_bkg(void) /* Add members to the compound data type */ /* -------------------------------------- */ - for ( i = 0; i < dtsinfo.nsubfields; i++) - { - array_dt = H5Tarray_create2(dtsinfo.datatype[i], ndims[i], dima); + for ( i = 0; i < dtsinfo->nsubfields; i++) { + array_dt = H5Tarray_create2(dtsinfo->datatype[i], ndims[i], dima); CHECK(array_dt, FAIL, "H5Tarray_create2"); - status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt); + status = H5Tinsert (type, dtsinfo->name[i], dtsinfo->offset[i], array_dt); CHECK(status, FAIL, "H5Tinsert"); status = H5Tclose(array_dt); CHECK(status, FAIL, "H5Tclose"); - } + } /* end for */ /* Create the dataset */ /* ------------------ */ @@ -1617,23 +1615,23 @@ test_array_bkg(void) if(cf[i].a[j]!=cfr[i].a[j]) { TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; - } + } /* end if */ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]); continue; - } + } /* end if */ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]); continue; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ /* Release memory resources */ /* ------------------------ */ - for (i = 0; i < dtsinfo.nsubfields; i++) - HDfree(dtsinfo.name[i]); + for (i = 0; i < dtsinfo->nsubfields; i++) + HDfree(dtsinfo->name[i]); /* Release IDs */ @@ -1651,9 +1649,9 @@ test_array_bkg(void) CHECK(status, FAIL, "H5Fclose"); -/******************************/ -/* Reopen the file and update */ -/******************************/ + /******************************/ + /* Reopen the file and update */ + /******************************/ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -1674,7 +1672,7 @@ test_array_bkg(void) /* -------------------------------- */ for (i=0; i< LENGTH; i++) for (j = 0; j < ALEN; j++) - cf[i].b[j]=fld[i].b[j] = 1.313F; + cf[i].b[j] = fld[i].b[j] = 1.313F; status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld); CHECK(status, FAIL, "H5Dwrite"); @@ -1688,7 +1686,7 @@ test_array_bkg(void) if(!H5_FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) { TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(double)fld[i].b[j],(int)i,(int)j,(double)fldr[i].b[j]); continue; - } + } /* end if */ status = H5Tclose (type); CHECK(status, FAIL, "H5Tclose"); @@ -1710,17 +1708,17 @@ test_array_bkg(void) if(cf[i].a[j]!=cfr[i].a[j]) { TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; - } + } /* end if */ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]); continue; - } + } /* end if */ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]); continue; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ status = H5Dclose(dataset); CHECK(status, FAIL, "H5Dclose"); @@ -1731,9 +1729,9 @@ test_array_bkg(void) status = H5Fclose(fid); CHECK(status, FAIL, "H5Fclose"); -/****************************************************/ -/* Reopen the file and print out all the data again */ -/****************************************************/ + /****************************************************/ + /* Reopen the file and print out all the data again */ + /****************************************************/ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -1759,17 +1757,17 @@ test_array_bkg(void) if(cf[i].a[j]!=cfr[i].a[j]) { TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; - } + } /* end if */ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]); continue; - } + } /* end if */ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]); continue; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ status = H5Dclose(dataset); CHECK(status, FAIL, "H5Dclose"); @@ -1779,6 +1777,8 @@ test_array_bkg(void) status = H5Fclose(fid); CHECK(status, FAIL, "H5Fclose"); + + HDfree(dtsinfo); } /* end test_array_bkg() */ /**************************************************************** -- cgit v0.12 From 1d3f79343ddb2a1eaef14831f98dab74c923c874 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 12:51:58 -0500 Subject: [svn-r28820] Description: Bring r28815 & r28819 from trunk to revise chunks branch (memory alloc sanity checking fixes). Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel Linux/32 2.6.x (jam) w/serial --- src/H5MM.c | 61 ++++++++++++++++++++++++++++++++++++++++++------------- src/H5MMprivate.h | 1 + 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index b6e77eb..b830d21 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -60,9 +60,14 @@ typedef struct H5MM_block_t { unsigned char sig[H5MM_SIG_SIZE]; /* Signature for the block, to indicate it was allocated with H5MM* interface */ struct H5MM_block_t *next; /* Pointer to next block in the list of allocated blocks */ struct H5MM_block_t *prev; /* Pointer to previous block in the list of allocated blocks */ - size_t size; - hbool_t in_use; - unsigned char b[]; + union { + struct { + size_t size; /* Size of allocated block */ + hbool_t in_use; /* Whether the block is in use or is free */ + } info; + double _align; /* Align following buffer (b) to double boundary (unused) */ + } u; + unsigned char b[]; /* Buffer for caller (includes header and footer) */ } H5MM_block_t; #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ @@ -154,12 +159,12 @@ H5MM__is_our_block(void *mem) static void H5MM__sanity_check_block(const H5MM_block_t *block) { - HDassert(block->size > 0); - HDassert(block->in_use); + HDassert(block->u.info.size > 0); + HDassert(block->u.info.in_use); /* Check for head & tail guards, if not head of linked list */ - if(block->size != SIZET_MAX) { + if(block->u.info.size != SIZET_MAX) { HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE)); - HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); + HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->u.info.size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); } } @@ -187,6 +192,31 @@ H5MM__sanity_check(void *mem) /*------------------------------------------------------------------------- + * Function: H5MM_sanity_check_all + * + * Purpose: Sanity check all current memory allocations. + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Jan 5 2016 + * + *------------------------------------------------------------------------- + */ +void +H5MM_sanity_check_all(void) +{ + H5MM_block_t *curr; + + curr = H5MM_block_head_s.next; + while(curr != &H5MM_block_head_s) { + H5MM__sanity_check_block(curr); + curr = curr->next; + } /* end while */ +} /* end H5MM_sanity_check_all() */ + + +/*------------------------------------------------------------------------- * Function: H5MM_final_sanity_check * * Purpose: Final sanity checks on memory allocation. @@ -246,13 +276,16 @@ H5MM_malloc(size_t size) FUNC_ENTER_NOAPI_NOINIT_NOERR #if defined H5_MEMORY_ALLOC_SANITY_CHECK + /* Make certain that the buffer in the struct is properly aligned */ + HDcompile_assert(offsetof(H5MM_block_t, b) % sizeof(double) == 0); + /* Initialize block list head singleton */ if(!H5MM_init_s) { HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); H5MM_block_head_s.next = &H5MM_block_head_s; H5MM_block_head_s.prev = &H5MM_block_head_s; - H5MM_block_head_s.size = SIZET_MAX; - H5MM_block_head_s.in_use = TRUE; + H5MM_block_head_s.u.info.size = SIZET_MAX; + H5MM_block_head_s.u.info.in_use = TRUE; H5MM_init_s = TRUE; } /* end if */ @@ -270,8 +303,8 @@ H5MM_malloc(size_t size) H5MM_block_head_s.next = block; block->next->prev = block; block->prev = &H5MM_block_head_s; - block->size = size; - block->in_use = TRUE; + block->u.info.size = size; + block->u.info.in_use = TRUE; HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE); HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE); @@ -389,7 +422,7 @@ H5MM_realloc(void *mem, size_t size) if(mem) { if(H5MM__is_our_block(mem)) { H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); - size_t old_size = block->size; + size_t old_size = block->u.info.size; H5MM__sanity_check(mem); @@ -520,7 +553,7 @@ H5MM_xfree(void *mem) H5MM__sanity_check_block(block->prev); /* Update statistics */ - H5MM_curr_alloc_bytes_s -= block->size; + H5MM_curr_alloc_bytes_s -= block->u.info.size; H5MM_curr_alloc_blocks_count_s--; /* Reset block info */ @@ -529,7 +562,7 @@ H5MM_xfree(void *mem) block->prev->next = block->next; block->next = NULL; block->prev = NULL; - block->in_use = FALSE; + block->u.info.in_use = FALSE; /* Free the block (finally!) */ HDfree(block); diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index c494a60..14bd28d 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -48,6 +48,7 @@ H5_DLL char *H5MM_xstrdup(const char *s); H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); #if defined H5_MEMORY_ALLOC_SANITY_CHECK +H5_DLL void H5MM_sanity_check_all(void); H5_DLL void H5MM_final_sanity_check(void); #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ -- cgit v0.12 From ca6e18e28a4a3e96940145cfcebaff17265a2c75 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 14:11:34 -0500 Subject: [svn-r28825] Description: Bring r28824 from trunk to revise_chunks branch: Reduce asserts on buffer alignment. Tested on: MacOSX/64 10.11.2 (amazon) w/parallel & serial (h5committest not required on this branch) --- src/H5MM.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index b830d21..09e6461 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -276,9 +276,6 @@ H5MM_malloc(size_t size) FUNC_ENTER_NOAPI_NOINIT_NOERR #if defined H5_MEMORY_ALLOC_SANITY_CHECK - /* Make certain that the buffer in the struct is properly aligned */ - HDcompile_assert(offsetof(H5MM_block_t, b) % sizeof(double) == 0); - /* Initialize block list head singleton */ if(!H5MM_init_s) { HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); -- cgit v0.12 From d21a92b3eaca784fd9fb251c8d47ce312321ed1e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 15:47:07 -0500 Subject: [svn-r28829] Description: Bring r28828 from trunk to revise_chunks branch: Switch filter plugin to use H5allocate_memory and H5free_memory instead of malloc and free. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- test/dynlib3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/dynlib3.c b/test/dynlib3.c index b3a02ed..e509a52 100644 --- a/test/dynlib3.c +++ b/test/dynlib3.c @@ -81,7 +81,7 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, void *outbuf = NULL; /* Pointer to new buffer */ unsigned char *dst; /* Temporary pointer to destination buffer */ - dst = (unsigned char *)(outbuf = malloc(nbytes + SUFFIX_LEN)); + dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0)); /* Copy raw data */ memcpy((void*)dst, (void*)(*buf), nbytes); @@ -91,7 +91,7 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, memcpy(dst, (void*)GROUP_SUFFIX, SUFFIX_LEN); /* Free input buffer */ - free(*buf); + H5free_memory(*buf); /* Set return values */ *buf_size = nbytes + SUFFIX_LEN; -- cgit v0.12 From 5dd77b99cb999cb5929b2d9ba5dfc65483d2ad1c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 17:06:45 -0500 Subject: [svn-r28833] Description: Bring r28832 from trunk to revise_chunks branch: Reset driver info message when superblock load fails. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Fsuper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index da3bf3d..3752be4 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -546,8 +546,10 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver info message not present") /* Validate and decode driver information */ - if(H5FD_sb_load(f->shared->lf, drvinfo.name, drvinfo.buf) < 0) + if(H5FD_sb_load(f->shared->lf, drvinfo.name, drvinfo.buf) < 0) { + H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "unable to decode driver information") + } /* end if */ /* Reset driver info message */ H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); -- cgit v0.12 From cfae05b15720d67c8b6b2a64960870282cbe143e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 7 Jan 2016 12:24:44 -0500 Subject: [svn-r28836] Fixed the test/tarray.c test in testhdf5. Ostrich w/ gcc --- test/tarray.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index 28798c2..cb5fef9 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1031,8 +1031,8 @@ test_array_vlen_atomic(void) H5T_class_t mclass; /* Datatype class for VL */ hid_t xfer_pid; /* Dataset transfer property list ID */ hsize_t size; /* Number of bytes which will be used */ - int mem_used=0; /* Memory used during allocation */ - int i,j,k; /* counting variables */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k; /* counting variables */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1242,8 +1242,8 @@ test_array_vlen_array(void) H5T_class_t mclass; /* Datatype class for VL */ hid_t xfer_pid; /* Dataset transfer property list ID */ hsize_t size; /* Number of bytes which will be used */ - int mem_used=0; /* Memory used during allocation */ - int i,j,k,l; /* Index variables */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k,l; /* Index variables */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ -- cgit v0.12 From de667a47ed61498d1ccf23500bd292e030129822 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 8 Jan 2016 09:10:26 -0500 Subject: [svn-r28844] Description: Bring r28843 from trunk to revise_chunks branch: Bump number of records for random update test again. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- test/btree2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/btree2.c b/test/btree2.c index 3278b67..2c9bbae 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2675 * 1000) +#define INSERT_MANY_REC (2700 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 -- cgit v0.12 From 26a513c6ddc3dd03982275d5a00228c6c57899e3 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 11 Jan 2016 17:04:36 -0500 Subject: [svn-r28857] Merged r28841 and 28853 from trunk (cmakehdf5 changes) Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 CMake (3.3.2) serial only w/ C++ anf Fortran --- bin/cmakehdf5 | 235 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 122 insertions(+), 113 deletions(-) diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 48869cf..7d9caa8 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -124,12 +124,12 @@ STEP() echo "$banner" with output saved in $logfile (TIMESTAMP; nerror=0 ; - echo "eval $command" - eval $command || nerror=1 ; - TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 + echo "eval $command" + eval $command || nerror=1 ; + TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 if [ $? -ne 0 ]; then - echo "error in '$banner'. $progname aborted." - exit 1 + echo "error in '$banner'. $progname aborted." + exit 1 fi } @@ -143,26 +143,30 @@ INSTALL_HDF5() { myos="`uname -s`" case "$myos" in - Linux) - install_file=./HDF5-${version}-Linux.sh - $install_file --skip-license $* - ;; - Darwin) # Mac OSX DMG file - install_file=HDF5-${version}-Darwin.dmg - test -d hdf5 || mkdir hdf5 - basename=`basename $install_file .dmg` - # mount the DMG file as /Volumes/$basename - # echo 'Y' as yes for license. - echo Y | hdiutil mount $install_file - # copy the contents to the install location - cp -R "/Volumes/$basename/HDF_Group" hdf5 - # unmount the DMG file - hdiutil unmount /Volumes/$basename - ;; - *) # unknown/unsupported OS. - echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" - return 1 - ;; + Linux) + install_file=./HDF5-${version}-Linux.sh + $install_file --skip-license $* + ;; + Darwin) # Mac OSX DMG file + # These steps were a kludge. Need proper support from Cmake engineering. + echo Darwin install step needs proper implementation. Quit. + return 1 + # + install_file=HDF5-${version}-Darwin.dmg + test -d hdf5 || mkdir hdf5 + basename=`basename $install_file .dmg` + # mount the DMG file as /Volumes/$basename + # echo 'Y' as yes for license. + echo Y | hdiutil mount $install_file + # copy the contents to the install location + cp -R "/Volumes/$basename/HDF_Group" hdf5 + # unmount the DMG file + hdiutil unmount /Volumes/$basename + ;; + *) # unknown/unsupported OS. + echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" + return 1 + ;; esac } @@ -172,14 +176,14 @@ INSTALL_HDF5() DUMP_LOGFILE() { for x in $*; do - if [ -f $x ]; then - echo "==================================" - echo "Dumping $x" - echo "==================================" - cat $x - echo "==== END $x =====" - echo - fi + if [ -f $x ]; then + echo "==================================" + echo "Dumping $x" + echo "==================================" + cat $x + echo "==== END $x =====" + echo + fi done } @@ -207,84 +211,84 @@ fi # tools Build tools while [ $# -gt 0 ]; do case "$1" in - --enable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON - ;; - --disable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF - ;; - --enable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON - ;; - --disable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF - ;; - --enable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON - ;; - --disable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF - ;; - --enable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON - ;; - --disable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF - ;; - --enable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON - ;; - --disable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF - ;; - --enable-testing) - build_testing=-DBUILD_TESTING:BOOL=ON - ;; - --disable-testing) - build_testing=-DBUILD_TESTING:BOOL=OFF - ;; - --with-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON - ;; - --with-zlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" - ;; - --without-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF - ;; - --with-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON - szlib_path="" # szlib is in default paths - ;; - --with-szlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" - szlib_path="SZIP_INSTALL=$xarg" - ;; - --without-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF - szlib_path="" # reset the path - ;; - --njobs=*) - njobs=`echo $1 | cut -d= -f2-` - ;; - --enable-verbose) - vflag=1 - ;; - --disable-verbose) - vflag=0 - ;; - --help) - # print the detail help page and exit - HELP - exit 0 - ;; - *) - echo "Unknown options: $1" - HELP - exit 1 - ;; + --enable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON + ;; + --disable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF + ;; + --enable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON + ;; + --disable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF + ;; + --enable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON + ;; + --disable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF + ;; + --enable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON + ;; + --disable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF + ;; + --enable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON + ;; + --disable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF + ;; + --enable-testing) + build_testing=-DBUILD_TESTING:BOOL=ON + ;; + --disable-testing) + build_testing=-DBUILD_TESTING:BOOL=OFF + ;; + --with-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON + ;; + --with-zlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" + ;; + --without-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF + ;; + --with-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON + szlib_path="" # szlib is in default paths + ;; + --with-szlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" + szlib_path="SZIP_INSTALL=$xarg" + ;; + --without-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF + szlib_path="" # reset the path + ;; + --njobs=*) + njobs=`echo $1 | cut -d= -f2-` + ;; + --enable-verbose) + vflag=1 + ;; + --disable-verbose) + vflag=0 + ;; + --help) + # print the detail help page and exit + HELP + exit 0 + ;; + *) + echo "Unknown options: $1" + HELP + exit 1 + ;; esac shift done @@ -313,8 +317,8 @@ fi # setup output of all the log files if verbose is on upon exit trap \ -"if [ $vflag -ne 0 ]; then DUMP_LOGFILE \$configlog \$makelog \$testlog \$packlog \$installlog; fi" \ -0 + "if [ $vflag -ne 0 ]; then DUMP_LOGFILE \$configlog \$makelog \$testlog \$packlog \$installlog; fi" \ + 0 echo Running Cmake for HDF5-${version} ... # 4. Configure the C library, tools and tests with this command: @@ -343,8 +347,13 @@ STEP "Test the library and tools..." "ctest . -C Release $njobs" $testlog # 7. Create an install image with this command: STEP "Create an install image..." "cpack -C Release CPackConfig.cmake" $packlog +# The implementation of installation is imcomplete (only works for linux). +# Screen it out for now till it is completed. +if false; then # 8. Install with this command: STEP "Install..." "INSTALL_HDF5" $installlog +fi + # save the last exit code exit_code=$? -- cgit v0.12 From 943285a89380ada975c6829dd2a5b8fb6d5ead8f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 12 Jan 2016 11:11:41 -0500 Subject: [svn-r28863] Whitespace and commenting cleanup before changes. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 testhdf5 only --- test/tarray.c | 640 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 364 insertions(+), 276 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index cb5fef9..b05a975 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -26,49 +26,75 @@ #include "hdf5.h" -#define FILENAME "tarray1.h5" -#define TESTFILE "tarrold.h5" +#define FILENAME "tarray1.h5" +#define TESTFILE "tarrold.h5" /* 1-D array datatype */ -#define ARRAY1_RANK 1 -#define ARRAY1_DIM1 4 +#define ARRAY1_RANK 1 +#define ARRAY1_DIM1 4 /* 3-D array datatype */ -#define ARRAY2_RANK 3 -#define ARRAY2_DIM1 3 -#define ARRAY2_DIM2 4 -#define ARRAY2_DIM3 5 +#define ARRAY2_RANK 3 +#define ARRAY2_DIM1 3 +#define ARRAY2_DIM2 4 +#define ARRAY2_DIM3 5 /* 2-D array datatype */ -#define ARRAY3_RANK 2 -#define ARRAY3_DIM1 6 -#define ARRAY3_DIM2 3 +#define ARRAY3_RANK 2 +#define ARRAY3_DIM1 6 +#define ARRAY3_DIM2 3 /* 1-D dataset with fixed dimensions */ -#define SPACE1_RANK 1 -#define SPACE1_DIM1 4 +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 -/**************************************************************** -** -** test_array_atomic_1d(): Test basic array datatype code. -** Tests 1-D array of atomic datatypes -** -****************************************************************/ +/* Parameters used with the test_array_bkg() test */ +#define FIELDNAME "ArrayofStructures" +#define LENGTH 5 +#define ALEN 10 +#define RANK 1 +#define NMAX 100 + +/* Struct used with test_array_bkg() test */ +typedef struct +{ + int nsubfields; + char *name[NMAX]; + size_t offset[NMAX]; + hid_t datatype[NMAX]; + +} CmpDTSinfo; + +/* Forward declarations for custom vlen memory manager functions */ +void *test_array_alloc_custom(size_t size, void *info); +void test_array_free_custom(void *mem, void *info); + + +/*------------------------------------------------------------------------- + * Function: test_array_atomic_1d + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of atomic datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_atomic_1d(void) { - int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + int i,j; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n")); @@ -167,23 +193,28 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ -/**************************************************************** -** -** test_array_funcs(): Test some type functions that are and -** aren't supposed to work with array type. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_funcs + * + * Purpose: Test some type functions that are and aren't supposed to + * work with array type. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_funcs(void) { - hid_t type; /* Datatype ID */ - hsize_t tdims1[] = {ARRAY1_DIM1}; - size_t size; - H5T_pad_t inpad; - H5T_norm_t norm; - H5T_cset_t cset; - H5T_str_t strpad; - herr_t ret; /* Generic return value */ + hid_t type; /* Datatype ID */ + hsize_t tdims1[] = {ARRAY1_DIM1}; + size_t size; + H5T_pad_t inpad; + H5T_norm_t norm; + H5T_cset_t cset; + H5T_str_t strpad; + herr_t ret; /* Generic return value */ /* Create a datatype to refer to */ type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1); @@ -223,29 +254,34 @@ test_array_funcs(void) /* Close datatype */ ret = H5Tclose(type); CHECK(ret, FAIL, "H5Tclose"); -} /* end test_array_funcs */ +} /* end test_array_funcs() */ -/**************************************************************** -** -** test_array_atomic_3d(): Test basic array datatype code. -** Tests 3-D array of atomic datatypes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_atomic_3d + * + * Purpose: Test basic array datatype code. + * Tests 3-D array of atomic datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_atomic_3d(void) { int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */ int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; - int ndims; /* Array rank for reading */ - hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; + int ndims; /* Array rank for reading */ + hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ + int i,j,k,l; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 3-D Array of Atomic Datatypes Functionality\n")); @@ -349,31 +385,36 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ -/**************************************************************** -** -** test_array_array_atomic(): Test basic array datatype code. -** Tests 1-D array 2-D arrays of atomic datatypes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_array_atomic + * + * Purpose: Test basic array datatype code. + * Tests 1-D array 2-D arrays of atomic datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_array_atomic(void) { int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */ int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid1; /* 1-D array Datatype ID */ - hid_t tid2; /* 2-D array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; - int ndims1; /* Array rank for reading */ - int ndims2; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid1; /* 1-D array Datatype ID */ + hid_t tid2; /* 2-D array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; + int ndims1; /* Array rank for reading */ + int ndims2; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ + int i,j,k,l; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array 2-D Arrays of Atomic Datatypes Functionality\n")); @@ -503,12 +544,17 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ -/**************************************************************** -** -** test_array_compound_atomic(): Test basic array datatype code. -** Tests 1-D array of compound datatypes (with no array fields) -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_compound_atomic + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of compound datatypes (with no array fields). + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_compound_atomic(void) { @@ -516,23 +562,24 @@ test_array_compound_atomic(void) int i; float f; } s1_t; - s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - int nmemb; /* Number of compound members */ - char *mname; /* Name of compound field */ - size_t off; /* Offset of compound field */ - hid_t mtid; /* Datatype ID for field */ - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + + s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + int nmemb; /* Number of compound members */ + char *mname; /* Name of compound field */ + size_t off; /* Offset of compound field */ + hid_t mtid; /* Datatype ID for field */ + int i,j; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Compound Atomic Datatypes Functionality\n")); @@ -704,12 +751,17 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ -/**************************************************************** -** -** test_array_compound_array(): Test basic array datatype code. -** Tests 1-D array of compound datatypes (with array fields) -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_compound_array + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of compound datatypes (with array fields). + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_compound_array(void) { @@ -717,25 +769,26 @@ test_array_compound_array(void) int i; float f[ARRAY1_DIM1]; } s1_t; - s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - int nmemb; /* Number of compound members */ - char *mname; /* Name of compound field */ - size_t off; /* Offset of compound field */ - hid_t mtid; /* Datatype ID for field */ - H5T_class_t mclass; /* Datatype class for field */ - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + + s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + int nmemb; /* Number of compound members */ + char *mname; /* Name of compound field */ + size_t off; /* Offset of compound field */ + hid_t mtid; /* Datatype ID for field */ + H5T_class_t mclass; /* Datatype class for field */ + int i,j,k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Compound Array Datatypes Functionality\n")); @@ -949,9 +1002,6 @@ test_array_compound_array(void) } /* end test_array_compound_array() */ -void *test_array_alloc_custom(size_t size, void *info); -void test_array_free_custom(void *mem, void *info); - /**************************************************************** ** ** test_array_alloc_custom(): Test VL datatype custom memory @@ -960,11 +1010,29 @@ void test_array_free_custom(void *mem, void *info); ** allocated. ** ****************************************************************/ -void *test_array_alloc_custom(size_t size, void *info) + +/*------------------------------------------------------------------------- + * Function: test_array_alloc_custom + * + * Purpose: Memory allocator for testing VL datatype custom memory + * allocation routines. + * + * This routine just uses malloc to allocate the memory and + * increments the amount of memory allocated. + * + * Return: + * + * Success: A memory buffer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +test_array_alloc_custom(size_t size, void *info) { - void *ret_value = NULL; /* Pointer to return */ - size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */ - size_t extra; /* Extra space needed */ + void *ret_value = NULL; /* Pointer to return */ + size_t *mem_used = (size_t *)info; /* Pointer to the memory used */ + size_t extra; /* Extra space needed */ /* * This weird contortion is required on the DEC Alpha to keep the @@ -976,23 +1044,31 @@ void *test_array_alloc_custom(size_t size, void *info) *(size_t *)ret_value = size; *mem_used += size; } /* end if */ + ret_value = ((unsigned char *)ret_value) + extra; return ret_value; -} +} /* end test_array_alloc_custom() */ -/**************************************************************** -** -** test_array_free_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses free to -** release the memory and decrements the amount of memory -** allocated. -** -****************************************************************/ -void test_array_free_custom(void *_mem, void *info) + +/*------------------------------------------------------------------------- + * Function: test_array_free_custom + * + * Purpose: Memory free function for testing VL datatype custom memory + * allocation routines. + * + * This routine just uses free to free the memory and + * decrements the amount of memory allocated. + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +test_array_free_custom(void *_mem, void *info) { - unsigned char *mem = NULL; - size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */ - size_t extra; /* Extra space needed */ + unsigned char *mem = NULL; /* Pointer to mem to be freed */ + size_t *mem_used = (size_t *)info; /* Pointer to the memory used */ + size_t extra; /* Extra space needed */ /* * This weird contortion is required on the DEC Alpha to keep the @@ -1005,35 +1081,42 @@ void test_array_free_custom(void *_mem, void *info) *mem_used -= *(size_t *)mem; HDfree(mem); } /* end if */ -} -/**************************************************************** -** -** test_array_vlen_atomic(): Test basic array datatype code. -** Tests 1-D array of atomic VL datatypes -** -****************************************************************/ + return; +} /* end test_array_free_custom() */ + + +/*------------------------------------------------------------------------- + * Function: test_array_vlen_atomic + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of atomic VL datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_vlen_atomic(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hid_t tid3; /* Atomic Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - H5T_class_t mclass; /* Datatype class for VL */ - hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t size; /* Number of bytes which will be used */ - size_t mem_used=0; /* Memory used during allocation */ - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hid_t tid3; /* Atomic Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + H5T_class_t mclass; /* Datatype class for VL */ + hid_t xfer_pid; /* Dataset transfer property list ID */ + hsize_t size; /* Number of bytes which will be used */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Atomic Variable-Length Datatypes Functionality\n")); @@ -1217,34 +1300,39 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ -/**************************************************************** -** -** test_array_vlen_array(): Test basic array datatype code. -** Tests 1-D array of 1-D array VL datatypes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_vlen_array + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of 1-D array VL datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_vlen_array(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hid_t tid4; /* Atomic Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - H5T_class_t mclass; /* Datatype class for VL */ - hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t size; /* Number of bytes which will be used */ - size_t mem_used=0; /* Memory used during allocation */ - int i,j,k,l; /* Index variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hid_t tid4; /* Atomic Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + H5T_class_t mclass; /* Datatype class for VL */ + hid_t xfer_pid; /* Dataset transfer property list ID */ + hsize_t size; /* Number of bytes which will be used */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k,l; /* Index variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of 1-D Array Variable-Length Datatypes Functionality\n")); @@ -1467,28 +1555,18 @@ test_array_vlen_array(void) } /* end test_array_vlen_array() */ -#define FIELDNAME "ArrayofStructures" -#define LENGTH 5 -#define ALEN 10 -#define RANK 1 -#define NMAX 100 - -typedef struct -{ - int nsubfields; - char *name[NMAX]; - size_t offset[NMAX]; - hid_t datatype[NMAX]; - -} CmpDTSinfo; - -/**************************************************************** -** -** test_array_bkg(): Test basic array datatype code. -** Tests reading compound datatype with array fields and -** writing partial fields. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_bkg + * + * Purpose: Test basic array datatype code. + * Tests reading compound datatype with array fields and + * writing partial fields. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_bkg(void) { @@ -1531,10 +1609,10 @@ test_array_bkg(void) CHECK(dtsinfo, NULL, "HDmalloc"); HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo)); for (i = 0; i < LENGTH; i++) { - for (j = 0; j < ALEN; j++) { - cf[i].a[j] = 100 * (i + 1) + j; - cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j; - cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j); + for (j = 0; j < ALEN; j++) { + cf[i].a[j] = 100 * (i + 1) + j; + cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j; + cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j); } /* end for */ } /* end for */ @@ -1561,9 +1639,9 @@ test_array_bkg(void) for (i = 0; i < dtsinfo->nsubfields; i++) dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char)); - strcpy(dtsinfo->name[0], "One"); - strcpy(dtsinfo->name[1], "Two"); - strcpy(dtsinfo->name[2], "Three"); + HDstrcpy(dtsinfo->name[0], "One"); + HDstrcpy(dtsinfo->name[1], "Two"); + HDstrcpy(dtsinfo->name[2], "Three"); /* Create file */ @@ -1745,7 +1823,7 @@ test_array_bkg(void) /* Reset the data to read in */ /* ------------------------- */ - memset(cfr, 0, sizeof(CmpField)*LENGTH); + HDmemset(cfr, 0, sizeof(CmpField)*LENGTH); status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfr); CHECK(status, FAIL, "H5Dread"); @@ -1781,32 +1859,38 @@ test_array_bkg(void) HDfree(dtsinfo); } /* end test_array_bkg() */ -/**************************************************************** -** -** test_compat(): Test array datatype compatibility code. -** Reads file containing old version of datatype object header -** messages for compound datatypes and verifies reading the older -** version of the is working correctly. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_compat + * + * Purpose: Test array datatype compatibility code. + * + * Reads file containing old version of datatype object header + * messages for compound datatypes and verifies reading the older + * version of the is working correctly. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_compat(void) { const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Datatype ID */ - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - H5T_class_t mclass; /* Datatype class for VL */ - int nmemb; /* Number of compound members */ - char *mname; /* Name of compound field */ - size_t off; /* Offset of compound field */ - hid_t mtid; /* Datatype ID for field */ - int i; /* Index variables */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Datatype ID */ + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + H5T_class_t mclass; /* Datatype class for VL */ + int nmemb; /* Number of compound members */ + char *mname; /* Name of compound field */ + size_t off; /* Offset of compound field */ + hid_t mtid; /* Datatype ID for field */ + int i; /* Index variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Array Datatypes Compatibility Functionality\n")); @@ -2064,17 +2148,22 @@ test_compat(void) /* Close the file */ ret = H5Fclose(fid1); CHECK_I(ret, "H5Fclose"); - } + } /* end if */ else printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile); } /* end test_compat() */ -/**************************************************************** -** -** test_array(): Main array datatype testing routine. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array + * + * Purpose: Main array datatype testing routine. + * + * Return: void + * + *------------------------------------------------------------------------- + */ void test_array(void) { @@ -2082,39 +2171,38 @@ test_array(void) MESSAGE(5, ("Testing Array Datatypes\n")); /* These tests use the same file... */ - test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */ - test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */ - test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */ - test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */ - test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */ - test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */ - test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */ - test_array_funcs(); /* Test type functions with array types */ + test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */ + test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */ + test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */ + test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */ + test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */ + test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */ + test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */ + test_array_funcs(); /* Test type functions with array types */ - test_array_bkg(); /* Read compound datatype with array fields and background fields read */ + test_array_bkg(); /* Read compound datatype with array fields and background fields read */ /* This test uses a custom file */ - test_compat(); /* Test compatibility changes for compound datatype fields */ -} /* test_array() */ + test_compat(); /* Test compatibility changes for compound datatype fields */ + +} /* end test_array() */ /*------------------------------------------------------------------------- - * Function: cleanup_array + * Function: cleanup_array * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * June 8, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ void cleanup_array(void) { remove(FILENAME); -} +} /* end cleanup_array() */ -- cgit v0.12 From cd2fb75d444007fd1fd71ebffea534a51b5f9832 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 12 Jan 2016 22:30:00 -0500 Subject: [svn-r28872] Changed time to HDtime in H5AClog.c functions. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- src/H5AClog.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/H5AClog.c b/src/H5AClog.c index 11579d8..cdfb932 100644 --- a/src/H5AClog.c +++ b/src/H5AClog.c @@ -116,7 +116,7 @@ H5AC__write_create_cache_log_msg(H5AC_t *cache) \"messages\":\n\ [\n\ " - , (long long)time(NULL)); + , (long long)HDtime(NULL)); /* Since we're about to override the current logging flag, * check the "log enabled" flag to see if we didn't get here @@ -170,7 +170,7 @@ H5AC__write_destroy_cache_log_msg(H5AC_t *cache) \"close_time\":%lld,\n\ }\n\ " - , (long long)time(NULL)); + , (long long)HDtime(NULL)); /* Since we're about to override the current logging flag, * check the "log enabled" flag to see if we didn't get here @@ -226,7 +226,7 @@ H5AC__write_evict_cache_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (int)fxn_ret_value); + , (long long)HDtime(NULL), (int)fxn_ret_value); /* Write the log message to the file */ if(H5C_write_log_message(cache, msg) < 0) @@ -274,7 +274,7 @@ H5AC__write_expunge_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value); + , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value); /* Write the log message to the file */ @@ -319,7 +319,7 @@ H5AC__write_flush_cache_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (int)fxn_ret_value); + , (long long)HDtime(NULL), (int)fxn_ret_value); /* Write the log message to the file */ if(H5C_write_log_message(cache, msg) < 0) @@ -372,7 +372,7 @@ H5AC__write_insert_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)address, flags, type_id, + , (long long)HDtime(NULL), (unsigned long)address, flags, type_id, (int)size, (int)fxn_ret_value); /* Write the log message to the file */ @@ -420,7 +420,7 @@ H5AC__write_mark_dirty_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if(H5C_write_log_message(cache, msg) < 0) @@ -470,7 +470,7 @@ H5AC__write_move_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)old_addr, + , (long long)HDtime(NULL), (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value); /* Write the log message to the file */ @@ -518,7 +518,7 @@ H5AC__write_pin_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)entry->addr, + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ @@ -570,7 +570,7 @@ H5AC__write_create_fd_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)parent->addr, + , (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr, (int)fxn_ret_value); /* Write the log message to the file */ @@ -627,7 +627,7 @@ H5AC__write_protect_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)entry->addr, + , (long long)HDtime(NULL), (unsigned long)entry->addr, rw_s, (int)entry->size, (int)fxn_ret_value); /* Write the log message to the file */ @@ -677,7 +677,7 @@ H5AC__write_resize_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)entry->addr, + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)new_size, (int)fxn_ret_value); /* Write the log message to the file */ @@ -725,7 +725,7 @@ H5AC__write_unpin_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)entry->addr, + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ @@ -777,7 +777,7 @@ H5AC__write_destroy_fd_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)parent->addr, + , (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr, (int)fxn_ret_value); /* Write the log message to the file */ @@ -829,7 +829,7 @@ H5AC__write_unprotect_entry_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (unsigned long)entry->addr, + , (long long)HDtime(NULL), (unsigned long)entry->addr, type_id, flags, (int)fxn_ret_value); HDsnprintf(msg, MSG_SIZE, " "); @@ -878,7 +878,7 @@ H5AC__write_set_cache_config_log_msg(const H5AC_t *cache, \"returned\":%d\ },\n\ " - , (long long)time(NULL), (int)fxn_ret_value); + , (long long)HDtime(NULL), (int)fxn_ret_value); /* Write the log message to the file */ -- cgit v0.12 From d86867da6beba17dc1716d40b26c91facd14e206 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 13 Jan 2016 10:05:43 -0500 Subject: [svn-r28874] Merge of r28861 from trunk (minor string format change). Fixes HDFFV-9640. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 parallel only (MPICH 3.1.4) --- src/H5Eprivate.h | 2 +- test/error_test.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index ba17ada..db413e3 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -125,7 +125,7 @@ extern int H5E_mpi_error_str_len; #define HMPI_ERROR(mpierr){ \ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \ - HERROR(H5E_INTERNAL, H5E_MPIERRSTR, H5E_mpi_error_str); \ + HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \ } #define HMPI_DONE_ERROR(retcode, str, mpierr){ \ HMPI_ERROR(mpierr); \ diff --git a/test/error_test.c b/test/error_test.c index 4e4c0ef..ee181b1 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -498,7 +498,7 @@ test_create(void) if(err_num != 0) TEST_ERROR /* Push an error with a long description */ - if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, err_msg) < 0) TEST_ERROR; + if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR; /* Check the number of errors on stack */ err_num = H5Eget_num(estack_id); @@ -543,7 +543,7 @@ test_copy(void) herr_t ret; /* Generic return value */ /* Push an error with a long description */ - if(H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, err_msg) < 0) TEST_ERROR; + if(H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR; /* Check the number of errors on stack */ err_num = H5Eget_num(H5E_DEFAULT); -- cgit v0.12 From 0af3b56b5f40cc0ed247b9592df98853c5866654 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 13 Jan 2016 11:12:23 -0500 Subject: [svn-r28879] Merge of r28878 from trunk (minor comment fix in configure.ac). Tested on: N/A --- configure.ac | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure.ac b/configure.ac index 28a479e..75e9d63 100644 --- a/configure.ac +++ b/configure.ac @@ -2284,9 +2284,6 @@ fi ## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## -## ---------------------------------------------------------------------- -## Check if Direct I/O driver is enabled by --enable-direct-vfd -## AC_CACHE_VAL([hdf5_cv_direct_io], AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include ]])) AC_CACHE_VAL([hdf5_cv_posix_memalign], -- cgit v0.12 From 5acd2e893c5dd4bf0c98c108efeaca389a54da3b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 13 Jan 2016 11:23:29 -0500 Subject: [svn-r28880] Added a shell script to flip maintainer mode in configure.ac. This can be called by other shell scripts when we create release branches. Tested on: linux VM --- MANIFEST | 1 + bin/switch_maint_mode | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100755 bin/switch_maint_mode diff --git a/MANIFEST b/MANIFEST index 407b87a..ba85c89 100644 --- a/MANIFEST +++ b/MANIFEST @@ -66,6 +66,7 @@ ./bin/runtest _DO_NOT_DISTRIBUTE_ ./bin/snapshot ./bin/snapshot_version _DO_NOT_DISTRIBUTE_ +./bin/switch_maint_mode _DO_NOT_DISTRIBUTE_ ./bin/timekeeper _DO_NOT_DISTRIBUTE_ ./bin/trace ./bin/yodconfigure diff --git a/bin/switch_maint_mode b/bin/switch_maint_mode new file mode 100755 index 0000000..2b62545 --- /dev/null +++ b/bin/switch_maint_mode @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# Switch AM_MAINTAINER_MODE value in configure.ac +# Usage: See USAGE() +# Programmer: Dana Robinson +# Creation date: January 2016 + +USAGE() +{ +cat < + +EOF +} + +MODE="notset" +CONFIG_AC_PATH= + +# Display help/usage if any options were passed in +while [ $# -gt 0 ]; do + case "$1" in + -enable) + MODE="enable" + ;; + -disable) + MODE="disable" + ;; + -help) + USAGE + exit 0 + ;; + *) + CONFIG_AC_PATH="$1" + ;; + esac + shift +done + +# Did we get a file path? +if test -z $CONFIG_AC_PATH ; then + USAGE + exit 1 +fi + +# Did we get a mode? +if test -z $MODE ; then + USAGE + exit 1 +fi + +# Run perl over configure.ac +if test "X-$MODE" = "X-enable" ; then + perl -pi -e 's/^(AM_MAINTAINER_MODE\(\[)([a-z]+)(\]\))/$1enable$3/g' $CONFIG_AC_PATH +fi +if test "X-$MODE" = "X-disable" ; then + perl -pi -e 's/^(AM_MAINTAINER_MODE\(\[)([a-z]+)(\]\))/$1disable$3/g' $CONFIG_AC_PATH +fi + -- cgit v0.12 From b4e64410f52b745a2b7bce348d1d577a7f255d85 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 13 Jan 2016 14:40:02 -0500 Subject: [svn-r28889] Merge of r28865, 28866, 28868, 28885 from trunk (h5dump bugfix). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial --- MANIFEST | 2 ++ tools/h5dump/CMakeTests.cmake | 39 +++++++++++--------- tools/h5dump/errfiles/non_existing.err | 1 + tools/h5dump/h5dump.c | 64 ++++++++++++++++++--------------- tools/h5dump/testh5dump.sh.in | 65 ++++++++++++++++++---------------- tools/testfiles/non_existing.ddl | 31 ++++++++++++++++ 6 files changed, 128 insertions(+), 74 deletions(-) create mode 100644 tools/h5dump/errfiles/non_existing.err create mode 100644 tools/testfiles/non_existing.ddl diff --git a/MANIFEST b/MANIFEST index ba85c89..84fb0a9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1446,6 +1446,7 @@ ./tools/testfiles/filter_fail.h5 ./tools/testfiles/filter_fail.ddl ./tools/testfiles/h5dump-help.txt +./tools/testfiles/non_existing.ddl ./tools/testfiles/packedbits.ddl ./tools/testfiles/taindices.h5 ./tools/testfiles/tall-1.ddl @@ -1705,6 +1706,7 @@ # h5dump test error files ./tools/h5dump/errfiles/filter_fail.err +./tools/h5dump/errfiles/non_existing.err ./tools/h5dump/errfiles/tall-1.err ./tools/h5dump/errfiles/tall-2A.err ./tools/h5dump/errfiles/tall-2A0.err diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index 00ec760..c256e11 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -4,7 +4,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - + # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- @@ -12,6 +12,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/charsets.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/file_space.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/filter_fail.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/non_existing.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/packedbits.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2.ddl @@ -284,6 +285,7 @@ ) set (HDF5_ERROR_REFERENCE_TEST_FILES ${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err + ${PROJECT_SOURCE_DIR}/errfiles/non_existing.err ${PROJECT_SOURCE_DIR}/errfiles/tall-1.err ${PROJECT_SOURCE_DIR}/errfiles/tall-2A.err ${PROJECT_SOURCE_DIR}/errfiles/tall-2A0.err @@ -325,7 +327,7 @@ ARGS -E copy_if_different ${tst_h5_file} ${dest} ) endforeach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) - + foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} TEST_STREAM) @@ -373,7 +375,7 @@ COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl ) - + if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") @@ -385,7 +387,7 @@ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp ) endif (WIN32) - + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -730,7 +732,7 @@ add_test ( NAME H5DUMP-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove h5dump-help.out charsets.out charsets.out.err @@ -738,6 +740,8 @@ file_space.out.err filter_fail.out filter_fail.out.err + non_existing.out + non_existing.out.err packedbits.out packedbits.out.err tall-1.out @@ -1075,9 +1079,9 @@ ADD_H5_TEST_EXPORT (trawdatafile packedbits.h5 0 --enable-error-stack -y -o) ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack -O -y -o) ADD_H5_TEST_EXPORT (trawssetfile tdset.h5 0 --enable-error-stack -d "/dset1[1,1;;;]" -y -o) - + ADD_H5_TEST_EXPORT_DDL (twithddlfile packedbits.h5 0 twithddl --enable-error-stack --ddl=twithddl.txt -y -o) - + # test for maximum display datasets ADD_H5_TEST (twidedisplay 0 --enable-error-stack -w0 packedbits.h5) @@ -1147,7 +1151,7 @@ # test for named data types ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5) ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5) - # test for unamed type + # test for unamed type ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") # test complicated compound datatype ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5) @@ -1169,7 +1173,7 @@ # test for loop detection ADD_H5_TEST (tloop-1 0 --enable-error-stack tloop.h5) - # test for string + # test for string ADD_H5_TEST (tstr-1 0 --enable-error-stack tstr.h5) ADD_H5_TEST (tstr-2 0 --enable-error-stack tstr2.h5) @@ -1202,7 +1206,7 @@ #ADD_H5_MASK_TEST (tstarfile 0 --enable-error-stack -H -d Dataset1 tarr*.h5) #ADD_H5_MASK_TEST (tqmarkfile 0 --enable-error-stack -H -d Dataset1 tarray?.h5) ADD_H5_TEST (tmultifile 0 --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5) - + # test for files with empty data ADD_H5_TEST (tempty 0 --enable-error-stack tempty.h5) @@ -1263,7 +1267,7 @@ ADD_H5_TEST (tcontiguos 0 --enable-error-stack -H -p -d contiguous tfilters.h5) # chunked ADD_H5_TEST (tchunked 0 --enable-error-stack -H -p -d chunked tfilters.h5) - # external + # external ADD_H5_TEST (texternal 0 --enable-error-stack -H -p -d external tfilters.h5) # fill values @@ -1331,7 +1335,7 @@ # don't have). Do this by searching H5pubconf.h to see which # filters are defined. -# detect whether the encoder is present. +# detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") endif (H5_HAVE_FILTER_DEFLATE) @@ -1352,12 +1356,12 @@ # test for displaying objects with very long names ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) - # dimensions over 4GB, print boundary + # dimensions over 4GB, print boundary ADD_H5_TEST (tbigdims 0 --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5) # hyperslab read ADD_H5_TEST (thyperslab 0 --enable-error-stack thyperslab.h5) - + # test for displaying dataset and attribute of null space ADD_H5_TEST (tnullspace 0 --enable-error-stack tnullspace.h5) @@ -1391,7 +1395,7 @@ ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o tbin4.bin tbinary.h5) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - # test for dataset region references + # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5) ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5) @@ -1414,7 +1418,7 @@ # tests for link references and order ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5) ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5) - + # tests for floating point user defined printf format ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5) @@ -1430,3 +1434,6 @@ # test for -o -y for dataset with attributes ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o) + + # test for non-existing file + ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) diff --git a/tools/h5dump/errfiles/non_existing.err b/tools/h5dump/errfiles/non_existing.err new file mode 100644 index 0000000..f7e3afa --- /dev/null +++ b/tools/h5dump/errfiles/non_existing.err @@ -0,0 +1 @@ +h5dump error: unable to open file "non_existing.h5" diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 68889c9..ffba581 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -620,7 +620,7 @@ parse_hsize_list(const char *h_list, subset_d *d) size_count++; last_digit = 1; - } + } else { last_digit = 0; } @@ -643,7 +643,7 @@ parse_hsize_list(const char *h_list, subset_d *d) } d->data = p_list; d->len = size_count; - + return; } @@ -705,7 +705,7 @@ parse_subset_params(char *dset) * * Purpose: Parse a list of comma or space separated integers and fill * the packed_bits list and counter. The string being passed into this function - * should be at the start of the list you want to parse. + * should be at the start of the list you want to parse. * * Return: Success: SUCCEED * @@ -831,7 +831,7 @@ static void free_handler(struct handler_t *hand, int len) { int i; - + if(hand) { for (i = 0; i < len; i++) { if(hand[i].obj) { @@ -1161,7 +1161,7 @@ parse_start: } if (HDstrcmp(opt_arg,":") == 0) { xmlnsprefix = ""; - } + } else { xmlnsprefix = opt_arg; } @@ -1187,7 +1187,7 @@ parse_start: * the two. */ s = last_dset->subset_info; - } + } else { last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); } @@ -1358,7 +1358,7 @@ main(int argc, const char *argv[]) /* Disable tools error reporting */ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - + if((hand = parse_command_line(argc, argv))==NULL) { goto done; } @@ -1444,12 +1444,12 @@ main(int argc, const char *argv[]) if (xml_dtd_uri == NULL) { if (useschema) { xml_dtd_uri = DEFAULT_XSD; - } + } else { xml_dtd_uri = DEFAULT_DTD; xmlnsprefix = ""; } - } + } else { if (useschema && HDstrcmp(xmlnsprefix,"")) { error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); @@ -1486,7 +1486,7 @@ main(int argc, const char *argv[]) /* start to dump - display file header information */ if (!doxml) { begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); - } + } else { PRINTVALSTREAM(rawoutstream, "\n"); @@ -1495,7 +1495,7 @@ main(int argc, const char *argv[]) if (HDstrcmp(xmlnsprefix,"") == 0) { PRINTSTREAM(rawoutstream, "\n", xml_dtd_uri); - } + } else { /* TO DO: make -url option work in this case (may need new option) */ char *ns; @@ -1511,7 +1511,7 @@ main(int argc, const char *argv[]) "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns); HDfree(ns); } - } + } else { PRINTSTREAM(rawoutstream, "\n", xml_dtd_uri); PRINTVALSTREAM(rawoutstream, "\n"); @@ -1570,7 +1570,7 @@ main(int argc, const char *argv[]) if (!doxml) { end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); PRINTVALSTREAM(rawoutstream, "\n"); - } + } else { PRINTSTREAM(rawoutstream, "\n", xmlnsprefix); } @@ -1581,13 +1581,17 @@ main(int argc, const char *argv[]) if (H5Fclose(fid) < 0) h5tools_setstatus(EXIT_FAILURE); - if(prefix) + if(prefix) { HDfree(prefix); - if(fname) + prefix = NULL; + } + if(fname) { HDfree(fname); + fname = NULL; + } } /* end while */ - if(hand) + if(hand) free_handler(hand, argc); /* To Do: clean up XML table */ @@ -1601,13 +1605,17 @@ done: if(fid >=0) if (H5Fclose(fid) < 0) h5tools_setstatus(EXIT_FAILURE); - - if(prefix) + + if(prefix) { HDfree(prefix); - if(fname) + prefix = NULL; + } + if(fname) { HDfree(fname); + fname = NULL; + } - if(hand) + if(hand) free_handler(hand, argc); /* To Do: clean up XML table */ @@ -1660,20 +1668,20 @@ h5_fileaccess(void) if (!HDstrcmp(name, "sec2")) { /* Unix read() and write() system calls */ if (H5Pset_fapl_sec2(fapl)<0) return -1; - } + } else if (!HDstrcmp(name, "stdio")) { /* Standard C fread() and fwrite() system calls */ if (H5Pset_fapl_stdio(fapl)<0) return -1; - } + } else if (!HDstrcmp(name, "core")) { /* In-core temporary file with 1MB increment */ if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1; - } + } else if (!HDstrcmp(name, "split")) { /* Split meta data and raw data each using default driver */ if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) return -1; - } + } else if (!HDstrcmp(name, "multi")) { /* Multi-file driver, general case of the split driver */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; @@ -1699,7 +1707,7 @@ h5_fileaccess(void) if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) return -1; - } + } else if (!HDstrcmp(name, "family")) { hsize_t fam_size = 100*1024*1024; /*100 MB*/ @@ -1708,7 +1716,7 @@ h5_fileaccess(void) fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1; - } + } else if (!HDstrcmp(name, "log")) { long log_flags = H5FD_LOG_LOC_IO; @@ -1718,12 +1726,12 @@ h5_fileaccess(void) if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0) return -1; - } + } else if (!HDstrcmp(name, "direct")) { /* Substitute Direct I/O driver with sec2 driver temporarily because * some output has sec2 driver as the standard. */ if (H5Pset_fapl_sec2(fapl)<0) return -1; - } + } else { /* Unknown driver */ return -1; diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 95f8091..267ac44 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -27,10 +27,10 @@ EXIT_FAILURE=1 DUMPER=h5dump # The tool name DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary -H5DIFF=../h5diff/h5diff # The h5diff tool name +H5DIFF=../h5diff/h5diff # The h5diff tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary -H5IMPORT=../h5import/h5import # The h5import tool name +H5IMPORT=../h5import/h5import # The h5import tool name H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary RM='rm -rf' @@ -176,6 +176,7 @@ LIST_OTHER_TEST_FILES=" $SRC_H5DUMP_TESTFILES/charsets.ddl $SRC_H5DUMP_TESTFILES/file_space.ddl $SRC_H5DUMP_TESTFILES/filter_fail.ddl +$SRC_H5DUMP_TESTFILES/non_existing.ddl $SRC_H5DUMP_TESTFILES/packedbits.ddl $SRC_H5DUMP_TESTFILES/tall-1.ddl $SRC_H5DUMP_TESTFILES/tall-2.ddl @@ -266,7 +267,7 @@ $SRC_H5DUMP_TESTFILES/tindicessub4.ddl $SRC_H5DUMP_TESTFILES/tindicesyes.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl -#$SRC_H5DUMP_TESTFILES/tldouble.ddl +#$SRC_H5DUMP_TESTFILES/tldouble.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl $SRC_H5DUMP_TESTFILES/tloop-1.ddl $SRC_H5DUMP_TESTFILES/tmulti.ddl @@ -347,6 +348,7 @@ $SRC_H5DUMP_TESTFILES/tbinregR.exp LIST_ERROR_TEST_FILES=" ${SRC_H5DUMP_ERRORFILES}/filter_fail.err +${SRC_H5DUMP_ERRORFILES}/non_existing.err ${SRC_H5DUMP_ERRORFILES}/tall-1.err ${SRC_H5DUMP_ERRORFILES}/tall-2A.err ${SRC_H5DUMP_ERRORFILES}/tall-2A0.err @@ -393,10 +395,10 @@ COPY_TESTFILES_TO_TESTDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." - + # Comment out this to CREATE expected file exit $EXIT_FAILURE fi @@ -441,14 +443,14 @@ TESTING() { TOOLTEST() { # check if caseless compare and diff requested if [ "$1" = ignorecase ]; then - caseless="-i" - # replace cmp with diff which runs much longer. - xCMP="$DIFF -i" - shift + caseless="-i" + # replace cmp with diff which runs much longer. + xCMP="$DIFF -i" + shift else - caseless="" - # stick with faster cmp if ignorecase is not requested. - xCMP="$CMP" + caseless="" + # stick with faster cmp if ignorecase is not requested. + xCMP="$CMP" fi expect="$TESTDIR/$1" @@ -537,7 +539,7 @@ TOOLTEST2() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err @@ -545,7 +547,7 @@ TOOLTEST2() { } -# same as TOOLTEST2 but compares generated file to expected ddl file +# same as TOOLTEST2 but compares generated file to expected ddl file # and compares the generated data file to the expected data file # used for the binary tests that expect a full path in -o without -b # ADD_H5_TEST_EXPORT @@ -603,7 +605,7 @@ TOOLTEST2A() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err $actualmeta @@ -642,7 +644,7 @@ TOOLTEST2B() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err @@ -859,7 +861,7 @@ TOOLTEST_HELP() { echo " Expected output (*.txt) differs from actual output (*.out)" nerrors="`expr $nerrors + 1`" fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actual_err @@ -872,7 +874,7 @@ SKIP() { TESTING $DUMPER $@ echo " -SKIP-" } - + # Print a line-line message left justified in a field of 70 characters # PRINT_H5DIFF() { @@ -883,7 +885,7 @@ PRINT_H5DIFF() { # Call the h5diff tool # -DIFFTEST() +DIFFTEST() { PRINT_H5DIFF $@ ( @@ -897,7 +899,7 @@ DIFFTEST() else echo " PASSED" fi - + } # Print a line-line message left justified in a field of 70 characters @@ -910,7 +912,7 @@ PRINT_H5IMPORT() { # Call the h5import tool # -IMPORTTEST() +IMPORTTEST() { # remove the output hdf5 file if it exists hdf5_file="$TESTDIR/$5" @@ -921,7 +923,7 @@ IMPORTTEST() PRINT_H5IMPORT $@ ( cd $TESTDIR - $RUNSERIAL $H5IMPORT_BIN "$@" + $RUNSERIAL $H5IMPORT_BIN "$@" ) RET=$? if [ $RET != 0 ] ; then @@ -930,7 +932,7 @@ IMPORTTEST() else echo " PASSED" fi - + } @@ -1021,7 +1023,7 @@ TOOLTEST tcomp-1.ddl --enable-error-stack tcompound.h5 # test for named data types TOOLTEST tcomp-2.ddl --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5 TOOLTEST tcomp-2.ddl --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5 -# test for unamed type +# test for unamed type TOOLTEST4 tcomp-3.ddl --enable-error-stack -t /#6632 -g /group2 tcompound.h5 # test complicated compound datatype TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5 @@ -1041,7 +1043,7 @@ TOOLTEST tall-7N.ddl --enable-error-stack -N attr1 tall.h5 # test for loop detection TOOLTEST tloop-1.ddl --enable-error-stack tloop.h5 -# test for string +# test for string TOOLTEST tstr-1.ddl --enable-error-stack tstr.h5 TOOLTEST tstr-2.ddl --enable-error-stack tstr2.h5 @@ -1136,7 +1138,7 @@ TOOLTEST tcompact.ddl --enable-error-stack -H -p -d compact tfilters.h5 TOOLTEST tcontiguos.ddl --enable-error-stack -H -p -d contiguous tfilters.h5 # chunked TOOLTEST tchunked.ddl --enable-error-stack -H -p -d chunked tfilters.h5 -# external +# external TOOLTEST texternal.ddl --enable-error-stack -H -p -d external tfilters.h5 # fill values @@ -1205,7 +1207,7 @@ fi # test for displaying objects with very long names TOOLTEST tlonglinks.ddl --enable-error-stack tlonglinks.h5 -# dimensions over 4GB, print boundary +# dimensions over 4GB, print boundary TOOLTEST tbigdims.ddl --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5 # hyperslab read @@ -1213,7 +1215,7 @@ TOOLTEST thyperslab.ddl --enable-error-stack thyperslab.h5 # - + # test for displaying dataset and attribute of null space TOOLTEST tnullspace.ddl --enable-error-stack tnullspace.h5 @@ -1252,7 +1254,7 @@ IMPORTTEST out3.bin -c tbin3.ddl -o out3D.h5 DIFFTEST tbinary.h5 out3D.h5 /integer /integer TOOLTEST tbin4.ddl --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5 - + # Clean up binary output files if test -z "$HDF5_NOCLEANUP"; then rm -f out[1-4].bin @@ -1260,7 +1262,7 @@ if test -z "$HDF5_NOCLEANUP"; then rm -f out3.h5 fi -# test for dataset region references +# test for dataset region references TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5 TOOLTEST4 tdataregR.ddl --enable-error-stack -R tdatareg.h5 TOOLTEST tattrreg.ddl --enable-error-stack tattrreg.h5 @@ -1306,6 +1308,9 @@ TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5 +# test for non-existing file +TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/testfiles/non_existing.ddl b/tools/testfiles/non_existing.ddl new file mode 100644 index 0000000..4377f8d --- /dev/null +++ b/tools/testfiles/non_existing.ddl @@ -0,0 +1,31 @@ +HDF5 "tgroup.h5" { +GROUP "/" { + GROUP "g1" { + GROUP "g1.1" { + } + GROUP "g1.2" { + } + } + GROUP "g2" { + GROUP "g2.1" { + GROUP "g2.1.1" { + } + GROUP "g2.1.2" { + } + GROUP "g2.1.3" { + } + } + } + GROUP "g3" { + GROUP "g3.1" { + } + GROUP "g3.2" { + } + GROUP "g3.3" { + } + GROUP "g3.4" { + } + } +} +} +h5dump error: unable to open file "non_existing.h5" -- cgit v0.12 From fbe01b182a6e131ce6b24d3dce6e805bdd97e8ed Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 Jan 2016 14:12:16 -0500 Subject: [svn-r28900] Description: Bring r28894 from trunk to revise_chunks branch: Normalize against changes on phdf5_metadata_opt branch to trunk Tested on: MacoSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not requird on this branch) --- src/H5A.c | 57 +++++++++++++++-------- src/H5AC.c | 28 +++++------ src/H5ACmpio.c | 42 ++++++++--------- src/H5C.c | 136 ++++++++++++++---------------------------------------- src/H5D.c | 9 ++-- src/H5F.c | 10 ++-- src/H5FDmpio.c | 3 +- src/H5Fpublic.h | 22 ++++++--- src/H5G.c | 22 +++++---- src/H5L.c | 56 ++++++++++++++-------- src/H5Lexternal.c | 3 +- src/H5O.c | 26 +++++++---- src/H5Pint.c | 2 +- src/H5Tcommit.c | 8 ++-- 14 files changed, 212 insertions(+), 212 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 7d87505..97d082c 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -252,6 +252,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -271,8 +272,8 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + /* Go do the real work for attaching the attribute to the object */ + if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -331,6 +332,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -359,12 +361,14 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + dxpl_id = H5AC_ind_dxpl_id; + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + dxpl_id = H5AC_dxpl_id; + if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -405,6 +409,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -419,7 +424,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Read in attribute from object header */ - if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) /* Finish initializing attribute */ @@ -467,6 +472,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -488,7 +494,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Register the attribute and get an ID for it */ @@ -535,6 +541,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -559,7 +566,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute in the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -867,6 +874,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -891,7 +899,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the length of the name */ @@ -1005,6 +1013,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1028,7 +1037,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1064,6 +1073,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1090,7 +1100,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1167,6 +1177,7 @@ herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by the library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1196,7 +1207,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ - if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, H5AC_dxpl_id) < 0) + if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1341,6 +1352,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5A_attr_iter_op_t attr_op; /* Attribute operator */ hsize_t start_idx; /* Index of attribute to start iterating at */ hsize_t last_attr; /* Index of last attribute examined */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1370,12 +1382,12 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Open the object */ - if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Build attribute operator info */ @@ -1384,7 +1396,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Call attribute iteration routine */ last_attr = start_idx = (idx ? *idx : 0); - if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(obj_loc_id, dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ @@ -1469,6 +1481,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1495,12 +1508,14 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + dxpl_id = H5AC_ind_dxpl_id; + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Delete the attribute from the location */ - if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1545,6 +1560,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1573,12 +1589,14 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + dxpl_id = H5AC_ind_dxpl_id; + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Delete the attribute from the location */ - if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, H5AC_dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1684,6 +1702,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1704,7 +1723,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") - if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5AC.c b/src/H5AC.c index 16b3880..1a27c40 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -194,7 +194,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") /* Get the property list object */ - if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ @@ -265,7 +265,7 @@ H5AC_term_package(void) H5E_clear_stack(NULL); /*ignore error*/ } /* end if */ #endif /* H5_HAVE_PARALLEL */ - + /* Reset static IDs */ H5AC_dxpl_id = (-1); H5AC_ind_dxpl_id = (-1); @@ -496,7 +496,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) } /* end if */ #ifdef H5_HAVE_PARALLEL - aux_ptr = H5C_get_aux_ptr(f->shared->cache); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); if(aux_ptr) /* Sanity check */ HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -865,7 +865,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add { H5AC_aux_t *aux_ptr; - if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) { /* Log the new entry */ if(H5AC__log_inserted_entry((H5AC_info_t *)thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed") @@ -944,7 +944,7 @@ H5AC_mark_entry_dirty(void *thing) { H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && (entry_ptr->is_pinned) && (NULL != aux_ptr)) if(H5AC__log_dirtied_entry(entry_ptr) < 0) @@ -1024,7 +1024,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #ifdef H5_HAVE_PARALLEL /* Log moving the entry */ - if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) if(H5AC__log_moved_entry(f, old_addr, new_addr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log moved entry") #endif /* H5_HAVE_PARALLEL */ @@ -1363,7 +1363,7 @@ H5AC_resize_entry(void *thing, size_t new_size) { H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((!entry_ptr->is_dirty) && (NULL != aux_ptr)) if(H5AC__log_dirtied_entry(entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") @@ -1623,7 +1623,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } /* end if */ #ifdef H5_HAVE_PARALLEL - if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) { if(dirtied && ((H5AC_info_t *)thing)->is_dirty == FALSE) if(H5AC__log_dirtied_entry((H5AC_info_t *)thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry") @@ -1753,7 +1753,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, { H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry.") } @@ -1800,7 +1800,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, { H5AC_aux_t *aux_ptr; - if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) { config_ptr->dirty_bytes_threshold = aux_ptr->dirty_bytes_threshold; config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy; } /* end if */ @@ -1948,7 +1948,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config { H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry.") } @@ -1992,7 +1992,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config /* Set parallel configuration values */ /* (Which are only held in the H5AC layer -QAK) */ - if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) { aux_ptr->dirty_bytes_threshold = config_ptr->dirty_bytes_threshold; aux_ptr->metadata_write_strategy = config_ptr->metadata_write_strategy; } /* end if */ @@ -2212,7 +2212,7 @@ H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name) { H5AC_aux_t * aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if(aux_ptr == NULL) sprintf(file_name, "%s", trace_file_name); else { @@ -2393,7 +2393,7 @@ H5_ATTR_UNUSED HDassert(f != NULL); HDassert(f->shared != NULL); HDassert(f->shared->cache != NULL); - aux_ptr = H5C_get_aux_ptr(f->shared->cache); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); if(aux_ptr != NULL) { HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 8655a6f..0fa40ac 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -159,7 +159,7 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr, /* Sanity checks */ HDassert(cache_ptr); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -192,7 +192,7 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)) /* Sanity checks */ HDassert(cache_ptr); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -231,7 +231,7 @@ H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr) /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -295,7 +295,7 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, int *num_entries_ptr, /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -427,7 +427,7 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -624,7 +624,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, int *num_entries_pt /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -700,7 +700,7 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) addr = entry_ptr->addr; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -756,7 +756,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) HDassert(entry_ptr->is_dirty == FALSE); cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -839,7 +839,7 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, /* Sanity check */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -907,7 +907,7 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) HDassert(entry_ptr); cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -1010,7 +1010,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) HDassert(f->shared); cache_ptr = (H5AC_t *)f->shared->cache; HDassert(cache_ptr); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -1188,7 +1188,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1352,7 +1352,7 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -1477,7 +1477,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank != 0); @@ -1537,7 +1537,7 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, int *num_entries_ptr, /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank != 0); @@ -1621,7 +1621,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1761,7 +1761,7 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1836,7 +1836,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -1938,7 +1938,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -2047,7 +2047,7 @@ H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || @@ -2171,7 +2171,7 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates, /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); diff --git a/src/H5C.c b/src/H5C.c index 5c3d9ef..f5503ef 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -498,8 +498,6 @@ H5C_create(size_t max_cache_size, HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS ); HDassert( type_name_table_ptr ); - HDassert( ( write_permitted == TRUE ) || ( write_permitted == FALSE ) ); - for ( i = 0; i <= max_type_id; i++ ) { HDassert( (type_name_table_ptr)[i] ); @@ -2195,7 +2193,7 @@ H5C_insert_entry(H5F_t * f, void * thing, unsigned int flags) { - H5C_t * cache_ptr; + H5C_t *cache_ptr; H5P_genplist_t *dxpl; H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t insert_pinned; @@ -2206,8 +2204,8 @@ H5C_insert_entry(H5F_t * f, hbool_t set_flush_marker; hbool_t write_permitted = TRUE; size_t empty_space; - H5C_cache_entry_t * entry_ptr; - H5C_cache_entry_t * test_entry_ptr; + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *test_entry_ptr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2438,11 +2436,8 @@ H5C_insert_entry(H5F_t * f, #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed just before done.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* If the entry's type has a 'notify' callback send a 'after insertion' @@ -2455,19 +2450,14 @@ H5C_insert_entry(H5F_t * f, H5C__UPDATE_STATS_FOR_INSERTION(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 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_insert_entry() */ @@ -3064,7 +3054,6 @@ H5C_protect(H5F_t * f, unsigned flags) { H5C_t * cache_ptr; - H5P_genplist_t *dxpl; H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t hit; hbool_t have_write_permitted = FALSE; @@ -3077,6 +3066,7 @@ H5C_protect(H5F_t * f, size_t empty_space; void * thing; H5C_cache_entry_t * entry_ptr; + H5P_genplist_t * dxpl; /* dataset transfer property list */ void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -3167,7 +3157,6 @@ H5C_protect(H5F_t * f, } entry_ptr = (H5C_cache_entry_t *)thing; - entry_ptr->ring = ring; /* Apply tag to newly protected entry */ @@ -3426,11 +3415,8 @@ done: #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3769,23 +3755,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_set_evictions_enabled(H5C_t *cache_ptr, - hbool_t evictions_enabled) +H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { - + if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - } - - if ( ( evictions_enabled != TRUE ) && ( evictions_enabled != FALSE ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad evictions_enabled on entry.") - } /* There is no fundamental reason why we should not permit * evictions to be disabled while automatic resize is enabled. @@ -3793,20 +3770,15 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, * want to, and allowing it would greatly complicate testing * the feature. Hence the following: */ - if ( ( evictions_enabled != TRUE ) && - ( ( cache_ptr->resize_ctl.incr_mode != H5C_incr__off ) || - ( cache_ptr->resize_ctl.decr_mode != H5C_decr__off ) ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Can't disable evictions when auto resize enabled.") - } + if((evictions_enabled != TRUE) && + ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || + (cache_ptr->resize_ctl.decr_mode != H5C_decr__off))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled.") cache_ptr->evictions_enabled = evictions_enabled; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_set_evictions_enabled() */ @@ -5192,27 +5164,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( (tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0 ) { - if ( ( config_ptr->set_initial_size != TRUE ) && - ( config_ptr->set_initial_size != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "set_initial_size must be either TRUE or FALSE"); - } + if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") - if ( config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE ) { + if(config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big"); - } - - if ( config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small"); - } - - if ( config_ptr->min_size > config_ptr->max_size ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size"); - } + if(config_ptr->min_size > config_ptr->max_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") if ( ( config_ptr->set_initial_size ) && ( ( config_ptr->initial_size < config_ptr->min_size ) || @@ -5251,25 +5210,12 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( config_ptr->incr_mode == H5C_incr__threshold ) { - if ( ( config_ptr->lower_hr_threshold < (double)0.0f ) || - ( config_ptr->lower_hr_threshold > (double)1.0f ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "lower_hr_threshold must be in the range [0.0, 1.0]"); - } + if((config_ptr->lower_hr_threshold < (double)0.0f) || + (config_ptr->lower_hr_threshold > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]") - if ( config_ptr->increment < (double)1.0f ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "increment must be greater than or equal to 1.0"); - } - - if ( ( config_ptr->apply_max_increment != TRUE ) && - ( config_ptr->apply_max_increment != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_max_increment must be either TRUE or FALSE"); - } + if(config_ptr->increment < (double)1.0f) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0") /* no need to check max_increment, as it is a size_t, * and thus must be non-negative. @@ -5347,26 +5293,13 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, "epochs_before_eviction must be positive"); } - if ( config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "epochs_before_eviction too big"); - } - - if ( ( config_ptr->apply_empty_reserve != TRUE ) && - ( config_ptr->apply_empty_reserve != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_empty_reserve must be either TRUE or FALSE"); - } - - if ( ( config_ptr->apply_empty_reserve ) && - ( ( config_ptr->empty_reserve > (double)1.0f ) || - ( config_ptr->empty_reserve < (double)0.0f ) ) ) { + if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "empty_reserve must be in the interval [0.0, 1.0]"); - } + if((config_ptr->apply_empty_reserve) && + ((config_ptr->empty_reserve > (double)1.0f) || + (config_ptr->empty_reserve < (double)0.0f))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]") /* no need to check max_decrement as it is a size_t * and thus must be non-negative. @@ -6462,7 +6395,6 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, prev_ptr = entry_ptr->prev; if ( ! (entry_ptr->is_dirty) ) { - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry") } @@ -8843,7 +8775,7 @@ H5C_load_entry(H5F_t * f, #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /* Get the on-disk entry image */ - if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) { + if(0 == (type->flags & H5C__CLASS_SKIP_READS)) { unsigned tries, max_tries; /* The # of read attempts */ unsigned retries; /* The # of retries */ htri_t chk_ret; /* return from verify_chksum callback */ diff --git a/src/H5D.c b/src/H5D.c index b1643d1..c526a35 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -109,6 +109,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -145,7 +146,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") @@ -201,6 +202,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -227,7 +229,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") /* build and open the new dataset */ - if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ @@ -244,7 +246,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") /* Decrement refcount on dataset's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -310,7 +312,6 @@ done: if(ret_value < 0) if(dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") - FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ diff --git a/src/H5F.c b/src/H5F.c index 948eb7a..17a4cb5 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -446,7 +446,8 @@ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -489,7 +490,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* * Create a new file or truncate an existing file. */ - if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file */ @@ -552,7 +553,8 @@ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -577,7 +579,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Open the file */ - if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") /* Get an atom for the file */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b3ef1f2..d0e2171 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1436,7 +1436,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had #endif /* Only look for MPI views for raw data transfers */ - if(type==H5FD_MEM_DRAW) { + if(type == H5FD_MEM_DRAW) { H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ /* Obtain the data transfer properties */ @@ -1793,6 +1793,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); /* get the transfer mode from the dxpl */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index fa45d10..5b50385 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -32,6 +32,14 @@ #define H5CHECK #endif /* _H5private_H */ +/* When this header is included from a private HDF5 header, don't make calls to H5open() */ +#undef H5OPEN +#ifndef _H5private_H +#define H5OPEN H5open(), +#else /* _H5private_H */ +#define H5OPEN +#endif /* _H5private_H */ + /* * These are the bits that can be passed to the `flags' argument of * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine @@ -44,12 +52,12 @@ * Note that H5F_ACC_DEBUG is deprecated (nonfuncational) but retained as a * symbol for backward compatibility. */ -#define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */ -#define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */ -#define H5F_ACC_TRUNC (H5CHECK 0x0002u) /*overwrite existing files */ -#define H5F_ACC_EXCL (H5CHECK 0x0004u) /*fail if file already exists*/ +#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */ +#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ +#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */ +#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ -#define H5F_ACC_CREAT (H5CHECK 0x0010u) /*create non-existing files */ +#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */ #define H5F_ACC_SWMR_WRITE (H5CHECK 0x0020u) /*indicate that this file is * open for writing in a * single-writer/multi-reader (SWMR) @@ -70,7 +78,7 @@ /* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the * parent file. */ -#define H5F_ACC_DEFAULT (H5CHECK 0xffffu) /*ignore setting on lapl */ +#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */ /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */ #define H5F_OBJ_FILE (0x0001u) /* File objects */ @@ -258,7 +266,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ -#define H5F_ACC_DEBUG (H5CHECK 0x0000u) /*print debug info (deprecated)*/ +#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ /* Typedefs */ diff --git a/src/H5G.c b/src/H5G.c index 21957d8..b4c7742 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -290,6 +290,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, { H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -323,7 +324,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -378,6 +379,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) H5G_loc_t loc; H5G_t *grp = NULL; H5G_obj_create_t gcrt_info; /* Information for group creation */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -407,7 +409,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -422,7 +424,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object location of group") /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -457,6 +459,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -476,7 +479,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") /* Open the group */ - if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_ind_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the group */ @@ -595,6 +598,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -619,12 +623,12 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_loc_reset(&grp_loc); /* Find the group object */ - if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -658,6 +662,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -687,12 +692,13 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&grp_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: diff --git a/src/H5L.c b/src/H5L.c index 9daf948..264c00e 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -336,6 +336,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -366,7 +367,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -394,6 +395,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -424,7 +426,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -455,6 +457,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location for new link */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -471,7 +474,7 @@ H5Lcreate_soft(const char *link_target, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Create the link */ - if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -501,6 +504,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, { H5G_loc_t cur_loc, *cur_loc_p; H5G_loc_t new_loc, *new_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -533,7 +537,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, - lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -570,6 +574,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -585,7 +590,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Create external link */ - if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -614,6 +619,7 @@ herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Group's location */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -626,7 +632,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Unlink */ - if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -659,6 +665,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group's location */ H5L_trav_rmbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -686,7 +693,8 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, udata.dxpl_id = H5AC_dxpl_id; /* Traverse the group hierarchy to remove the link */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_by_idx_cb, &udata, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, + H5L_delete_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") done: @@ -718,6 +726,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -735,7 +744,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link value */ - if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value for '%s'", name) done: @@ -768,6 +777,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Group location for location to query */ H5L_trav_gvbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -793,12 +803,13 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.buf = buf; udata.size = size; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, + &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") @@ -824,6 +835,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; FUNC_ENTER_API(FAIL) @@ -841,7 +853,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check for the existence of the link */ - if((ret_value = H5L__exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -868,6 +880,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -885,7 +898,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link information */ - if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -914,6 +927,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group location for group to query */ H5L_trav_gibi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -939,11 +953,12 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.linfo = linfo; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") @@ -1103,6 +1118,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Location of group */ H5L_trav_gnbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1128,13 +1144,14 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.name = name; udata.size = size; udata.name_len = -1; /* Traverse the group hierarchy to locate the link to get name of */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ @@ -1242,6 +1259,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1272,7 +1290,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, + op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1374,6 +1393,7 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1396,7 +1416,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index dd2061c..8ef82b3 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -563,6 +563,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, size_t file_name_len; /* Length of file name string */ size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -598,7 +599,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ /* Create an external link */ - if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: diff --git a/src/H5O.c b/src/H5O.c index 2988567..0a1fd34 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -282,6 +282,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = FAIL; @@ -309,12 +310,12 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -426,6 +427,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, { H5G_loc_t new_loc; H5G_loc_t obj_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -449,7 +451,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Link to the object */ - if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -556,6 +558,7 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -573,7 +576,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check if the object exists */ - if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -635,6 +638,7 @@ herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -654,7 +658,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -685,6 +689,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -714,7 +719,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; @@ -792,6 +797,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -809,7 +815,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, name, comment, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -876,6 +882,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -893,7 +900,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -995,6 +1002,7 @@ herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1017,7 +1025,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Call internal object visitation routine */ - if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Pint.c b/src/H5Pint.c index 69b2791..443802c 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -1187,7 +1187,7 @@ H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) /* Check if the property has been deleted from list */ if(H5SL_search(plist->del,name) != NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "property deleted from skip list") } /* end if */ else { /* Get the property data from the skip list */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 783d9d8..d0e74df 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -99,6 +99,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, { H5G_loc_t loc; /* Location to create datatype */ H5T_t *type; /* Datatype for ID */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -134,7 +135,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") /* Commit the type */ - if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0) + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: @@ -248,6 +249,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ H5T_t *type = NULL; /* Datatype created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -274,7 +276,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") /* Commit the type */ - if(H5T__commit(loc.oloc->file, type, tcpl_id, H5AC_dxpl_id) < 0) + if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Release the datatype's object header */ @@ -286,7 +288,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get object location of committed datatype") /* Decrement refcount on committed datatype's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ -- cgit v0.12 From 7ef1551904dd3b70e8908da1cfce0a191d7e9e94 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 15 Jan 2016 12:06:41 -0500 Subject: [svn-r28908] Fix for multi-thread file pointer seg fault from H5Dread() and H5Dget_storage_size(). Tested on jam, platypus, moohan, ostrich, osx1010test, quail, emu, kite. --- src/H5B2.c | 32 ++++++ src/H5B2private.h | 1 + src/H5Dbtree2.c | 12 ++- src/H5Dearray.c | 12 ++- src/H5Dfarray.c | 12 ++- src/H5Dio.c | 6 ++ src/H5EA.c | 33 ++++++ src/H5EAprivate.h | 1 + src/H5FA.c | 33 ++++++ src/H5FAprivate.h | 1 + src/H5T.c | 29 ++++++ test/tfile.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 456 insertions(+), 9 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 62cd47e..0b2c52d 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -1582,3 +1582,35 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2_depend() */ +/*------------------------------------------------------------------------- + * Function: H5B2_patch_file + * + * Purpose: Patch the top-level file pointer contained in bt2 + * to point to idx_info->f if they are different. + * This is possible because the file pointer in bt2 can be + * closed out if bt2 remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2_patch_file(H5B2_t *bt2, H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(bt2); + HDassert(f); + + if(bt2->f != f || bt2->hdr->f != f) + bt2->f = bt2->hdr->f = f; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2_patch_file() */ diff --git a/src/H5B2private.h b/src/H5B2private.h index ad3248d..1620561 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -160,6 +160,7 @@ H5_DLL htri_t H5B2_support(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5_DLL herr_t H5B2_unsupport(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5AC_info_t *child); H5_DLL herr_t H5B2_depend(H5AC_info_t *parent_entry, H5B2_t *bt2); +H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info); diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index 2aa4701..2435fac 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -919,10 +919,12 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, HDassert(H5F_addr_defined(udata->chunk_block.offset)); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) + if(NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } else /* Patch the top level file pointer contained in bt2 if needed */ + H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1010,10 +1012,12 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(udata); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) + if(NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } else /* Patch the top level file pointer contained in bt2 if needed */ + H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1129,10 +1133,12 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_udata); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) + if(NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } else /* Patch the top level file pointer contained in bt2 if needed */ + H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 84c26bf..3896172 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -1038,10 +1038,12 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata HDassert(udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D__earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; @@ -1107,10 +1109,12 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda HDassert(udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D__earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; @@ -1309,10 +1313,12 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D__earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index 2958a66..e5541c7 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -989,10 +989,12 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata HDassert(udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->storage->u.farray.fa) + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D__farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; @@ -1058,10 +1060,12 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda HDassert(udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->storage->u.farray.fa) + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D__farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; @@ -1196,10 +1200,12 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->storage->u.farray.fa) + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D__farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; diff --git a/src/H5Dio.c b/src/H5Dio.c index c0aa83e..ac5c82b 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -412,6 +412,9 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Patch the top level file pointer for dt->shared->u.vlen.f if needed */ + H5T_patch_vlen_file(dataset->shared->type, dataset->oloc.file); + /* Set up datatype info for operation */ if(H5D__typeinfo_init(dataset, dxpl_cache, dxpl_id, mem_type_id, FALSE, &type_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info") @@ -632,6 +635,9 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Patch the top level file pointer for dt->shared->u.vlen.f if needed */ + H5T_patch_vlen_file(dataset->shared->type, dataset->oloc.file); + /* Set up datatype info for operation */ if(H5D__typeinfo_init(dataset, dxpl_cache, dxpl_id, mem_type_id, TRUE, &type_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info") diff --git a/src/H5EA.c b/src/H5EA.c index bf18239..6648bcf 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -1115,3 +1115,36 @@ CATCH elmt = H5FL_BLK_FREE(ea_native_elmt, elmt); END_FUNC(PRIV) /* end H5EA_iterate() */ + +/*------------------------------------------------------------------------- + * Function: H5EA_patch_file + * + * Purpose: Patch the top-level file pointer contained in ea + * to point to idx_info->f if they are different. + * This is possible because the file pointer in ea can be + * closed out if ea remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5EA_patch_file(H5EA_t *ea, H5F_t *f)) + + /* Local variables */ + +#ifdef H5EA_DEBUG +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* H5EA_DEBUG */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(f); + + if(ea->f != f || ea->hdr->f != f) + ea->f = ea->hdr->f = f; + +END_FUNC(PRIV) /* end H5EA_patch_file() */ diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index c00e118..78bcca8 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -146,6 +146,7 @@ H5_DLL herr_t H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea); H5_DLL herr_t H5EA_iterate(H5EA_t *fa, hid_t dxpl_id, H5EA_operator_t op, void *udata); H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id); H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); +H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); diff --git a/src/H5FA.c b/src/H5FA.c index a1b4fbc..70a4b56 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -850,3 +850,36 @@ HDfprintf(stderr, "%s: Called\n", FUNC); CATCH END_FUNC(PRIV) /* end H5FA_undepend() */ + +/*------------------------------------------------------------------------- + * Function: H5FA_patch_file + * + * Purpose: Patch the top-level file pointer contained in fa + * to point to idx_info->f if they are different. + * This is possible because the file pointer in fa can be + * closed out if fa remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5FA_patch_file(H5FA_t *fa, H5F_t *f)) + + /* Local variables */ + +#ifdef H5FA_DEBUG +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* H5FA_DEBUG */ + + /* + * Check arguments. + */ + HDassert(fa); + HDassert(f); + + if(fa->f != f || fa->hdr->f != f) + fa->f = fa->hdr->f = f; + +END_FUNC(PRIV) /* end H5FA_patch_file() */ diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h index b7c141a..2ce9cbb 100644 --- a/src/H5FAprivate.h +++ b/src/H5FAprivate.h @@ -131,6 +131,7 @@ H5_DLL herr_t H5FA_depend(H5AC_info_t *parent_entry, H5FA_t *fa); H5_DLL herr_t H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata); H5_DLL herr_t H5FA_close(H5FA_t *fa, hid_t dxpl_id); H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata); +H5_DLL herr_t H5FA_patch_file(H5FA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats); diff --git a/src/H5T.c b/src/H5T.c index 030f5a7..6514a35 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -5466,6 +5466,35 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_patch_vlen_file + * + * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.f) + * to point to f. This is possible because + * the top-level file pointer can be closed out from under + * dt while dt is contained in the shared file's cache. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_patch_vlen_file(H5T_t *dt, H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(dt); + HDassert(dt->shared); + HDassert(f); + + if((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.f != f) + dt->shared->u.vlen.f = f; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5T_patch_vlen_file() */ + + +/*------------------------------------------------------------------------- * Function: H5Tflush * * Purpose: Flushes all buffers associated with a named datatype to disk. diff --git a/test/tfile.c b/test/tfile.c index 3fbfce3..0974416 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -2123,6 +2123,297 @@ test_file_double_dataset_open(void) /**************************************************************** ** +** test_file_double_file_dataset_open(): +** This test checks multi-opens of files & datasets: +** It simulates the multi-thread test program from DLS +** which exposes the file pointer segmentation fault failure. +** NOTE: The order on when the files and datasets are open/close +** is important. +** +*****************************************************************/ +static void +test_file_double_file_dataset_open(hbool_t new) +{ + hid_t fapl = -1; /* File access property list */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t did1 = -1, did2 = -1; /* Dataset IDs */ + hid_t sid1 = -1, sid2 = -1; /* Dataspace IDs */ + hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */ + hsize_t dims[1] = {4}, dims2[2] = {1, 4}; /* Dimension sizes */ + hsize_t max_dims0[1] = {8}; /* Maximum dimension sizes */ + hsize_t max_dims1[1] = {H5S_UNLIMITED}; /* Maximum dimesion sizes for extensible array index */ + hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */ + hsize_t chunks[1] = {4}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */ + char* data[] = {"String 1", "String 2", "String 3", "String 4"}; /* Input Data */ + char* buffer[4]; /* Output buffer */ + int wbuf[4] = {1, 2, 3, 4}; /* Input data */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing double file and dataset open/close\n")); + + /* Setting up test file */ + + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + if(new) { + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + } + + /* Create the test file */ + fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Create a chunked dataset with fixed array indexing */ + sid1 = H5Screate_simple(1, dims, max_dims0); + CHECK(sid1, FAIL, "H5Screate"); + tid1 = H5Tcopy(H5T_C_S1); + CHECK(tid1, FAIL, "H5Tcopy"); + ret = H5Tset_size(tid1, H5T_VARIABLE); + CHECK(ret, FAIL, "H5Tset_size"); + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + ret = H5Pset_chunk(dcpl, 1, chunks); + CHECK(ret, FAIL, "H5Pset_chunk"); + + did1 = H5Dcreate2(fid1, "dset_fa", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dcreate2"); + + /* Closing */ + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Pclose(dcpl); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create a chunked dataset with extensible array indexing */ + sid1 = H5Screate_simple(1, dims, max_dims1); + CHECK(sid1, FAIL, "H5Screate"); + tid1 = H5Tcopy(H5T_C_S1); + CHECK(tid1, FAIL, "H5Tcopy"); + ret = H5Tset_size(tid1, H5T_VARIABLE); + CHECK(ret, FAIL, "H5Tset_size"); + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + ret = H5Pset_chunk(dcpl, 1, chunks); + CHECK(ret, FAIL, "H5Pset_chunk"); + + did1 = H5Dcreate2(fid1, "dset_ea", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dcreate2"); + + /* Write to the dataset */ + ret = H5Dwrite(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Closing */ + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Pclose(dcpl); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create a chunked dataset with v2 btree indexing */ + sid2 = H5Screate_simple(2, dims2, max_dims2); + CHECK(sid2, FAIL, "H5Screate"); + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + ret = H5Pset_chunk(dcpl, 2, chunks2); + CHECK(ret, FAIL, "H5Pset_chunk"); + + did2 = H5Dcreate2(fid1, "dset_bt2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT); + CHECK(did2, FAIL, "H5Dcreate2"); + + /* Write to the dataset */ + ret = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Closing */ + ret = H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Pclose(dcpl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Scenario 1 + */ + + /* First file open */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fopen"); + + /* First file's dataset open */ + did1 = H5Dopen2(fid1, "/dset_fa", H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dopen2"); + + tid1 = H5Tcopy(did1); + CHECK(tid1, FAIL, "H5Tcopy"); + + /* First file's dataset write */ + ret = H5Dwrite(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Second file open */ + fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid2, FAIL, "H5Fopen"); + + /* Second file's dataset open */ + did2 = H5Dopen2(fid2, "/dset_fa", H5P_DEFAULT ); + CHECK(did2, FAIL, "H5Dopen2"); + + tid2 = H5Tcopy(did2); + CHECK(tid2, FAIL, "H5Tcopy"); + + /* First file's dataset close */ + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + + /* First file close */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Second file's dataset write */ + ret = H5Dwrite(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Second file's dataset close */ + ret = H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + + /* Second file close */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); + + /* Closing */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Tclose(tid2); + CHECK(ret, FAIL, "H5Tclose"); + + /* + * Scenario 2 + */ + + /* First file open */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fopen"); + + /* Second file open */ + fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid2, FAIL, "H5Fopen"); + + /* Second file's dataset open */ + did2 = H5Dopen2(fid2, "/dset_ea", H5P_DEFAULT ); + CHECK(did2, FAIL, "H5Dopen2"); + + tid2 = H5Tcopy(did2); + CHECK(tid2, FAIL, "H5Tcopy"); + + /* First file's dataset open */ + did1 = H5Dopen2(fid1, "/dset_ea", H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dopen2"); + + tid1 = H5Tcopy(did1); + CHECK(tid1, FAIL, "H5Tcopy"); + + /* Second file's dataset read */ + HDmemset(buffer, 0, sizeof(char*) * 4); + ret = H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); + CHECK(ret, FAIL, "H5Dread"); + + /* Second file's dataset close */ + ret = H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + + /* Second file close */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); + + /* First file's dataset read */ + HDmemset(buffer, 0, sizeof(char*) * 4); + ret = H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); + + /* First file's dataset close */ + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + + /* First file close */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Closing */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + ret = H5Tclose(tid2); + CHECK(ret, FAIL, "H5Tclose"); + + /* + * Scenario 3 + */ + + /* First file open */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fopen"); + + /* First file's dataset open */ + did1 = H5Dopen2(fid1, "/dset_bt2", H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dopen2"); + + /* First file's get storage size */ + ret = H5Dget_storage_size(did1); + CHECK(ret, FAIL, "H5Dget_storage_size"); + + /* Second file open */ + fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid2, FAIL, "H5Fopen"); + + /* Second file's dataset open */ + did2 = H5Dopen2(fid2, "/dset_bt2", H5P_DEFAULT ); + CHECK(did2, FAIL, "H5Dopen2"); + + /* First file's dataset close */ + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + + /* First file close */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Second file's get storage size */ + ret = H5Dget_storage_size(did2); + CHECK(ret, FAIL, "H5Dget_storage_size"); + + /* Second file's dataset close */ + ret = H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + + /* Second file close */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); + +} /* end test_file_double_dataset_open() */ + +/**************************************************************** +** ** test_file_double_datatype_open(): low-level file test routine. ** This test checks whether opening the same named datatype from two ** different files works correctly. @@ -3694,6 +3985,8 @@ test_file(void) test_file_double_group_open(); /* Test opening same group from two files works properly */ test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ + test_file_double_file_dataset_open(TRUE); + test_file_double_file_dataset_open(FALSE); test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ -- cgit v0.12 From a89fcf7ffdaf242e13c269d200c3f26f45542428 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:15:30 -0500 Subject: [svn-r28917] Description: Bring r28916 from trunk to revise_chunks branch: Normalize against incoming changes from the phdf5_metadata_opt branch. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5A.c | 126 ++++++++++++++++++++++++++++++++---------------------- src/H5D.c | 27 ++++-------- src/H5F.c | 18 +++----- src/H5G.c | 45 ++++++++----------- src/H5L.c | 116 +++++++++++++++++++++++++++---------------------- src/H5Lexternal.c | 4 ++ src/H5O.c | 69 ++++++++++++++---------------- src/H5Pfapl.c | 14 ++++-- src/H5Pint.c | 75 +++++++++++++++++++++++++++++++- src/H5Ppkg.h | 27 ------------ src/H5Pprivate.h | 45 ++++++++++++++++--- src/H5Ppublic.h | 4 ++ src/H5Tcommit.c | 27 ++++-------- 13 files changed, 346 insertions(+), 251 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 97d082c..e478610 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -246,7 +246,7 @@ H5A_term_package(void) --------------------------------------------------------------------------*/ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, - hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id) + hid_t acpl_id, hid_t aapl_id) { H5A_t *attr = NULL; /* Attribute created */ H5G_loc_t loc; /* Object location */ @@ -272,6 +272,10 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go do the real work for attaching the attribute to the object */ if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") @@ -321,7 +325,7 @@ done: --------------------------------------------------------------------------*/ hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, + hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -360,14 +364,22 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, obj_loc.path = &obj_path; H5G_loc_reset(&obj_loc); - /* Find the object's location */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Find the object's location */ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Go do the real work for attaching the attribute to the dataset */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") @@ -405,7 +417,7 @@ done: H5Aclose or resource leaks will develop. --------------------------------------------------------------------------*/ hid_t -H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) +H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ @@ -423,6 +435,10 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Read in attribute from object header */ if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) @@ -468,7 +484,7 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + hid_t aapl_id, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ @@ -493,6 +509,10 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") @@ -537,7 +557,7 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ @@ -565,6 +585,10 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute in the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") @@ -892,11 +916,10 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1030,11 +1053,10 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) @@ -1093,11 +1115,10 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1193,11 +1214,10 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") if(!new_attr_name || !*new_attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1370,11 +1390,10 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1496,11 +1515,11 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1508,13 +1527,16 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - dxpl_id = H5AC_ind_dxpl_id; if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Delete the attribute from the location */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Delete the attribute from the location */ if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1577,11 +1599,11 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1589,13 +1611,16 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - dxpl_id = H5AC_ind_dxpl_id; if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Delete the attribute from the location */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Delete the attribute from the location */ if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1717,11 +1742,10 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") diff --git a/src/H5D.c b/src/H5D.c index c526a35..18c2edb 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -138,12 +138,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) @@ -221,12 +218,9 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) @@ -293,12 +287,9 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id))) diff --git a/src/H5F.c b/src/H5F.c index 17a4cb5..9c4b1c9 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -471,12 +471,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") - /* Check the file access property list */ - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* * Adjust bit flags by turning on the creation bit and making sure that @@ -572,11 +569,10 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) /* Asking for SWMR read access on a non-read-only file is invalid */ if((flags & H5F_ACC_SWMR_READ) && (flags & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "SWMR read access on a file open for read-write access is not allowed") - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) diff --git a/src/H5G.c b/src/H5G.c index b4c7742..44e8602 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -316,12 +316,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) @@ -396,12 +393,9 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -471,12 +465,9 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) @@ -611,11 +602,10 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -680,11 +670,10 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; diff --git a/src/H5L.c b/src/H5L.c index 264c00e..23eb395 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -357,6 +357,10 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -416,6 +420,10 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -473,6 +481,10 @@ H5Lcreate_soft(const char *link_target, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create the link */ if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") @@ -525,6 +537,10 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up current & new location pointers */ cur_loc_p = &cur_loc; new_loc_p = &new_loc; @@ -589,6 +605,10 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create external link */ if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") @@ -631,6 +651,10 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Unlink */ if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") @@ -680,11 +704,10 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ udata.idx_type = idx_type; @@ -737,11 +760,10 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) @@ -793,11 +815,10 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ udata.idx_type = idx_type; @@ -846,11 +867,10 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -891,15 +911,14 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -943,11 +962,10 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -959,8 +977,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") - + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1134,11 +1151,10 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -1152,7 +1168,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the link to get name of */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ ret_value = udata.name_len; @@ -1275,11 +1291,10 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1292,7 +1307,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, /* Iterate over the links */ if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ if(idx_p) @@ -1409,15 +1424,14 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 8ef82b3..877de41 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -598,6 +598,10 @@ H5Lcreate_external(const char *file_name, const char *obj_name, p += file_name_len; HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create an external link */ if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") diff --git a/src/H5O.c b/src/H5O.c index 0a1fd34..f8f17b6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -298,11 +298,10 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -450,6 +449,10 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Link to the object */ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") @@ -569,11 +572,10 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -651,11 +653,10 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) @@ -707,11 +708,10 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -808,11 +808,10 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) @@ -893,11 +892,10 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) @@ -1018,11 +1016,10 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) @@ -1474,7 +1471,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 40a529b..14991c4 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -471,13 +471,13 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the core VFD backing store page size */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -3475,6 +3475,9 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3502,7 +3505,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_core_write_tracking() */ /*------------------------------------------------------------------------- @@ -3513,6 +3516,9 @@ done: * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3541,7 +3547,7 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_siz done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_core_write_tracking() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pint.c b/src/H5Pint.c index 443802c..d80e66d 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -139,6 +139,8 @@ hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; +hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL; +H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL; hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL; H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL; hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL; @@ -163,6 +165,7 @@ hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL; hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL; hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL; hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL; +hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL; hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL; hid_t H5P_LST_LINK_CREATE_ID_g = FAIL; hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL; @@ -186,6 +189,26 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ NULL /* Class close callback info */ }}; +/* Attribute access property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_AACC[1] = {{ + "attribute access", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_ACCESS, /* Class type */ + + &H5P_CLS_LINK_ACCESS_g, /* Parent class */ + &H5P_CLS_ATTRIBUTE_ACCESS_g, /* Pointer to class */ + &H5P_CLS_ATTRIBUTE_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_ACCESS_ID_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + /* Group access property list class library initialization object */ /* (move to proper source code file when used for real) */ const H5P_libclass_t H5P_CLS_GACC[1] = {{ @@ -297,6 +320,7 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_TCRT, /* Datatype creation */ H5P_CLS_TACC, /* Datatype access */ H5P_CLS_ACRT, /* Attribute creation */ + H5P_CLS_AACC, /* Attribute access */ H5P_CLS_LCRT /* Link creation */ }; @@ -487,6 +511,7 @@ H5P_term_package(void) H5P_LST_DATATYPE_CREATE_ID_g = H5P_LST_DATATYPE_ACCESS_ID_g = H5P_LST_ATTRIBUTE_CREATE_ID_g = + H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5P_LST_OBJECT_COPY_ID_g = H5P_LST_LINK_CREATE_ID_g = H5P_LST_LINK_ACCESS_ID_g = @@ -513,6 +538,7 @@ H5P_term_package(void) H5P_CLS_DATATYPE_ACCESS_g = H5P_CLS_STRING_CREATE_g = H5P_CLS_ATTRIBUTE_CREATE_g = + H5P_CLS_ATTRIBUTE_ACCESS_g = H5P_CLS_OBJECT_COPY_g = H5P_CLS_LINK_CREATE_g = H5P_CLS_LINK_ACCESS_g = @@ -531,6 +557,7 @@ H5P_term_package(void) H5P_CLS_DATATYPE_ACCESS_ID_g = H5P_CLS_STRING_CREATE_ID_g = H5P_CLS_ATTRIBUTE_CREATE_ID_g = + H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5P_CLS_OBJECT_COPY_ID_g = H5P_CLS_LINK_CREATE_ID_g = H5P_CLS_LINK_ACCESS_ID_g = @@ -5253,7 +5280,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDcompile_assert(H5P_TYPE_LINK_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); /* Check arguments */ @@ -5316,6 +5343,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_ATTRIBUTE_CREATE_ID_g; break; + case H5P_TYPE_ATTRIBUTE_ACCESS: + class_id = H5P_CLS_ATTRIBUTE_ACCESS_ID_g; + break; + case H5P_TYPE_OBJECT_COPY: class_id = H5P_CLS_OBJECT_COPY_ID_g; break; @@ -5403,3 +5434,45 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ + +/*------------------------------------------------------------------------- + * Function: H5P_verify_apl_and_dxpl + * + * Purpose: Validate access property list and/or switch from generic + * property list to default of correct type. + * + * Also, if using internal DXPL and collective flag is set, + * switch to internal collective DXPL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(acspl_id); + HDassert(libclass); + HDassert(dxpl_id); + + /* Set access plist to the default property list of the appropriate class if it's the generic default */ + if(H5P_DEFAULT == *acspl_id) + *acspl_id = *libclass->def_plist_id; + else { + /* Sanity check the access property list class */ + if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_verify_apl_and_dxpl() */ + diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 6dffcec..7968416 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -115,33 +115,6 @@ struct H5P_genplist_t { H5SL_t *props; /* Skip list containing properties */ }; -/* Function pointer for library classes with properties to register */ -typedef herr_t (*H5P_init_class_op_t)(H5P_genclass_t *pclass); -typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); - -/* - * Each library property list class has a variable of this type that contains - * class variables and methods used to initialize the class. - */ -typedef struct H5P_libclass_t { - const char *name; /* Class name */ - H5P_plist_type_t type; /* Class type */ - - H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ - H5P_genclass_t * * pclass; /* Pointer to global property list class */ - hid_t * const class_id; /* Pointer to global property list class ID */ - hid_t * const def_plist_id; /* Pointer to global default property list ID */ - H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ - - /* Class callback function pointers & info */ - H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ - void *create_data; /* Pointer to user data to pass along to create callback */ - H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ - void *copy_data; /* Pointer to user data to pass along to copy callback */ - H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ - void *close_data; /* Pointer to user data to pass along to close callback */ -} H5P_libclass_t; - /* Property list/class iterator callback function pointer */ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 05830d1..7e76a4f 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -73,9 +73,36 @@ typedef enum H5P_plist_type_t { H5P_TYPE_OBJECT_COPY = 15, H5P_TYPE_LINK_CREATE = 16, H5P_TYPE_LINK_ACCESS = 17, + H5P_TYPE_ATTRIBUTE_ACCESS = 18, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; +/* Function pointer for library classes with properties to register */ +typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); + +/* + * Each library property list class has a variable of this type that contains + * class variables and methods used to initialize the class. + */ +typedef struct H5P_libclass_t { + const char *name; /* Class name */ + H5P_plist_type_t type; /* Class type */ + + H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ + H5P_genclass_t * * pclass; /* Pointer to global property list class */ + hid_t * const class_id; /* Pointer to global property list class ID */ + hid_t * const def_plist_id; /* Pointer to global default property list ID */ + H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ + + /* Class callback function pointers & info */ + H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ + void *create_data; /* Pointer to user data to pass along to create callback */ + H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ + void *copy_data; /* Pointer to user data to pass along to copy callback */ + H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ + void *close_data; /* Pointer to user data to pass along to close callback */ +} H5P_libclass_t; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -94,11 +121,20 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g; +H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_STRING_CREATE_g; +/* Internal property list classes */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_AACC[1]; /* Attribute access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ + /******************************/ /* Library Private Prototypes */ @@ -124,6 +160,8 @@ H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); + +/* Internal helper routines */ H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); @@ -143,6 +181,7 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); +H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); @@ -152,12 +191,6 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist); H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id); H5_DLL H5P_genplist_t *H5P_object_verify(hid_t plist_id, hid_t pclass_id); -/* Private functions to "peek" at properties of a certain type */ -H5_DLL unsigned H5P_peek_unsigned(H5P_genplist_t *plist, const char *name); -H5_DLL hid_t H5P_peek_hid_t(H5P_genplist_t *plist, const char *name); -H5_DLL void *H5P_peek_voidp(H5P_genplist_t *plist, const char *name); -H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name); - /* Private DCPL routines */ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 1cfba40..5be913d 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -66,6 +66,7 @@ #define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g) #define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g) #define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) @@ -84,6 +85,7 @@ #define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g) #define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g) #define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) @@ -189,6 +191,7 @@ H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g; @@ -206,6 +209,7 @@ H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g; diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index d0e74df..39b0a2a 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -127,12 +127,9 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) @@ -268,12 +265,9 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) @@ -547,12 +541,9 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; -- cgit v0.12 From 00377993f5e1e1f720ec3657f9236008355151f8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:29:54 -0500 Subject: [svn-r28920] Description: Bring r28918 from trunk to the revise_chunks branch: I missed changes to a couple of expected error output files with the last checkin. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- tools/h5dump/errfiles/tdset-2.err | 2 +- tools/h5dump/errfiles/tperror.err | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/h5dump/errfiles/tdset-2.err b/tools/h5dump/errfiles/tdset-2.err index 775351e..e594c1b 100644 --- a/tools/h5dump/errfiles/tdset-2.err +++ b/tools/h5dump/errfiles/tdset-2.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table diff --git a/tools/h5dump/errfiles/tperror.err b/tools/h5dump/errfiles/tperror.err index 29f9e7f..b469029 100644 --- a/tools/h5dump/errfiles/tperror.err +++ b/tools/h5dump/errfiles/tperror.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table -- cgit v0.12 From c5a58dc53f460a0535e4b083f91eb16d2e3e8e67 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 20 Jan 2016 10:06:17 -0500 Subject: [svn-r28931] Merge of r28905, 28906 from trunk (C++ array bugfix). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial, C++ only --- MANIFEST | 1 + c++/src/H5AbstractDs.cpp | 3 + c++/src/H5ArrayType.cpp | 123 ++++++++++++------- c++/src/H5ArrayType.h | 3 + c++/src/H5CompType.cpp | 11 +- c++/test/CMakeLists.txt | 1 + c++/test/Makefile.am | 7 +- c++/test/h5cpputil.h | 2 + c++/test/tarray.cpp | 312 +++++++++++++++++++++++++++++++++++++++++++++++ c++/test/testhdf5.cpp | 2 +- c++/test/ttypes.cpp | 1 - 11 files changed, 409 insertions(+), 57 deletions(-) create mode 100644 c++/test/tarray.cpp diff --git a/MANIFEST b/MANIFEST index 84fb0a9..8bfaaa2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -381,6 +381,7 @@ ./c++/test/dsets.cpp ./c++/test/h5cpputil.cpp ./c++/test/h5cpputil.h +./c++/test/tarray.cpp ./c++/test/tattr.cpp ./c++/test/tcompound.cpp ./c++/test/tdspl.cpp diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 06b3e22..4e9a4d5 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -141,8 +141,11 @@ ArrayType AbstractDs::getArrayType() const // depending on which object invokes getArrayType. Then, create and // return the ArrayType object try { + // Create ArrayType and set values this way to work around the + // problem described in the JIRA issue HDFFV-7947 ArrayType arraytype; f_DataType_setId(&arraytype, p_get_type()); + arraytype.setArrayInfo(); return(arraytype); } catch (DataSetIException E) { diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 85340f8..0f09631 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -35,12 +35,7 @@ namespace H5 { ///\brief Default constructor: Creates a stub ArrayType // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::ArrayType() : DataType() -{ - // Initialize members - rank = -1; - dimensions = NULL; -} +ArrayType::ArrayType() : DataType(), rank(-1), dimensions(NULL) {} //-------------------------------------------------------------------------- // Function: ArrayType overloaded constructor @@ -51,20 +46,7 @@ ArrayType::ArrayType() : DataType() //-------------------------------------------------------------------------- ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) { - // Get the rank of the existing array and store it in this array - rank = H5Tget_array_ndims(existing_id); - if (rank < 0) - { - throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_ndims failed"); - } - - // Allocate space for the dimensions - dimensions = new hsize_t[rank]; - - // Get the dimensions of the existing array and store it in this array - int ret_value = H5Tget_array_dims2(id, dimensions); - if (ret_value < 0) - throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_dims2 failed"); + setArrayInfo(); } //-------------------------------------------------------------------------- @@ -111,25 +93,67 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) } //-------------------------------------------------------------------------- +// Function: ArrayType::setArrayInfo +///\brief Retrieves the rank and dimensions from the array datatype +/// and store the info in this ArrayType object. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - January 2016 +//-------------------------------------------------------------------------- +void ArrayType::setArrayInfo() +{ + // Get the rank of the array type specified by id from the C API + int ndims = H5Tget_array_ndims(id); + if (ndims < 0) + { + throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_ndims failed"); + } + + // Get the dimensions from the C API + hsize_t* dims; + dims = new hsize_t[ndims]; + if (dims != NULL) + { + // Get the dimensions + ndims = H5Tget_array_dims2(id, dims); + if (ndims < 0) + throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_dims2 failed"); + + // Store the array's info in memory + rank = ndims; + dimensions = new hsize_t[rank]; + for (int i = 0; i < rank; i++) + dimensions[i] = dims[i]; + delete []dims; + } +} // setArrayInfo + +//-------------------------------------------------------------------------- // Function: ArrayType::getArrayNDims ///\brief Returns the number of dimensions for an array datatype. ///\return Number of dimensions ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - May 2004 +// Modification +// Modified to use setArrayInfo(). +// If rank is positive, return rank +// If rank is invalid but object has a valid identifier, obtain the +// rank and dimensions, store them in the object, and return rank +// Otherwise, i.e., rank is invalid and object doesn't have a +// valid identifier, throw an exception //-------------------------------------------------------------------------- int ArrayType::getArrayNDims() { - // If the array's rank has not been stored, i.e. rank is init to -1, - // retrieve it via the C API - if (rank < 0) - { - rank = H5Tget_array_ndims(id); - if (rank < 0) - { - throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed"); - } - } - return(rank); + // Validate the id first, this object could be a default object + if (!p_valid_id(id)) + throw DataTypeIException("ArrayType::getArrayNDims", "ArrayType object is not a valid array type."); + + // If the array's info has not been stored, i.e. "rank" still has its + // initial value, -1, and "dimensions" is still NULL, retrieve rank and + // dimensions via the C API and store them in this ArrayType object. + if (rank < 0 && dimensions == NULL) + setArrayInfo(); + + return(rank); } //-------------------------------------------------------------------------- @@ -139,25 +163,30 @@ int ArrayType::getArrayNDims() ///\return Number of dimensions ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - May 2004 +// Modification +// Jan, 2016 +// Modified to use setArrayInfo(). +// If the array information has not been stored, retrieve rank and +// dimensions of the array type identified by "id" via the C API. +// Copy "dimensions" to the user's buffer //-------------------------------------------------------------------------- int ArrayType::getArrayDims(hsize_t* dims) { - // If the array's dimensions have not been stored, retrieve them via C API - if (dimensions == NULL) - { - int ndims = H5Tget_array_dims2(id, dims); - if (ndims < 0) - throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); - // Store the array's info in memory - rank = ndims; - dimensions = new hsize_t[rank]; - for (int i = 0; i < rank; i++) - dimensions[i] = dims[i]; - } - // Otherwise, simply copy what's in 'dimensions' to 'dims' - for (int i = 0; i < rank; i++) - dims[i] = dimensions[i]; - return(rank); + // Validate the id first, this object could be a default object + if (!p_valid_id(id)) + throw DataTypeIException("ArrayType::getArrayDims", "ArrayType object is not a valid array type."); + + // If the array's info has not been stored, i.e. "rank" still has its + // initial value, -1, and "dimensions" is still NULL, retrieve rank and + // dimensions via the C API and store them in this ArrayType object. + if (rank < 0 && dimensions == NULL) + setArrayInfo(); + + // Copy what's in "dimensions" to user's buffer "dims" + for (int i = 0; i < rank; i++) + dims[i] = dimensions[i]; + + return(rank); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index 6577a6e..c0f4b38 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -31,6 +31,9 @@ class H5_DLLCPP ArrayType : public DataType { // specified base type. ArrayType(const DataType& base_type, int ndims, const hsize_t* dims); + // Stores the rank and dimensions in memory. + void setArrayInfo(); + // Returns the number of dimensions of this array datatype. int getArrayNDims(); diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index 6d31a68..82575d6 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -228,12 +228,12 @@ hid_t CompType::p_get_member_type(unsigned member_num) const DataType CompType::getMemberDataType( unsigned member_num ) const { try { - DataType datatype; + DataType datatype; f_DataType_setId(&datatype, p_get_member_type(member_num)); - return(datatype); + return(datatype); } catch (DataTypeIException E) { - throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg()); + throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg()); } } @@ -249,9 +249,10 @@ DataType CompType::getMemberDataType( unsigned member_num ) const ArrayType CompType::getMemberArrayType( unsigned member_num ) const { try { - ArrayType arraytype(p_get_member_type(member_num)); + ArrayType arraytype; f_DataType_setId(&arraytype, p_get_member_type(member_num)); - return(arraytype); + arraytype.setArrayInfo(); + return(arraytype); } catch (DataTypeIException E) { throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg()); diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 6f1d857..4bebeac 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -13,6 +13,7 @@ PROJECT (HDF5_CPP_TEST) #----------------------------------------------------------------------------- set (CPP_TEST_SRCS ${HDF5_CPP_TEST_SOURCE_DIR}/testhdf5.cpp + ${HDF5_CPP_TEST_SOURCE_DIR}/tarray.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tattr.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tcompound.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tdspl.cpp diff --git a/c++/test/Makefile.am b/c++/test/Makefile.am index 705ec72..07fe533 100644 --- a/c++/test/Makefile.am +++ b/c++/test/Makefile.am @@ -31,9 +31,10 @@ check_PROGRAMS=$(TEST_PROG) # The tests depend on the hdf5 library, test library, and the c++ library LDADD=$(LIBH5TEST) $(LIBH5CPP) $(LIBHDF5) -testhdf5_SOURCES=testhdf5.cpp dsets.cpp tattr.cpp tcompound.cpp \ - tdspl.cpp tfile.cpp tfilter.cpp th5s.cpp tlinks.cpp tobject.cpp \ - trefer.cpp ttypes.cpp tvlstr.cpp h5cpputil.cpp +testhdf5_SOURCES=testhdf5.cpp dsets.cpp tattr.cpp tarray.cpp \ + tcompound.cpp tdspl.cpp tfile.cpp tfilter.cpp th5s.cpp \ + tlinks.cpp tobject.cpp trefer.cpp ttypes.cpp tvlstr.cpp \ + h5cpputil.cpp # Tell conclude.am that these are C++ tests. CXX_API=yes diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 8625213..b615194 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -132,6 +132,7 @@ template #ifdef __cplusplus extern "C" { #endif +void test_array(); void test_attr(); void test_compound(); void test_dsproplist(); @@ -146,6 +147,7 @@ void test_vlstrings(); void test_dset(); /* Prototypes for the cleanup routines */ +void cleanup_array(); void cleanup_attr(); void cleanup_compound(); void cleanup_dsproplist(); diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp new file mode 100644 index 0000000..69b4438 --- /dev/null +++ b/c++/test/tarray.cpp @@ -0,0 +1,312 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/***************************************************************************** + FILE + tarray.cpp - HDF5 C++ testing the array datatype functionality + + ***************************************************************************/ + +#ifdef OLD_HEADER_FILENAME +#include +#else +#include +#endif +#include + +#ifndef H5_NO_NAMESPACE +#ifndef H5_NO_STD + using std::cerr; + using std::endl; +#endif // H5_NO_STD +#endif + +#include "H5Cpp.h" // C++ API header file + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +#include "h5cpputil.h" // C++ utilility header file + +const H5std_string FILENAME("tarray.h5"); +const hsize_t SPACE1_RANK = 1; +const hsize_t SPACE1_DIM1 = 4; +const hsize_t ARRAY1_RANK = 1; +const hsize_t ARRAY1_DIM1 = 4; + +typedef enum flt_t { + FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER +} flt_t; + +typedef enum int_t { + INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT, + INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER +} int_t; + + +/*------------------------------------------------------------------------- + * Function: test_array_compound_array + * + * Purpose: Tests 1-D array of compound datatypes (with array fields) + * + * Return: None. + * + * Programmer: Binh-Minh Ribler (using C version) + * January, 2016 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void test_array_compound_array() +{ + SUBTEST("ArrayType::getArrayNDims & ArrayType::getArrayDims"); + typedef struct { // Typedef for compound datatype */ + int i; + float f[ARRAY1_DIM1]; + } s1_t; + s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write + s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int nmemb; // Number of compound members + int ii, jj, kk; // counting variables + H5T_class_t mclass; // Datatype class for field + + // Initialize array data to write + for (ii =0; ii < SPACE1_DIM1; ii++) + for (jj = 0; jj < ARRAY1_DIM1; jj++) { + wdata[ii][jj].i = ii * 10 + jj; + for(kk = 0; kk < ARRAY1_DIM1; kk++) + wdata[ii][jj].f[kk]=(float)(ii * 10.0F + jj * 2.5F + kk); + } // end for + + try { + // Create File + H5File file1(FILENAME, H5F_ACC_TRUNC); + + // Create dataspace for datasets + DataSpace space(SPACE1_RANK, sdims1, NULL); + + /* + * Create an array datatype of compounds, arrtype. Each compound + * datatype, comptype, contains an integer and an array of floats, + * arrfltype. + */ + + // Create a compound datatype + CompType comptype(sizeof(s1_t)); + + // Insert integer field + comptype.insertMember("i", HOFFSET(s1_t, i), PredType::NATIVE_INT); + + // Create an array of floats datatype + ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1); + + // Insert float array field + comptype.insertMember("f", HOFFSET(s1_t, f), arrfltype); + + // Close array of floats field datatype + arrfltype.close(); + + // Create an array datatype of the compound datatype + ArrayType arrtype(comptype, ARRAY1_RANK, tdims1); + + // Close compound datatype comptype + comptype.close(); + + // Create a dataset + DataSet dataset = file1.createDataSet("Dataset1", arrtype, space); + + // Write dataset to disk + dataset.write(wdata, arrtype); + + // Close all + dataset.close(); + arrtype.close(); + space.close(); + file1.close(); + + // Re-open file + file1.openFile(FILENAME, H5F_ACC_RDONLY); + + // Open the dataset + dataset = file1.openDataSet("Dataset1"); + + /* + * Check the datatype array of compounds + */ + + // Verify that it is an array of compounds + DataType dstype = dataset.getDataType(); + mclass = dstype.getClass(); + verify_val(mclass, H5T_ARRAY, "f2_type.getClass", __LINE__, __FILE__); + dstype.close(); + + // Get the array datatype to check + ArrayType atype_check = dataset.getArrayType(); + + // Check the array rank + int ndims = atype_check.getArrayNDims(); + verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__); + + // Get the array dimensions + hsize_t rdims1[H5S_MAX_RANK]; + atype_check.getArrayDims(rdims1); + + // Check the array dimensions + for (ii =0; ii Date: Wed, 20 Jan 2016 18:17:01 -0500 Subject: [svn-r28940] Merge revision #28852 from hdf5_1_10_alpha1 to revise_chunks. This is the fix to downgrade superblock version for the tool h5format_convert so DLS can use 1.8 h5dump on the converted file. Tested on jam, platypus, moohan, osx1010test. --- src/H5F.c | 59 ++++++++++++++++++++++ src/H5Fpublic.h | 1 + tools/h5format_convert/h5fc_gentest.c | 18 ++++++- tools/h5format_convert/h5format_convert.c | 40 +++++++++++++++ tools/h5format_convert/testfiles/h5fc_v_all.ddl | 1 + tools/h5format_convert/testfiles/h5fc_v_bt1.ddl | 1 + tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl | 1 + tools/h5format_convert/testfiles/h5fc_v_n_all.ddl | 1 + .../testfiles/h5fc_v_ndata_bt1.ddl | 1 + .../testfiles/h5fc_v_non_chunked.ddl | 1 + 10 files changed, 122 insertions(+), 2 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 9c4b1c9..a822132 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1870,3 +1870,62 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Fstop_mdc_logging() */ + + +/*------------------------------------------------------------------------- + * Function: H5Fformat_convert_super (Internal) + * + * Purpose: Downgrade the superblock version for the tool h5format_convert. + * (NOTE: more needs to be done to this routine) + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; Jan 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Fformat_convert_super(hid_t fid) +{ + H5F_t *f = NULL; /* File to flush */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", fid); + + switch(H5I_get_type(fid)) { + case H5I_FILE: + if(NULL == (f = (H5F_t *)H5I_object(fid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + if(f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_LATEST) + HGOTO_DONE(SUCCEED) + f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_LATEST - 1; + + /* Mark superblock as dirty */ + if(H5F_super_dirty(f) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + + break; + + case H5I_GROUP: + case H5I_DATATYPE: + case H5I_DATASET: + case H5I_ATTR: + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + } /* end switch */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Fformat_convert_super() */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 5b50385..937e29f 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -254,6 +254,7 @@ H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id); H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, /*OUT*/ hbool_t *is_enabled, /*OUT*/ hbool_t *is_currently_logging); +H5_DLL herr_t H5Fformat_convert_super(hid_t fid); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c index 4dcc286..888aa27 100644 --- a/tools/h5format_convert/h5fc_gentest.c +++ b/tools/h5format_convert/h5fc_gentest.c @@ -172,6 +172,7 @@ gen_latest(const char *fname) { hid_t fid = -1; /* file id */ hid_t fapl = -1; /* file access property list */ + hid_t fcpl = -1; /* file creation property list */ hid_t gid = -1; /* group id */ hid_t sid = -1; /* space id */ hid_t dcpl = -1; /* dataset creation property id */ @@ -188,7 +189,12 @@ gen_latest(const char *fname) if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + if(H5Pset_shared_mesg_nindexes(fcpl, 4) < 0) + goto error; + + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0) goto error; /* Create a group */ @@ -365,6 +371,7 @@ static void gen_non(const char *fname) { hid_t fid = -1; /* file id */ + hid_t fcpl = -1; /* file creation property list */ hid_t gid = -1; /* group id */ hid_t sid = -1; /* space id */ hid_t dcpl = -1; /* dataset creation property id */ @@ -376,8 +383,15 @@ gen_non(const char *fname) int i; /* local index variable */ int buf[24]; /* data buffer */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + if(H5Pset_shared_mesg_nindexes(fcpl, 4) < 0) + goto error; + if(H5Pset_istore_k(fcpl, 64) < 0) + goto error; + /* Create a new file with SWMR_WRITE + non-latest-format */ - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, fcpl, H5P_DEFAULT)) < 0) goto error; /* Create a group */ diff --git a/tools/h5format_convert/h5format_convert.c b/tools/h5format_convert/h5format_convert.c index 7686acc..a80e332 100644 --- a/tools/h5format_convert/h5format_convert.c +++ b/tools/h5format_convert/h5format_convert.c @@ -377,6 +377,9 @@ main(int argc, const char *argv[]) H5E_auto2_t func; void *edata; hid_t fid = -1; + hid_t fcpl = -1; + H5F_file_space_type_t strategy; + hsize_t threshold; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -405,6 +408,28 @@ main(int argc, const char *argv[]) } else if(verbose_g) printf("Open the file %s\n", fname_g); + /* A temporaray fix: + * need to handle H5O_FSINFO_ID message when downgrade superblock version from 3 to 2 + */ + if((fcpl = H5Fget_create_plist(fid)) < 0) { + error_msg("unable to get file creation property list for \"%s\"\n", fname_g); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + if(H5Pget_file_space(fcpl, &strategy, &threshold) < 0) { + error_msg("unable to get file space strategy/threshold\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + /* Check for non-default strategy/threshold: + * --whether there is H5O_FSINFO_ID message in the superblock extension + */ + if(strategy != H5F_FILE_SPACE_ALL || threshold != 1) { + error_msg("unable to convert due to non-default file space strategy/threshold\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + if(dset_g) { /* Convert a specified dataset in the file */ if(verbose_g) printf("Going to process dataset: %s...\n", dname_g); @@ -417,6 +442,21 @@ main(int argc, const char *argv[]) goto done; } + if(verbose_g) { + if(noop_g) { + printf("Not processing the file's superblock version...\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; + } + printf("Processing the file's superblock version...\n"); + } + + if(H5Fformat_convert_super(fid) < 0) { + error_msg("unable to convert file's superblock version\"%s\"\n", fname_g); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + done: /* Close the file */ if(fid >= 0) { diff --git a/tools/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_all.ddl index 3f474fe..5a35c55 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_all.ddl @@ -23,4 +23,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list +Processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl index abb0a89..c96b647 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl @@ -8,4 +8,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list +Processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl index a26dc66..a7a622a 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl @@ -10,4 +10,5 @@ Verify the dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list +Not processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl index 76c70ee..3e92568 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -44,4 +44,5 @@ Retrieve the dataset's layout Dataset is not chunked: no further action Close the dataset Close the dataset creation property list +Not processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl index 86081f3..bdf3380 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl @@ -9,4 +9,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list +Not processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl index baba0e4..4caafe9 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl @@ -6,4 +6,5 @@ Retrieve the dataset's layout Dataset is not chunked: no further action Close the dataset Close the dataset creation property list +Processing the file's superblock version... Close the file -- cgit v0.12 From 5733dbc4adcfa5814e7a479b1ddeabbe74a962c8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Jan 2016 13:28:12 -0500 Subject: [svn-r28988] Merge of r28986 from trunk (H5_DLLVAR H5AC_dxpl_id). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial and parallel --- src/H5ACprivate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 1c81976..c628a5d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -209,7 +209,7 @@ typedef H5C_t H5AC_t; /* Dataset transfer property list for flush calls */ /* (Collective set, "block before metadata write" set and "library internal" set) */ /* (Global variable declaration, definition is in H5AC.c) */ -extern hid_t H5AC_dxpl_id; +H5_DLLVAR hid_t H5AC_dxpl_id; /* Dataset transfer property list for independent metadata I/O calls */ /* (just "library internal" set - i.e. independent transfer mode) */ -- cgit v0.12 From 821ce6874d9e2b322dda171f95901d5f68a1c26a Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 28 Jan 2016 23:40:43 -0500 Subject: [svn-r29014] h5format_convert(): fix to downgrade superblock version and persistent file space so 1.8 library can open/read the file. Tested on ostrich, kituo, platypus, moohan, quail, emu. More tests will be added later. --- src/H5F.c | 40 ++++- src/H5Fprivate.h | 1 + src/H5Fpublic.h | 2 +- src/H5MF.c | 185 +++++++++++++++------ src/H5MFprivate.h | 1 + tools/h5format_convert/h5format_convert.c | 38 +---- tools/h5format_convert/testfiles/h5fc_v_all.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_bt1.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl | 2 +- tools/h5format_convert/testfiles/h5fc_v_n_all.ddl | 2 +- .../testfiles/h5fc_v_ndata_bt1.ddl | 2 +- .../testfiles/h5fc_v_non_chunked.ddl | 2 +- 12 files changed, 188 insertions(+), 91 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index a822132..2cb81e0 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1875,8 +1875,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Fformat_convert_super (Internal) * - * Purpose: Downgrade the superblock version for the tool h5format_convert. - * (NOTE: more needs to be done to this routine) + * Purpose: Downgrade the superblock version to v2 and + * downgrade persistent file space to non-persistent + * for 1.8 library. * * Return: Non-negative on success/Negative on failure * @@ -1885,9 +1886,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Fformat_convert_super(hid_t fid) +H5Fformat_convert(hid_t fid) { H5F_t *f = NULL; /* File to flush */ + hbool_t mark_dirty = FALSE; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1897,13 +1899,37 @@ H5Fformat_convert_super(hid_t fid) case H5I_FILE: if(NULL == (f = (H5F_t *)H5I_object(fid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_LATEST) + + if(f->shared->sblock->super_vers > HDF5_SUPERBLOCK_VERSION_V18_LATEST) { + f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST; + mark_dirty = TRUE; + } + + if(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && + f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF) { + if(mark_dirty) { + /* Mark superblock as dirty */ + if(H5F_super_dirty(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + } HGOTO_DONE(SUCCEED) - f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_LATEST - 1; + } + + /* Check to remove free-space manager info message from superblock extension */ + if(H5F_addr_defined(f->shared->sblock->ext_addr)) { + if(H5F_super_ext_remove_msg(f, H5AC_dxpl_id, H5O_FSINFO_ID) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension") + } + + if(H5MF_try_close(f, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address") + + f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF; + f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; /* Mark superblock as dirty */ if(H5F_super_dirty(f) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") break; @@ -1928,4 +1954,4 @@ H5Fformat_convert_super(hid_t fid) done: FUNC_LEAVE_API(ret_value) -} /* end H5Fformat_convert_super() */ +} /* end H5Fformat_convert() */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 6be0cff..ecacfaf 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -485,6 +485,7 @@ #define HDF5_SUPERBLOCK_VERSION_2 2 /* Revised version with superblock extension and checksum */ #define HDF5_SUPERBLOCK_VERSION_3 3 /* With file locking and consistency flags (at least this version for SWMR support) */ #define HDF5_SUPERBLOCK_VERSION_LATEST HDF5_SUPERBLOCK_VERSION_3 /* The maximum super block format */ +#define HDF5_SUPERBLOCK_VERSION_V18_LATEST HDF5_SUPERBLOCK_VERSION_2 /* The latest superblock version for v18 */ #define HDF5_FREESPACE_VERSION 0 /* of the Free-Space Info */ #define HDF5_OBJECTDIR_VERSION 0 /* of the Object Directory format */ #define HDF5_SHAREDHEADER_VERSION 0 /* of the Shared-Header Info */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 937e29f..318f374 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -254,7 +254,7 @@ H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id); H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, /*OUT*/ hbool_t *is_enabled, /*OUT*/ hbool_t *is_currently_logging); -H5_DLL herr_t H5Fformat_convert_super(hid_t fid); +H5_DLL herr_t H5Fformat_convert(hid_t fid); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); diff --git a/src/H5MF.c b/src/H5MF.c index 0f2857e..e7c122d 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -86,6 +86,7 @@ typedef struct { /* Allocator routines */ static herr_t H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); static herr_t H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); +static herr_t H5MF_close_delete(H5F_t *f, hid_t dxpl_id); /*********************/ @@ -1145,6 +1146,141 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_close_shrink_eoa() */ + + +/*------------------------------------------------------------------------- + * Function: H5MF_close_delete + * + * Purpose: The coding is copied from H5MF_close() "else" statement + * to this routine so it can also be called by H5MF_try_close(). + * + * Return: SUCCEED/FAIL + * + * Programmer: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5MF_close_delete(H5F_t *f, hid_t dxpl_id) +{ + H5FD_mem_t type; /* Memory type for iteration */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: Entering\n", FUNC); +#endif /* H5MF_ALLOC_DEBUG */ + + /* check args */ + HDassert(f); + HDassert(f->shared); + + /* super_vers can be 0, 1, 2 */ + /* Iterate over all the free space types that have managers and get each free list's space */ + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { +#ifdef H5MF_ALLOC_DEBUG_MORE +HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); +#endif /* H5MF_ALLOC_DEBUG_MORE */ + /* If the free space manager for this type is open, close it */ + if(f->shared->fs_man[type]) { +#ifdef H5MF_ALLOC_DEBUG_MORE +HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); +#endif /* H5MF_ALLOC_DEBUG_MORE */ + if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") + f->shared->fs_man[type] = NULL; + f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; + } /* end if */ +#ifdef H5MF_ALLOC_DEBUG_MORE +HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); +#endif /* H5MF_ALLOC_DEBUG_MORE */ + + /* If there is free space manager info for this type, delete it */ + if(H5F_addr_defined(f->shared->fs_addr[type])) { + haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */ + + /* Put address into temporary variable and reset it */ + /* (Avoids loopback in file space freeing routine) */ + tmp_fs_addr = f->shared->fs_addr[type]; + f->shared->fs_addr[type] = HADDR_UNDEF; + + /* Shift to "deleting" state, to make certain we don't track any + * file space freed as a result of deleting the free space manager. + */ + f->shared->fs_state[type] = H5F_FS_STATE_DELETING; + +#ifdef H5MF_ALLOC_DEBUG_MORE +HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); +#endif /* H5MF_ALLOC_DEBUG_MORE */ + + /* Delete free space manager for this type */ + if(H5FS_delete(f, dxpl_id, tmp_fs_addr) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't delete free space manager") + + /* Shift [back] to closed state */ + HDassert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING); + f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; + + /* Sanity check that the free space manager for this type wasn't started up again */ + HDassert(!H5F_addr_defined(f->shared->fs_addr[type])); + } /* end if */ + } /* end for */ + +done: +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: Leaving\n", FUNC); +#endif /* H5MF_ALLOC_DEBUG */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5MF_close_delete() */ + + +/*------------------------------------------------------------------------- + * Function: H5MF_try_close + * + * Purpose: This is called by H5Fformat_convert() to close and delete + * free-space managers when downgrading persistent free-space + * to non-persistent. + * + * Return: SUCCEED/FAIL + * + * Programmer: + * + *------------------------------------------------------------------------- + */ +herr_t +H5MF_try_close(H5F_t *f, hid_t dxpl_id) +{ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: Entering\n", FUNC); +#endif /* H5MF_ALLOC_DEBUG */ + + /* check args */ + HDassert(f); + + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + + if(H5MF_close_delete(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to close delete free-space managers") + +done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: Leaving\n", FUNC); +#endif /* H5MF_ALLOC_DEBUG */ + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5MF_try_close() */ + /*------------------------------------------------------------------------- * Function: H5MF_close @@ -1287,55 +1423,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); } /* end for */ } /* end if */ else { /* super_vers can be 0, 1, 2 */ - /* Iterate over all the free space types that have managers and get each free list's space */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { -#ifdef H5MF_ALLOC_DEBUG_MORE -HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); -#endif /* H5MF_ALLOC_DEBUG_MORE */ - /* If the free space manager for this type is open, close it */ - if(f->shared->fs_man[type]) { -#ifdef H5MF_ALLOC_DEBUG_MORE -HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); -#endif /* H5MF_ALLOC_DEBUG_MORE */ - if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") - f->shared->fs_man[type] = NULL; - f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; - } /* end if */ -#ifdef H5MF_ALLOC_DEBUG_MORE -HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); -#endif /* H5MF_ALLOC_DEBUG_MORE */ - /* If there is free space manager info for this type, delete it */ - if(H5F_addr_defined(f->shared->fs_addr[type])) { - haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */ - - /* Put address into temporary variable and reset it */ - /* (Avoids loopback in file space freeing routine) */ - tmp_fs_addr = f->shared->fs_addr[type]; - f->shared->fs_addr[type] = HADDR_UNDEF; - - /* Shift to "deleting" state, to make certain we don't track any - * file space freed as a result of deleting the free space manager. - */ - f->shared->fs_state[type] = H5F_FS_STATE_DELETING; - -#ifdef H5MF_ALLOC_DEBUG_MORE -HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); -#endif /* H5MF_ALLOC_DEBUG_MORE */ - - /* Delete free space manager for this type */ - if(H5FS_delete(f, dxpl_id, tmp_fs_addr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't delete free space manager") - - /* Shift [back] to closed state */ - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING); - f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; + if(H5MF_close_delete(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") - /* Sanity check that the free space manager for this type wasn't started up again */ - HDassert(!H5F_addr_defined(f->shared->fs_addr[type])); - } /* end if */ - } /* end for */ } /* end else */ /* Free the space in aggregators (again) */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 024cc91..bb07f4e 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -63,6 +63,7 @@ H5_DLL herr_t H5MF_init_merge_flags(H5F_t *f); H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5MF_try_close(H5F_t *f, hid_t dxpl_id); /* File space allocation routines */ H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); diff --git a/tools/h5format_convert/h5format_convert.c b/tools/h5format_convert/h5format_convert.c index a80e332..54c666d 100644 --- a/tools/h5format_convert/h5format_convert.c +++ b/tools/h5format_convert/h5format_convert.c @@ -408,28 +408,6 @@ main(int argc, const char *argv[]) } else if(verbose_g) printf("Open the file %s\n", fname_g); - /* A temporaray fix: - * need to handle H5O_FSINFO_ID message when downgrade superblock version from 3 to 2 - */ - if((fcpl = H5Fget_create_plist(fid)) < 0) { - error_msg("unable to get file creation property list for \"%s\"\n", fname_g); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - if(H5Pget_file_space(fcpl, &strategy, &threshold) < 0) { - error_msg("unable to get file space strategy/threshold\n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - /* Check for non-default strategy/threshold: - * --whether there is H5O_FSINFO_ID message in the superblock extension - */ - if(strategy != H5F_FILE_SPACE_ALL || threshold != 1) { - error_msg("unable to convert due to non-default file space strategy/threshold\n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - if(dset_g) { /* Convert a specified dataset in the file */ if(verbose_g) printf("Going to process dataset: %s...\n", dname_g); @@ -443,16 +421,16 @@ main(int argc, const char *argv[]) } if(verbose_g) { - if(noop_g) { - printf("Not processing the file's superblock version...\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; - } - printf("Processing the file's superblock version...\n"); + if(noop_g) { + printf("Not processing the file's superblock...\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; + } + printf("Processing the file's superblock...\n"); } - if(H5Fformat_convert_super(fid) < 0) { - error_msg("unable to convert file's superblock version\"%s\"\n", fname_g); + if(H5Fformat_convert(fid) < 0) { + error_msg("unable to convert file's superblock\"%s\"\n", fname_g); h5tools_setstatus(EXIT_FAILURE); goto done; } diff --git a/tools/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_all.ddl index 5a35c55..9898faa 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_all.ddl @@ -23,5 +23,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list -Processing the file's superblock version... +Processing the file's superblock... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl index c96b647..3bafc78 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl @@ -8,5 +8,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list -Processing the file's superblock version... +Processing the file's superblock... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl index a7a622a..242386d 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl @@ -10,5 +10,5 @@ Verify the dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list -Not processing the file's superblock version... +Not processing the file's superblock... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl index 3e92568..3dec4a6 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -44,5 +44,5 @@ Retrieve the dataset's layout Dataset is not chunked: no further action Close the dataset Close the dataset creation property list -Not processing the file's superblock version... +Not processing the file's superblock... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl index bdf3380..a326dc5 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl @@ -9,5 +9,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list -Not processing the file's superblock version... +Not processing the file's superblock... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl index 4caafe9..bbc7229 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl @@ -6,5 +6,5 @@ Retrieve the dataset's layout Dataset is not chunked: no further action Close the dataset Close the dataset creation property list -Processing the file's superblock version... +Processing the file's superblock... Close the file -- cgit v0.12 From 61ab7b8bf3f15e31728ed5d4274a4e826f76ff7a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 29 Jan 2016 08:51:29 -0500 Subject: [svn-r29016] Merge of r28936, 28949, 28960-29009 from trunk. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ Fortran and C++ autotools parallel (MPICH 3.1.4) w/ Fortran CMake serial (3.3.2, via cmakehdf5) --- MANIFEST | 1 + bin/cmakehdf5 | 10 + c++/src/H5Library.cpp | 4 +- config/cce-fflags | 17 +- config/cce-flags | 18 +- config/cmake/ConfigureChecks.cmake | 9 - config/cmake/H5pubconf.h.in | 4 - config/gnu-cxxflags | 795 +++++++++++++++++++++++++++++++++++ config/gnu-fflags | 20 +- config/gnu-flags | 47 ++- config/ibm-flags | 29 +- config/intel-fflags | 16 +- config/intel-flags | 20 +- config/linux-gnulibc1 | 9 +- config/pgi-fflags | 16 +- config/pgi-flags | 36 +- configure.ac | 823 +++++++++++++++++++++++++------------ fortran/src/H5Sff.F90 | 4 +- hl/tools/gif2h5/h52giftest.sh.in | 2 +- src/CMakeLists.txt | 4 +- src/H5.c | 133 +++--- src/H5B.c | 11 +- src/H5B2cache.c | 4 - src/H5B2hdr.c | 4 +- src/H5B2int.c | 22 +- src/H5Bcache.c | 2 - src/H5Dcontig.c | 7 +- src/H5FDcore.c | 4 - src/H5Faccum.c | 35 +- src/H5Gcache.c | 2 - src/H5Gprivate.h | 7 - src/H5HFdblock.c | 4 +- src/H5HFtiny.c | 5 +- src/H5HG.c | 16 +- src/H5HLcache.c | 2 - src/H5MFprivate.h | 9 - src/H5Pdcpl.c | 14 +- src/H5SMcache.c | 3 +- src/H5STprivate.h | 4 +- src/H5Zscaleoffset.c | 4 - src/libhdf5.settings.in | 71 ++-- test/objcopy.c | 2 - 42 files changed, 1724 insertions(+), 525 deletions(-) create mode 100644 config/gnu-cxxflags diff --git a/MANIFEST b/MANIFEST index 8bfaaa2..9882fb1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -81,6 +81,7 @@ ./config/conclude_fc.am ./config/examples.am ./config/freebsd +./config/gnu-cxxflags ./config/gnu-fflags ./config/gnu-flags ./config/i386-pc-cygwin32 diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 7d9caa8..ccef469 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -46,6 +46,7 @@ cacheinit=$srcdir/config/cmake/cacheinit.cmake build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF # C++ interface default off build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF # Fortran interface default off build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON # High Level interface default on +build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=OFF # Threadsafe feature default off build_testing=-DBUILD_TESTING:BOOL=ON # Build tests default on build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON # Build tools default on with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT=ON # enable zlib filter default on @@ -82,6 +83,8 @@ Usage: $progname [] enable or disable c++ API. Default is off. --enable-hl | --disable-hl: enable or disable high level API. Default is on. + --enable-threadsafe | --disable-threadsafe: + enable or disable threadsafe feature. Default is off --enable-shared | --disable-shared: enable or disable shared lib. Default is on. --enable-tools | --disable-tools: @@ -229,6 +232,12 @@ while [ $# -gt 0 ]; do --disable-hl) build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF ;; + --enable-threadsafe) + build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=ON + ;; + --disable-threadsafe) + build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=OFF + ;; --enable-shared) shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON ;; @@ -330,6 +339,7 @@ STEP "Configure..." \ $build_cpp_lib \ $build_fortran \ $build_hl_lib \ + $build_threadsafe \ $shared_lib \ $build_testing \ $build_tools \ diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index 40c766a..be80fe4 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -262,10 +262,10 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, } // Default constructor - private -H5Library::H5Library(){}; +H5Library::H5Library(){} // Destructor - private -H5Library::~H5Library(){}; +H5Library::~H5Library(){} #ifndef H5_NO_NAMESPACE } // end namespace diff --git a/config/cce-fflags b/config/cce-fflags index 896e711..b96551d 100644 --- a/config/cce-fflags +++ b/config/cce-fflags @@ -53,14 +53,23 @@ if test "X-cce" = "X-$f9x_vendor"; then # Production # -Wl,-s to remove all symbols for smaller file - PROD_FCFLAGS="-O3 -Wl,-s" + # Note that this will likely override the symbols flag + PROD_FCFLAGS="-Wl,-s" # Debug - DEBUG_FCFLAGS="-g -O0" + DEBUG_FCFLAGS= - # Profile + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling # Use this for profiling with gprof - PROFILE_FCFLAGS="-g -p" + PROFILE_FCFLAGS="-p" + + # Optimization + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS="-O0" + NO_OPT_FCFLAGS="-O0" # Flags are set f9x_flags_set=yes diff --git a/config/cce-flags b/config/cce-flags index a34fcbe..bdfb5f9 100644 --- a/config/cce-flags +++ b/config/cce-flags @@ -55,18 +55,28 @@ if test "X-cce" = "X-$cc_vendor"; then # Production # -Wl,-s to remove all symbols for smaller file - PROD_CFLAGS="-O3 -Wl,-s" + PROD_CFLAGS="-Wl,-s" PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-g -O0" + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS= DEBUG_CPPFLAGS= - # Profile + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling # Use this for profiling with gprof - PROFILE_CFLAGS="-g -p" + PROFILE_CFLAGS="-p" PROFILE_CPPFLAGS= + # Optimization + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-O0" + NO_OPT_CFLAGS="-O0" + # Flags are set cc_flags_set=yes diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8bd6f45..49e9a05 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -6,15 +6,6 @@ include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) #----------------------------------------------------------------------------- -# Option to Clear File Buffers before write --enable-clear-file-buffers -#----------------------------------------------------------------------------- -option (HDF5_Enable_Clear_File_Buffers "Securely clear file buffers before writing to file" ON) -if (HDF5_Enable_Clear_File_Buffers) - set (H5_CLEAR_MEMORY 1) -endif (HDF5_Enable_Clear_File_Buffers) -MARK_AS_ADVANCED (HDF5_Enable_Clear_File_Buffers) - -#----------------------------------------------------------------------------- # Option for --enable-strict-format-checks #----------------------------------------------------------------------------- option (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index ce8219f..31c5afb 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -18,10 +18,6 @@ /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ -/* Define if the memory buffers being written to disk should be cleared before - writing. */ -#cmakedefine H5_CLEAR_MEMORY @H5_CLEAR_MEMORY@ - /* Define if C++ compiler recognizes offsetof */ #cmakedefine H5_CXX_HAVE_OFFSETOF @H5_CXX_HAVE_OFFSETOF@ diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags new file mode 100644 index 0000000..ee690db --- /dev/null +++ b/config/gnu-cxxflags @@ -0,0 +1,795 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# GNU g++ compiler or a derivative. It is careful not to do anything +# if the compiler is not GNU; otherwise `cxx_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for g++ +# unless a compiler version is already known +# +# cxx_vendor: The compiler name: g++ +# cxx_version: Version number: 2.91.60, 2.7.2.1 +# +if test X = "X$cxx_flags_set"; then + # PathScale compiler spits out gcc version string too. Need to + # filter it out. + # icc beginning with version 12 includes a "gcc version compatiblilty" + # string, causing the gcc H5_CFLAGS to be erroneously added. The line + # "grep -v 'icc version'" causes the discarding of any output + # containing 'icc version'. The cc_version for icc is correctly determined + # and flags added in the intel-flags script. + cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep -v 'PathScale' |\ + grep -v 'icc version' |\ + grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*\).*/\1/'` + cxx_version=`echo $cxx_version |sed 's/[-a-z]//g'` + if test X = "X$cxx_vendor" -a X != "X$cxx_version"; then + cxx_vendor=g++ + fi + if test "-" != "$cxx_vendor-$cxx_version"; then + echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" + fi + + # Some version numbers + cxx_vers_major=`echo $cxx_version | cut -f1 -d.` + cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` + cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` + test -n "$cc_vers_major" || cxx_vers_major=0 + test -n "$cc_vers_minor" || cxx_vers_minor=0 + test -n "$cc_vers_patch" || cxx_vers_patch=0 + cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` +fi + +# Common g++ flags for various situations +case "$cxx_vendor-$cxx_version" in + g++*) + # Architecture-specific flags + arch= + case "$host_os-$host_cpu" in + # FreeBSD sets the information from "uname -m" to the general machine + # architecture, not the specific CPU for the machine, so even our + # Pentium II Xeon server is set to "i386". Once we know we are on a FreeBSD + # machine, use the "sysctl" command to get the CPU hardware model. + freebsd*-i386) + host_cpu_model=`sysctl -n hw.model` + case "$host_cpu_model" in + # Hmm.. this might not catch Celerons, but it won't hurt them either... + *Pro*|*II*|*III*|*IV*|*Athlon*) + # architecture-specific optimizations cause problems + # for some users who build binaries to be used on + # multiple architectures. + # arch="-march=i686" + ;; + esac + ;; + + *-i686) + # architecture-specific optimizations cause problems + # for some users who build binaries to be used on + # multiple architectures. + # arch="-march=i686" + ;; + esac + + # Host-specific flags + case "`hostname`" in + sleipnir.ncsa.uiuc.edu) + arch="$arch -pipe" + ;; + esac + + # General (copied from H5_CFLAGS) + H5_CXXFLAGS="$H5_CXXFLAGS $arch -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wmissing-declarations -Wredundant-decls -Winline" + + # C++-specific + H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-promo -Woverloaded-virtual -Wold-style-cast -Weffc++ -Wreorder -Wnon-virtual-dtor -Wctor-dtor-privacy -Wabi" + + # Production + case "$cxx_vendor-$cxx_version" in + g++-[34].*) + PROD_CXXFLAGS="-O3" + ;; + g++-5.*) + PROD_CXXFLAGS="-O3 -fstdarg-opt" + ;; + *) + PROD_CXXFLAGS="-O -finline-functions" + ;; + esac + + # Debug + case "$cxx_vendor-$cxx_version" in + g++-5.*) + DEBUG_CXXFLAGS="-Og -g -ftrapv -fno-common" + ;; + *) + DEBUG_CXXFLAGS="-g" + ;; + esac + + # Profile + PROFILE_CXXFLAGS="-Og -g -pg" + + # Flags are set + cxx_flags_set=yes + ;; +esac + +# Version-specific g++ flags +# +# Please follow the pattern below by adding new versions at the top, copying +# the information from the previous version and adding modifications to that. +case "$cxx_vendor-$cxx_version" in + +# Closer to the g++ 5.2 release, we should check for additional flags to +# include and break it out into it's own section, like the other versions +# below. -QAK + g++-5*) + + # Append warning flags from gcc-3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + + # Append more extra warning flags that only gcc 4.9+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" + + # (There was no release of gcc 5.0) + + # Append more extra warning flags that only gcc 5.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Warray-bounds=2" + ;; + + g++-4.9*) + # Append warning flags + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc 3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc 3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + + # Append more extra warning flags that only gcc 4.9+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" + ;; + + g++-4.8*) + # Append warning flags + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + ;; + + g++-4.7*) + # Append warning flags + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + ;; + + g++-4.6*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + ;; + + g++-4.5*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" + ;; + + g++-4.4*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + ;; + + g++-4.3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wvla" + ;; + + g++-4.2*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + ;; + + g++-4.1.*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + ;; + + g++-4.0*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + ;; + + g++-3.4*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append more extra warning flags that only gcc3.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + ;; + + g++-3.3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append more extra warning flags that only gcc3.3+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + ;; + + g++-3.2*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append more extra warning flags that only gcc3.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + ;; + + g++-3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append some extra warning flags that only gcc3+ know about + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + ;; +esac + +# Clear cxx info if no flags set +if test "X$cxx_flags_set" = "X"; then + cxx_vendor= + cxx_version= +fi diff --git a/config/gnu-fflags b/config/gnu-fflags index 1d6caa1..3a90c10 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -78,14 +78,26 @@ if test "X-gfortran" = "X-$f9x_vendor"; then FSEARCH_DIRS="" H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wconversion -Wunderflow -Wimplicit-interface -W" + # Turn off warnings for passing non-ANSI types to BIND(). + # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. + H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + # Production - PROD_FCFLAGS="-O2 -s" + PROD_FCFLAGS="-s" # Debug - DEBUG_FCFLAGS="-g -fbounds-check" + DEBUG_FCFLAGS="-fbounds-check" + + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling + PROFILE_FCFLAGS="-pg" - # Profile - PROFILE_FCFLAGS="-g -pg" + # Optimization + HIGH_OPT_FCFLAGS="-O2" + DEBUG_OPT_FCFLAGS="-O0" + NO_OPT_FCFLAGS="-O0" # Flags are set f9x_flags_set=yes diff --git a/config/gnu-flags b/config/gnu-flags index e7f8f14..232bf05 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -97,39 +97,64 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS $arch -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline" # Production + # NDEBUG is handled explicitly by the configure script case "$cc_vendor-$cc_version" in gcc-[34].*) - PROD_CFLAGS="-O3" + PROD_CFLAGS= ;; gcc-5.*) - PROD_CFLAGS="-O3 -fstdarg-opt" + PROD_CFLAGS="-fstdarg-opt" ;; *) - PROD_CFLAGS="-O -finline-functions" + # gcc automatically inlines based on the optimization level + # this is just a failsafe + PROD_CFLAGS="-finline-functions" ;; esac - PROD_CPPFLAGS= # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags case "$cc_vendor-$cc_version" in gcc-5.*) - DEBUG_CFLAGS="-Og -g -ftrapv -fno-common" + DEBUG_CFLAGS="-ftrapv -fno-common" ;; *) - DEBUG_CFLAGS="-g" + DEBUG_CFLAGS= ;; esac - #DEBUG_CFLAGS="$DEBUG_CFLAGS -fsanitize=undefined" + #DEBUG_CFLAGS="-fsanitize=undefined" DEBUG_CPPFLAGS= - # Try out the new "stack protector" feature introduced in gcc 4.1 - # (We should also think about adding some of the other memory protection options) - #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= # Profile - PROFILE_CFLAGS="-Og -g -pg" + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + # Optimization (only CFLAGS at this time) + case "$cc_vendor-$cc_version" in + gcc-[34].*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS= + ;; + gcc-5.*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-Og" + ;; + *) + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS= + ;; + esac + NO_OPT_CFLAGS="-O0" + + # Try out the new "stack protector" feature introduced in gcc 4.1 + # (We should also think about adding some of the other memory protection options) + #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + # Flags are set cc_flags_set=yes ;; diff --git a/config/ibm-flags b/config/ibm-flags index 462372d..731968d 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -55,19 +55,38 @@ if test "XL" = "$cc_vendor"; then # Turn off shared lib option. It causes some test suite to fail. enable_shared="${enable_shared:-no}" + # Make sure this is applied to other API compile options such as C++. AM_CFLAGS="$AM_CFLAGS" + # -qflag=w:w makes the lowest level of reported compile issues to be "warning" # instead of "information". This suppresses a very large number of messages # concerning the portability of __inline__. H5_CFLAGS="-qlanglvl=stdc99 -qflag=w:w $H5_CFLAGS" - DEBUG_CFLAGS="-g -qfullpath" - DEBUG_CPPFLAGS= - # -O causes test/dtypes to fail badly. Turn it off for now. - PROD_CFLAGS="" + + # Produciton + PROD_CFLAGS= PROD_CPPFLAGS= - PROFILE_CFLAGS="-g -qfullpath -pg" + + # Debug + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS="-qfullpath" + DEBUG_CPPFLAGS= + + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + + # Optimization + # -O causes test/dtypes to fail badly. Turn it off for now. + HIGH_OPT_CFLAGS= + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + # Flags are set cc_flags_set=yes fi diff --git a/config/intel-fflags b/config/intel-fflags index 3e33fc9..1f7cf78 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -73,14 +73,22 @@ if test "X-ifort" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS" # Production - PROD_FCFLAGS="-O3" + PROD_FCFLAGS= # Debug - DEBUG_FCFLAGS="-g -check all" + DEBUG_FCFLAGS="-check all" - # Profile + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling # Use this for profiling with gprof - PROFILE_FCFLAGS="-g -p" + PROFILE_FCFLAGS="-p" + + # Optimization + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= # Flags are set f9x_flags_set=yes diff --git a/config/intel-flags b/config/intel-flags index 3187daf..a3238fa 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -68,21 +68,31 @@ if test "X-icc" = "X-$cc_vendor"; then # General # Default to C99 standard. - H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch}" + H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch} -Wcheck -Wall" # Production is set to default; see settings for specific version further down - PROD_CFLAGS="-O" + PROD_CFLAGS= PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-Wcheck -Wall -g -O0" + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS= DEBUG_CPPFLAGS= - # Profile + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling # Use this for profiling with gprof - PROFILE_CFLAGS="-g -p" + PROFILE_CFLAGS="-p" PROFILE_CPPFLAGS= + # Optimization + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS="-O0" + NO_OPT_CFLAGS="-O0" + # Flags are set cc_flags_set=yes diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 465bfed..46771dc 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -51,7 +51,7 @@ if test "X-" = "X-$FC"; then FC=gfortran FC_BASENAME=gfortran ;; - pgcc*) + pgcc*) FC=pgf90 FC_BASENAME=pgf90 ;; @@ -92,6 +92,9 @@ else esac fi +# Figure out GNU FC compiler flags +. $srcdir/config/gnu-fflags + # Figure out PGI FC compiler flags . $srcdir/config/pgi-fflags @@ -130,6 +133,9 @@ if test -z "$CXX"; then CXX_BASENAME=g++ fi +# Figure out GNU CXX compiler flags +. $srcdir/config/gnu-cxxflags + # compiler version strings # check if the compiler_version_info is already set @@ -177,6 +183,7 @@ case $FC in *mpif90*) fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ + sed ’s/\”/\\\”/g’ |\ sed 's/^\([a-z]* \)/ built with \1/1'` fc_version_info=`echo $fc_version_info` ;; diff --git a/config/pgi-fflags b/config/pgi-fflags index 8e574e4..fbcba52 100644 --- a/config/pgi-fflags +++ b/config/pgi-fflags @@ -87,12 +87,20 @@ if test "X-pgf90" = "X-$f9x_vendor"; then PROD_FCFLAGS="-fast -s -Mnoframe" # Debug - DEBUG_FCFLAGS="-g -Mbounds -Mchkptr -Mdclchk" + DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk" - # Profile - PROFILE_FCFLAGS="-g -Mprof=func,line" + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling + PROFILE_FCFLAGS="-Mprof=func,line" # Use this for profiling with gprof - #PROFILE_FCFLAGS="-g -pg" + #PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS= + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= # Flags are set f9x_flags_set=yes diff --git a/config/pgi-flags b/config/pgi-flags index 29e6f05..674f60e 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -72,13 +72,11 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Production case "$cc_vendor-$cc_version" in - # Tweak down compiler optimizations for v10.6, it has a bug pgcc-10.6*) - PROD_CFLAGS="-O1 -s" + PROD_CFLAGS="-s" ;; - # Tweak down compiler optimizations for v9.x pgcc-9.*) - PROD_CFLAGS="-O1 -s" + PROD_CFLAGS="-s" ;; *) PROD_CFLAGS="-fast -s" @@ -87,15 +85,37 @@ if test "X-pgcc" = "X-$cc_vendor"; then PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-g -Mbounds" + # NDEBUG is handled explicitly by the configure script + DEBUG_CFLAGS="-Mbounds" DEBUG_CPPFLAGS= - # Profile - PROFILE_CFLAGS="-g -Mprof=func,line" + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling + PROFILE_CFLAGS="-Mprof=func,line" # Use this for profiling with gprof - #PROFILE_CFLAGS="-g -pg" + #PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + # Optimization + case "$cc_vendor-$cc_version" in + # Tweak down compiler optimizations for v10.6, it has a bug + pgcc-10.6*) + HIGH_OPT_CFLAGS="-O1" + ;; + # Tweak down compiler optimizations for v9.x + pgcc-9.*) + HIGH_OPT_CFLAGS="-O1" + ;; + *) + HIGH_OPT_CFLAGS= + ;; + esac + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + # Flags are set cc_flags_set=yes diff --git a/configure.ac b/configure.ac index 75e9d63..de8a348 100644 --- a/configure.ac +++ b/configure.ac @@ -151,46 +151,64 @@ AC_MSG_CHECKING([shell variables initial values]) set >&AS_MESSAGE_LOG_FD AC_MSG_RESULT([done]) -## Define all symbol variables used for configure summary. -## EXTERNAL_FILTERS equals all external filters. Default none. -## MPE: whether MPE option is enabled. Default no. -## STATIC_EXEC: whether static-exec is enabled. Default no. -## HDF_FORTRAN: whether Fortran is enabled. Default no. -## FC: Fortran compiler. -## HDF_CXX: whether C++ is enabled. Default no. -## CXX: C++ compiler. -## HDF5_HL: whether high-level library is enabled. Default is yes. -## INSTRUMENT: whether INSTRUMENT is enabled. No default set here. -## CODESTACK: whether CODESTACK is enabled. Default no. -## HAVE_DMALLOC: whether system has dmalloc support. Default no. -## HAVE_FLOAT128: whether system has Quad-Precision Math Library. Default no. -## DIRECT_VFD: whether DIRECT_VFD is enabled. Default no. -## THREADSAFE: whether THREADSAFE is enabled. Default no. -## STATIC_SHARED: whether static and/or shared libraries are requested. -## enable_shared: whether shared lib is enabled. -## enable_static: whether static lib is enabled. -## UNAME_INFO: System information. +## ---------------------------------------------------------------------- +## Save system information for the library settings file. +## +AC_SUBST([UNAME_INFO]) +UNAME_INFO=`uname -a` + +## ---------------------------------------------------------------------- +## Determine build mode (debug, production, clean). +## This has to be done early since the build mode is referred to +## frequently. +## +AC_MSG_CHECKING([build mode]) +AC_ARG_ENABLE([build-mode], + [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)], + [Sets the build mode. Debug turns on symbols, API + tracing, asserts, and debug optimization, + as well as several other minor configure options + that aid in debugging. + Production turns high optimizations on. + Clean turns nothing on and disables optimization + (i.e.: a 'clean slate' configuration). + All these settings can be overridden by using + specific configure flags. + [default=debug] + ])], + [BUILD_MODE=$enableval]) -AC_SUBST([EXTERNAL_FILTERS]) -AC_SUBST([MPE]) MPE=no -AC_SUBST([STATIC_EXEC]) STATIC_EXEC=no -AC_SUBST([HDF_FORTRAN]) HDF_FORTRAN=no -AC_SUBST([FC]) HDF_FORTRAN=no -AC_SUBST([HDF_CXX]) HDF_CXX=no -AC_SUBST([CXX]) HDF_CXX=no -AC_SUBST([HDF5_HL]) HDF5_HL=yes -AC_SUBST([INSTRUMENT]) -AC_SUBST([CODESTACK]) CODESTACK=no -AC_SUBST([HAVE_DMALLOC]) HAVE_DMALLOC=no -AC_SUBST([DIRECT_VFD]) DIRECT_VFD=no -AC_SUBST([THREADSAFE]) THREADSAFE=no -AC_SUBST([STATIC_SHARED]) -AC_SUBST([enable_shared]) -AC_SUBST([enable_static]) -AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` -AC_SUBST([PAC_C_MAX_REAL_PRECISION]) -AC_SUBST([Fortran_COMPILER_ID]) -Fortran_COMPILER_ID=none +## Set the default +## Depends on branch, set via script at branch creation time +if test "X-$BUILD_MODE" = X- ; then + BUILD_MODE=debug +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([BUILD_MODE]) + +case "X-$BUILD_MODE" in + X-clean) + AC_MSG_RESULT([clean]) + ;; + X-debug) + H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-production) + H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" + AC_MSG_RESULT([production]) + ;; + *) + AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.]) +esac ## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check @@ -373,7 +391,9 @@ AC_CHECK_SIZEOF([float]) AC_CHECK_SIZEOF([double]) AC_CHECK_SIZEOF([long double]) +## ---------------------------------------------------------------------- ## Check for non-standard extenstion __FLOAT128 +## HAVE_FLOAT128=0 HAVE_QUADMATH=0 FLT128_DIG=0 @@ -384,6 +404,8 @@ AC_CHECK_SIZEOF([_Quad]) AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], []) PAC_FC_LDBL_DIG +AC_SUBST([PAC_C_MAX_REAL_PRECISION]) + if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) PAC_C_MAX_REAL_PRECISION=$FLT128_DIG @@ -392,9 +414,17 @@ else fi AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C]) AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION]) + ## ---------------------------------------------------------------------- ## Check if they would like the Fortran interface compiled ## + +## This needs to be exposed for the library info file even if Fortran is disabled. +AC_SUBST([HDF_FORTRAN]) + +## Default is no Fortran +HDF_FORTRAN=no + AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES="" AC_MSG_CHECKING([if Fortran interface enabled]) AC_ARG_ENABLE([fortran], @@ -417,7 +447,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_CONFIG_HEADERS([fortran/src/H5config_f.inc], [cat fortran/src/H5config_f.inc | sed '1d;s%^/\* \(.*\) \*/%\1%;s/#define /#define H5_/;s/#undef /#undef H5_/' >fortran/src/H5config_f.inc.tmp; mv -f fortran/src/H5config_f.inc.tmp fortran/src/H5config_f.inc]) - AC_SUBST([FC]) HDF_FORTRAN=yes + AC_SUBST([FC]) HDF5_INTERFACES="$HDF5_INTERFACES fortran" @@ -520,6 +550,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) AC_SUBST([H5CONFIG_F_NUM_IKIND]) AC_SUBST([H5CONFIG_F_IKIND]) + AC_SUBST([Fortran_COMPILER_ID]) + Fortran_COMPILER_ID=none AC_DEFINE_UNQUOTED([Fortran_COMPILER_ID], $Fortran_COMPILER_ID, [Define Fortran compiler ID]) ## Setting definition if there is a 16 byte fortran integer @@ -609,11 +641,17 @@ fi ## ---------------------------------------------------------------------- ## Check if they would like the C++ interface compiled ## +## This needs to be exposed for the library info file even if C++ is disabled. +AC_SUBST([HDF_CXX]) + +## Default is no C++ +HDF_CXX=no + ## We need to check for a C++ compiler unconditionally, since ## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will ## miss even if c++ is not enabled. - AC_PROG_CXX - AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done +AC_PROG_CXX +AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done AC_MSG_CHECKING([if c++ interface enabled]) @@ -626,19 +664,22 @@ if test "X$HDF_CXX" = "Xyes"; then echo "yes" HDF5_INTERFACES="$HDF5_INTERFACES c++" + ## Expose the compiler for *.in files + AC_SUBST([CXX]) + ## Change to the C++ language AC_LANG_PUSH(C++) - # Checking if C++ needs old style header files in includes + ## Checking if C++ needs old style header files in includes PAC_PROG_CXX_HEADERS - # Checking if C++ can handle namespaces + ## Checking if C++ can handle namespaces PAC_PROG_CXX_NAMESPACE - # Checking if C++ has offsetof extension + ## Checking if C++ has offsetof extension PAC_PROG_CXX_OFFSETOF - # if C++ can handle static cast + ## if C++ can handle static cast PAC_PROG_CXX_STATIC_CAST else @@ -654,23 +695,41 @@ AC_LANG_POP(C++) ## Check if they would like the High Level library compiled ## -AC_SUBST(HL) HL="" -## name of fortran folder inside "hl", if FORTRAN compile is requested -AC_SUBST(HL_FOR) HL_FOR="" -AC_MSG_CHECKING([if high level library is enabled]) +## This needs to be exposed for the library info file even if the HL +## library is disabled. +AC_SUBST([HDF5_HL]) + +## The high-level library is enabled unless the build mode is clean. +if test "X-$BUILD_MODE" = "X-clean" ; then + HDF5_HL=no +else + HDF5_HL=yes +fi + +## high-level library directories (set when needed, blank until then) +## +## main high-level library +AC_SUBST(HL) +HL="" +## Fortran high-level library +AC_SUBST(HL_FOR) +HL_FOR="" + +AC_MSG_CHECKING([if the high-level library is enabled]) AC_ARG_ENABLE([hl], [AS_HELP_STRING([--enable-hl], - [Enable the high level library [default=yes]])], - [HDF5_HL=$enableval], - [HDF5_HL=yes]) + [Enable the high-level library. + [default=yes (unless build mode = clean)] + ])], + [HDF5_HL=$enableval]) -if test "X$HDF5_HL" = "Xyes"; then - echo "yes" +if test "X-$HDF5_HL" = "X-yes"; then + AC_MSG_RESULT([yes]) HL="hl" AC_DEFINE([INCLUDE_HL], [1], - [Define if HDF5's high-level library headers should be included in hdf5.h]) + [Define if the high-level library headers should be included in hdf5.h]) else - echo "no" + AC_MSG_RESULT([no]) fi @@ -693,7 +752,8 @@ AC_PROG_INSTALL ## ---------------------------------------------------------------------- -## Set up ${TR} which is used to process DEBUG_PKG. +## Set up ${TR} which is used to process the package list for extra +## debugging output in the C library. AC_PATH_PROG([TR], [tr]) @@ -829,6 +889,11 @@ LT_INIT([dlopen,win32-dll]) ## This check needs to occur after libtool is initialized because ## we check a libtool cache value and may issue a warning based ## on its result. +AC_SUBST([STATIC_EXEC]) + +## Default is no +STATIC_EXEC=no + AC_MSG_CHECKING([if we should install only statically linked executables]) AC_ARG_ENABLE([static_exec], [AS_HELP_STRING([--enable-static-exec], @@ -840,8 +905,8 @@ if test "X$STATIC_EXEC" = "Xyes"; then echo "yes" ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then - echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." - LT_STATIC_EXEC="" + echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + LT_STATIC_EXEC="" else LT_STATIC_EXEC="-all-static" fi @@ -890,50 +955,6 @@ case "X-$RPATH" in esac ## ---------------------------------------------------------------------- -## Production flags? Save the value in $CONFIG_MODE so we have it for -## the record. -## -AC_MSG_CHECKING([for production mode]) -AC_ARG_ENABLE([production], - [AS_HELP_STRING([--enable-production], - [Determines how to run the compiler.])]) - -case "X-$enable_production" in - X-yes) - enable_production="yes" - AC_MSG_RESULT([production]) - CONFIG_MODE=production - H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" - ;; - X-|X-no) - enable_production="no" - AC_MSG_RESULT([development]) - CONFIG_MODE=development - H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" - ;; - X-pg|X-profile) - enable_production="profile" - AC_MSG_RESULT([profile]) - CONFIG_MODE=profile - H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROFILE_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS" - ;; - *) - enable_production="user-defined" - AC_MSG_RESULT([user-defined]) - CONFIG_MODE="$enableval" - ;; -esac - -## ---------------------------------------------------------------------- ## Check for system libraries. "dl" stands for dynamically loaded library ## AC_CHECK_LIB([m], [ceil]) @@ -1182,6 +1203,11 @@ AC_ARG_WITH([fnord], ## command-line switch. The value is an include path and/or a library path. ## If the library path is specified then it must be preceded by a comma. ## +AC_SUBST([HAVE_DMALLOC]) + +## Default is not present +HAVE_DMALLOC=no + AC_ARG_WITH([dmalloc], [AS_HELP_STRING([--with-dmalloc=DIR], [Use dmalloc memory debugging aid [default=no]])],, @@ -1246,6 +1272,14 @@ case $withval in esac ## ---------------------------------------------------------------------- +## Make the external filters list available to *.in files +## At this point it's unset (no external filters by default) but it +## will be filled in during the deflate (zlib) and szip processing +## below. +## +AC_SUBST([EXTERNAL_FILTERS]) + +## ---------------------------------------------------------------------- ## Is the GNU zlib present? It has a header file `zlib.h' and a library ## `-lz' and their locations might be specified with the `--with-zlib' ## command-line switch. The value is an include path and/or a library path. @@ -1335,7 +1369,7 @@ if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2" if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" fi @@ -1458,13 +1492,13 @@ if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" fi if test ${hdf5_cv_szlib_can_encode} = "no"; then if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" fi fi @@ -1477,6 +1511,11 @@ AC_CACHE_SAVE ## Enable thread-safe version of library. It requires Pthreads support ## on POSIX systems. ## +AC_SUBST([THREADSAFE]) + +## Default is no thread-safety +THREADSAFE=no + AC_MSG_CHECKING([for thread safe support]) AC_ARG_ENABLE([threadsafe], [AS_HELP_STRING([--enable-threadsafe], @@ -1484,7 +1523,7 @@ AC_ARG_ENABLE([threadsafe], [default=no]])], [THREADSAFE=$enableval]) -## NOTE: The high-level, C++, and Fortran interfaces are not compatible +## The high-level, C++, and Fortran interfaces are not compatible ## with the thread-safety option because the lock is not hoisted ## into the higher-level API calls. @@ -1837,56 +1876,277 @@ AC_MSG_RESULT([%${hdf5_cv_printf_ll}d and %${hdf5_cv_printf_ll}u]) AC_DEFINE_UNQUOTED([PRINTF_LL_WIDTH], ["$hdf5_cv_printf_ll"], [Width for printf() for type `long long' or `__int64', use `ll']) - ## ---------------------------------------------------------------------- -## Turn on debugging by setting compiler flags -## This must come after the enable-production since it depends on production. +## Deprecate old ways of determining debug/production build +## These can probably be removed in the future (1.10.1?) ## -AC_MSG_CHECKING([for debug flags]) AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug=all], - [Turn on debugging in all packages. One may - also specify a comma-separated list of - package names without the leading H5 or - the word no. The default is most packages - if production is disabled; no if it is enabled. + [AS_HELP_STRING([--enable-debug], + [DEPRECATED: use --enable-build-mode=debug])], + [DEPRECATED_DEBUG=$enableval]) + +if test "X-$DEPRECATED_DEBUG" != "X-" ; then + AC_MSG_ERROR([--enable-debug is deprecated, use --enable-build-mode=debug instead.]) +fi + +AC_ARG_ENABLE([production], + [AS_HELP_STRING([--enable-production], + [DEPRECATED: use --enable-build-mode=production])], + [DEPRECATED_PRODUCTION=$enableval]) + +if test "X-$DEPRECATED_PRODUCTION" != "X-" ; then + AC_MSG_ERROR([--enable-production is deprecated, use --enable-build-mode=production instead.]) +fi + + +## ---------------------------------------------------------------------- +## Check if the compiler should include symbols +## +AC_MSG_CHECKING([enable debugging symbols]) +AC_ARG_ENABLE([symbols], + [AS_HELP_STRING([--enable-symbols=(yes|no|)], + [Add debug symbols to the library (e.g.: build with -g). + This is independent of the build mode and optimization + level. The custom string allows special settings like + -ggdb, etc. to be used. + [default=yes if debug build, otherwise no] ])], - [DEBUG_PKG=$enableval]) + [SYMBOLS=$enableval]) -## Default to no if producton is enabled -if test "X-$DEBUG_PKG" = X- ; then - if test "$enable_production" = yes ; then - DEBUG_PKG=no - else - DEBUG_PKG=yes - fi +## Set default +if test "X-$SYMBOLS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + SYMBOLS=yes + else + SYMBOLS=no + fi fi -AC_SUBST([DEBUG_PKG]) -all_packages="ac,b,b2,d,e,f,g,hg,hl,i,mf,mm,o,p,s,t,v,z" -case "X-$DEBUG_PKG" in +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([SYMBOLS]) + +case "X-$SYMBOLS" in X-yes) - DEBUG_PKG="d,e,f,g,hg,i,mm,o,p,s,t,v,z" -## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" - AC_MSG_RESULT([default ($DEBUG_PKG)]) + H5_CFLAGS="$H5_CFLAGS $SYMBOLS_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS_FCFLAGS" + AC_MSG_RESULT([yes]) ;; - X-all) - DEBUG_PKG=$all_packages -## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" - AC_MSG_RESULT([all ($DEBUG_PKG)]) + X-no) + AC_MSG_RESULT([no]) ;; - X-no|X-none) + *) + H5_CFLAGS="$H5_CFLAGS $SYMBOLS" + H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS" + H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS" + SYMBOLS="custom ($SYMBOLS)" + AC_MSG_RESULT([$SYMBOLS]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the assert macro should be enabled +## +AC_MSG_CHECKING([enable asserts]) +AC_ARG_ENABLE([asserts], + [AS_HELP_STRING([--enable-asserts], + [Determines whether NDEBUG is defined or not, which + controls assertions. + This is independent of the build mode and presence + of debugging symbols. + [default=yes if debug build, otherwise no] + ])], + [ASSERTS=$enableval]) + +## Set default +if test "X-$ASSERTS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + ASSERTS=yes + else + ASSERTS=no + fi +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([ASSERTS]) + +case "X-$ASSERTS" in + X-yes) + H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" + AC_MSG_RESULT([yes]) + ;; + X-no) + H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG" + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $ASSERTS]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the compiler should use profiling flags/settings +## +AC_MSG_CHECKING([profiling]) +AC_ARG_ENABLE([profiling], + [AS_HELP_STRING([--enable-profiling=(yes|no|)], + [Enable profiling flags (e.g.: -pg). + This can be set independently from the build mode. + The custom setting can be used to pass alternative + profiling flags (e.g.: -P for using Prof with gcc). + [default=no] + ])], + [PROFILING=$enableval]) + +## Default is no profiling +if test "X-$PROFILING" = X- ; then + PROFILING=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([PROFILING]) + +case "X-$PROFILING" in + X-yes) + H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS" + AC_MSG_RESULT([yes]) + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + H5_CFLAGS="$H5_CFLAGS $PROFILING" + H5_CXXFLAGS="$H5_CXXFLAGS $PROFILING" + H5_FCFLAGS="$H5_FCFLAGS $PROFILING" + PROFILING="custom ($PROFILING)" + AC_MSG_RESULT([$PROFILING]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the compiler should use a particular optimization setting +## +AC_MSG_CHECKING([optimization level]) +AC_ARG_ENABLE([optimization], + [AS_HELP_STRING([--enable-optimization=(high|debug|none|)], + [Enable optimization flags/settings (e.g.: -O3). + This can be set independently from the build mode. + Optimizations for a given compiler can be specified + at several levels: High, with aggressive optimizations + turned on; debug, with optimizations that are + unlikely to interfere with debugging or profiling; + and none, with no optimizations at all. + See the compiler-specific config/*-flags file for more + details. + Alternatively, optimization options can + be specified directly by specifying them as a + string value. These custom optimzation flags will + completely replace all other optimization flags. + [default depends on build mode: debug=debug, + production=high, clean=none] + ])], + [OPTIMIZATION=$enableval]) + +## Set the default optimization level. This depends on the compiler mode. +if test "X-$OPTIMIZATION" = X- ; then + case "X-$BUILD_MODE" in + X-debug) + OPTIMIZATION=debug + ;; + X-production) + OPTIMIZATION=high + ;; + X-clean) + OPTIMIZATION=none + ;; + esac +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([OPTIMIZATION]) + +case "X-$OPTIMIZATION" in + X-high) + H5_CFLAGS="$H5_CFLAGS $HIGH_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $HIGH_OPT_FCFLAGS" + AC_MSG_RESULT([high]) + ;; + X-debug) + H5_CFLAGS="$H5_CFLAGS $DEBUG_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_OPT_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-none) + H5_CFLAGS="$H5_CFLAGS $NO_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $NO_OPT_FCFLAGS" AC_MSG_RESULT([none]) - DEBUG_PKG= -## H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG" ;; *) - AC_MSG_RESULT([$DEBUG_PKG]) + H5_CFLAGS="$H5_CFLAGS $OPTIMIZATION" + H5_FCFLAGS="$H5_FCFLAGS $OPTIMIZATION" + OPTIMIZATION="custom ($OPTIMIZATION)" + AC_MSG_RESULT([$OPTIMIZATION]) + ;; +esac + +## ---------------------------------------------------------------------- +## Enable/disable internal package-level debugging output +## +AC_MSG_CHECKING([for internal debug output]) +AC_ARG_ENABLE([internal-debug], + [AS_HELP_STRING([--enable-internal-debug=(yes|all|no|none|)], + [Enable extra debugging output on HDF5 library + errors. One may also specify a comma-separated + list of package names without the leading H5. + This is independent of the build mode + and is mainly of interest to HDF Group developers. + Yes/all and no/none are synonymous. + [default=all if debug build, otherwise none] + ])], + [INTERNAL_DEBUG_OUTPUT=$enableval]) + +## Set default +if test "X-$INTERNAL_DEBUG_OUTPUT" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + INTERNAL_DEBUG_OUTPUT=all + else + INTERNAL_DEBUG_OUTPUT=none + fi +fi + +AC_SUBST([INTERNAL_DEBUG_OUTPUT]) + +## These are all the packages that use H5*_DEBUG. +## There is no harm in specifying a package not in this list; +## you'll just get an unused H5_DEBUG symbol. +## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +all_packages="AC,B,B2,D,F,HL,I,O,S,ST,T,Z" + +case "X-$INTERNAL_DEBUG_OUTPUT" in + X-yes|X-all) + INTERNAL_DEBUG_OUTPUT=$all_packages + DEBUG_PKG_LIST=$all_packages + ;; + X-no|X-none) + INTERNAL_DEBUG_OUTPUT=none + DEBUG_PKG_LIST= + ;; + *) + DEBUG_PKG_LIST=$INTERNAL_DEBUG_OUTPUT ;; esac +AC_MSG_RESULT([$INTERNAL_DEBUG_OUTPUT]) -if test -n "$DEBUG_PKG"; then - for pkg in `echo $DEBUG_PKG | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do +## Define H5*_DEBUG symbols that control package output +## NOTE: No sanity checking done here! +if test -n "$DEBUG_PKG_LIST"; then + for pkg in `echo $DEBUG_PKG_LIST | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do H5_CPPFLAGS="$H5_CPPFLAGS -DH5${pkg}_DEBUG" done fi @@ -1897,20 +2157,32 @@ fi AC_MSG_CHECKING([whether function stack tracking is enabled]) AC_ARG_ENABLE([codestack], [AS_HELP_STRING([--enable-codestack], - [Enable the function stack tracing (for developer debugging).])], + [Enable the function stack tracing (for developer debugging). + [default=no] + ])], [CODESTACK=$enableval]) +## Set the default level. +if test "X-$CODESTACK" = X- ; then + CODESTACK=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([CODESTACK]) + case "X-$CODESTACK" in X-yes) - CODESTACK=yes AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_CODESTACK], [1], [Define if the function stack tracing code is to be compiled in]) ;; - *) - CODESTACK=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $CODESTACK]) + ;; esac ## ---------------------------------------------------------------------- @@ -1919,113 +2191,69 @@ esac AC_MSG_CHECKING([whether metadata trace file code is enabled]) AC_ARG_ENABLE([metadata-trace-file], [AS_HELP_STRING([--enable-metadata-trace-file], - [Enable metadata trace file collection.])], + [Enable metadata trace file collection. + [default=no] + ])], [METADATATRACEFILE=$enableval]) +## Set the default level. +if test "X-$METADATATRACEFILE" = X- ; then + METADATATRACEFILE=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([METADATATRACEFILE]) + case "X-$METADATATRACEFILE" in X-yes) - METADATATRACEFILE=yes AC_MSG_RESULT([yes]) AC_DEFINE([METADATA_TRACE_FILE], [1], [Define if the metadata trace file code is to be compiled in]) ;; - *) - METADATATRACEFILE=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $METADATATRACEFILE]) + ;; esac ## ---------------------------------------------------------------------- ## Enable tracing of the API -## This must come after the enable-debug since it depends on debug. ## -AC_SUBST([TRACE_API]) AC_MSG_CHECKING([for API tracing]); AC_ARG_ENABLE([trace], [AS_HELP_STRING([--enable-trace], - [Enable API tracing capability. Default=no - if debug is disabled.])], - [TRACE=$enableval]) - -## Default to no if debug is disabled -if test "X-$TRACE" = X- ; then - if test -z "$DEBUG_PKG" ; then - TRACE=no - else - TRACE=yes - fi -fi + [Enable HDF5 API tracing capability. + [default=yes if debug build, otherwise no] + ])], + [TRACE_API=$enableval]) -case "X-$TRACE" in - X-yes) - AC_MSG_RESULT([yes]) +## Set the default level. +if test "X-$TRACE_API" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then TRACE_API=yes - H5_CPPFLAGS="$H5_CPPFLAGS -DH5_DEBUG_API" - ;; - X-no|*) - AC_MSG_RESULT([no]) - TRACE_API=no - H5_CPPFLAGS="$H5_CPPFLAGS -UH5_DEBUG_API" - ;; -esac - -## ---------------------------------------------------------------------- -## Enable instrumenting of the library's internal operations -## This must come after the enable-debug since it depends on debug. -## -AC_SUBST([INSTRUMENT_LIBRARY]) -AC_MSG_CHECKING([for instrumented library]); -AC_ARG_ENABLE([instrument], - [AS_HELP_STRING([--enable-instrument], - [Enable library instrumentation of optimization - tracing. Default=no if debug is disabled.])], - [INSTRUMENT=$enableval]) - -## Default to no if debug is disabled -if test "X-$INSTRUMENT" = X- ; then - if test -z "$DEBUG_PKG" ; then - INSTRUMENT=no else - INSTRUMENT=yes + TRACE_API=no fi fi -case "X-$INSTRUMENT" in +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([TRACE_API]) + +case "X-$TRACE_API" in X-yes) AC_MSG_RESULT([yes]) - INSTRUMENT_LIBRARY=yes - AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1], - [Define if library will contain instrumentation to detect correct optimization operation]) + H5_CPPFLAGS="$H5_CPPFLAGS -DH5_DEBUG_API" ;; - X-no|*) + X-no) AC_MSG_RESULT([no]) - INSTRUMENT_LIBRARY=no + H5_CPPFLAGS="$H5_CPPFLAGS -UH5_DEBUG_API" ;; -esac - -## ---------------------------------------------------------------------- -## Check if they would like to securely clear file buffers before they are -## written. -## -AC_SUBST([CLEARFILEBUF]) -AC_MSG_CHECKING([whether to clear file buffers]) -AC_ARG_ENABLE([clear-file-buffers], - [AS_HELP_STRING([--enable-clear-file-buffers], - [Securely clear file buffers before writing - to file. Default=yes.])], - [CLEARFILEBUF=$enableval]) - -case "X-$CLEARFILEBUF" in *) - CLEARFILEBUF=yes - AC_MSG_RESULT([yes]) - AC_DEFINE([CLEAR_MEMORY], [1], - [Define if the memory buffers being written to disk should be - cleared before writing.]) - ;; - X-no) - CLEARFILEBUF=no - AC_MSG_RESULT([no]) + AC_MSG_ERROR([Unrecognized value: $TRACE_API]) ;; esac @@ -2035,40 +2263,49 @@ esac ## more scrupulous with it's memory operations. Enabling this also ## disables the library's free space manager code. ## -AC_SUBST([USINGMEMCHECKER]) AC_MSG_CHECKING([whether a memory checking tool will be used]) AC_ARG_ENABLE([using-memchecker], [AS_HELP_STRING([--enable-using-memchecker], [Enable this option if a memory allocation and/or bounds checking tool will be used on the HDF5 library. Enabling this causes the library to be - more picky about it's memory operations and also + more picky about its memory operations and also disables the library's free space manager code. This option is orthogonal to the --enable-memory-alloc-sanity-check option. - Default=no.])], + [default=no] + ])], [USINGMEMCHECKER=$enableval]) +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([USINGMEMCHECKER]) + +## Set the default level. +if test "X-$USINGMEMCHECKER" = X- ; then + USINGMEMCHECKER=no +fi + case "X-$USINGMEMCHECKER" in X-yes) - USINGMEMCHECKER=yes - AC_MSG_RESULT([yes]) AC_DEFINE([USING_MEMCHECKER], [1], [Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code.]) + AC_MSG_RESULT([yes]) ;; - *) - USINGMEMCHECKER=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $USINGMEMCHECKER]) + ;; esac ## ---------------------------------------------------------------------- ## Check if they would like to enable the internal memory allocation sanity ## checking code. ## -AC_SUBST([MEMORYALLOCSANITYCHECK]) AC_MSG_CHECKING([whether internal memory allocation sanity checking is used]) AC_ARG_ENABLE([memory-alloc-sanity-check], [AS_HELP_STRING([--enable-memory-alloc-sanity-check], @@ -2077,20 +2314,35 @@ AC_ARG_ENABLE([memory-alloc-sanity-check], more memory use and somewhat slower allocation. This option is orthogonal to the --enable-using-memchecker option. - Default=no.])], + [default=yes if debug build, otherwise no] + ])], [MEMORYALLOCSANITYCHECK=$enableval]) +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([MEMORYALLOCSANITYCHECK]) + +## Set default +if test "X-$MEMORYALLOCSANITYCHECK" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + MEMORYALLOCSANITYCHECK=yes + else + MEMORYALLOCSANITYCHECK=no + fi +fi + case "X-$MEMORYALLOCSANITYCHECK" in X-yes) - MEMORYALLOCSANITYCHECK=yes - AC_MSG_RESULT([yes]) AC_DEFINE([MEMORY_ALLOC_SANITY_CHECK], [1], [Define to enable internal memory allocation sanity checking.]) + AC_MSG_RESULT([yes]) ;; - *) - MEMORYALLOCSANITYCHECK=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $MEMORYALLOCSANITYCHECK]) + ;; esac ## Checkpoint the cache @@ -2161,8 +2413,12 @@ esac ## ---------------------------------------------------------------------- ## Print some other parallel information and do some sanity checks. +## Needs to be done outside of the PARALLEL block since the serial +## build also needs to have values defined. ## AC_SUBST([ADD_PARALLEL_FILES]) ADD_PARALLEL_FILES="no" +AC_SUBST([MPE]) MPE=no +AC_SUBST([INSTRUMENT_LIBRARY]) INSTRUMENT_LIBRARY=no if test -n "$PARALLEL"; then ## The 'testpar' directory should participate in the build @@ -2217,6 +2473,45 @@ if test -n "$PARALLEL"; then ) fi + ## ---------------------------------------------------------------------- + ## Enable instrumenting of the library's internal operations + ## in parallel builds. + ## + + ## Set default + if test "X-$BUILD_MODE" = "X-debug" ; then + INSTRUMENT_LIBRARY=yes + else + INSTRUMENT_LIBRARY=no + fi + + AC_MSG_CHECKING([for instrumented library]); + AC_ARG_ENABLE([instrument], + [AS_HELP_STRING([--enable-instrument], + [Enable library instrumentation of optimization + tracing (only used with parallel builds). + [default=yes if a parallel debug build, otherwise no] + ])], + [INSTRUMENT_LIBRARY=$enableval]) + + ## Allow this variable to be substituted in + ## other files (src/libhdf5.settings.in, etc.) + AC_SUBST([INSTRUMENT_LIBRARY]) + + case "X-$INSTRUMENT_LIBRARY" in + X-yes) + AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1], + [Define if parallel library will contain instrumentation to detect correct optimization operation]) + AC_MSG_RESULT([yes]) + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $INSTRUMENT_LIBRARY]) + ;; + esac + ## -------------------------------------------------------------------- ## Do we want MPE instrumentation feature on? ## @@ -2284,6 +2579,11 @@ fi ## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## +AC_SUBST([DIRECT_VFD]) + +## Default is no direct VFD +DIRECT_VFD=no + AC_CACHE_VAL([hdf5_cv_direct_io], AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include ]])) AC_CACHE_VAL([hdf5_cv_posix_memalign], @@ -2316,6 +2616,7 @@ else AC_MSG_RESULT([no]) fi +## Direct VFD files are not built if not required. AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"]) ## ---------------------------------------------------------------------- @@ -2710,7 +3011,7 @@ if test -n "$ORGANIZATION"; then CONFIG_USER="$CONFIG_USER at $ORGANIZATION" fi -## Configuration mode (production, development, profile, etc) saved above. +## Configuration mode (production, debug, etc.) saved above. AC_SUBST([CONFIG_MODE]) ## Byte sex from the AC_C_BIGENDIAN macro. @@ -2826,13 +3127,22 @@ AM_CONDITIONAL([BUILD_ALL_CONDITIONAL], [test "X$BUILD_ALL" = "Xyes"]) ## ---------------------------------------------------------------------- ## Enable deprecated public API symbols ## + +## Enabled unless the build mode is clean. +if test "X-$BUILD_MODE" = "X-clean" ; then + DEPREC_SYMBOLS=no +else + DEPREC_SYMBOLS=yes +fi + AC_SUBST([DEPRECATED_SYMBOLS]) AC_MSG_CHECKING([if deprecated public symbols are available]); AC_ARG_ENABLE([deprecated-symbols], [AS_HELP_STRING([--enable-deprecated-symbols], - [Enable deprecated public API symbols [default=yes]])], - [DEPREC_SYMBOLS=$enableval], - [DEPREC_SYMBOLS=yes]) + [Enable deprecated public API symbols. + [default=yes (unless build mode = clean)] + ])], + [DEPREC_SYMBOLS=$enableval]) case "X-$DEPREC_SYMBOLS" in X-yes) @@ -2891,29 +3201,31 @@ AC_SUBST([STRICT_FORMAT_CHECKS]) AC_MSG_CHECKING([whether to perform strict file format checks]); AC_ARG_ENABLE([strict-format-checks], [AS_HELP_STRING([--enable-strict-format-checks], - [Enable strict file format checks, default=yes if - debug flag is enabled, no otherwise])], - [STRICT_CHECKS=$enableval]) - -## Default to yes if debug is enabled -if test "X-$STRICT_CHECKS" = X- ; then - if test -z "$DEBUG_PKG" ; then - STRICT_CHECKS=no + [Enable strict file format checks. + [default=yes if debug build, otherwise no] + ])], + [STRICT_FORMAT_CHECKS=$enableval]) + +## Set the default level. This depends on the compiler mode. +if test "X-$STRICT_FORMAT_CHECKS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + STRICT_FORMAT_CHECKS=yes else - STRICT_CHECKS=yes + STRICT_FORMAT_CHECKS=no fi fi -case "X-$STRICT_CHECKS" in +case "X-$STRICT_FORMAT_CHECKS" in X-yes) AC_MSG_RESULT([yes]) - STRICT_FORMAT_CHECKS=yes AC_DEFINE([STRICT_FORMAT_CHECKS], [1], [Define if strict file format checks are enabled]) ;; - X-no|*) + X-no) AC_MSG_RESULT([no]) - STRICT_FORMAT_CHECKS=no + ;; + *) + AC_MSG_ERROR([Unrecognized value: $STRICT_FORMAT_CHECKS]) ;; esac @@ -3065,6 +3377,11 @@ else enable_static=no fi +## Expose things for *.in markup +AC_SUBST([STATIC_SHARED]) +AC_SUBST([enable_shared]) +AC_SUBST([enable_static]) + if test "X$enable_static" = "Xyes" && test "X$enable_shared" = "Xyes"; then STATIC_SHARED="static, shared" elif test "X$enable_static" = "Xyes"; then diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index aeb3314..fd4226c 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -1232,7 +1232,7 @@ CONTAINS ENDIF ! Case of optional parameters. ! - ! Find the rank of the dataspace to allocate memery for + ! Find the rank of the dataspace to allocate memory for ! default stride and block arrays. ! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr) @@ -1378,7 +1378,7 @@ CONTAINS ! endif ! Case of optional parameters. ! - ! Find the rank of the dataspace to allocate memery for + ! Find the rank of the dataspace to allocate memory for ! default stride and block arrays. ! ! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr) diff --git a/hl/tools/gif2h5/h52giftest.sh.in b/hl/tools/gif2h5/h52giftest.sh.in index 7aec219..90931f2 100644 --- a/hl/tools/gif2h5/h52giftest.sh.in +++ b/hl/tools/gif2h5/h52giftest.sh.in @@ -77,7 +77,7 @@ TOOLTEST ./h52gif $TESTFILE1 image1.gif -i image echo "" # Negative tests. -echo "**verify the the h52gif tool handle error conditions correctly..." +echo "**verify that the h52gif tool handles error conditions correctly..." # nonexisting dataset name TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image" TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0fbd32b..ca71fca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -868,11 +868,11 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF) +option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS - "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5B_DEBUG;H5AC_DEBUG" ) endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) diff --git a/src/H5.c b/src/H5.c index a522398..4de5731 100644 --- a/src/H5.c +++ b/src/H5.c @@ -552,30 +552,29 @@ done: /*------------------------------------------------------------------------- - * Function: H5_debug_mask + * Function: H5_debug_mask * - * Purpose: Set runtime debugging flags according to the string S. The - * string should contain file numbers and package names - * separated by other characters. A file number applies to all - * following package names up to the next file number. The - * initial file number is `2' (the standard error stream). Each - * package name can be preceded by a `+' or `-' to add or remove - * the package from the debugging list (`+' is the default). The - * special name `all' means all packages. + * Purpose: Set runtime debugging flags according to the string S. The + * string should contain file numbers and package names + * separated by other characters. A file number applies to all + * following package names up to the next file number. The + * initial file number is `2' (the standard error stream). Each + * package name can be preceded by a `+' or `-' to add or remove + * the package from the debugging list (`+' is the default). The + * special name `all' means all packages. * - * The name `trace' indicates that API tracing is to be turned - * on or off. + * The name `trace' indicates that API tracing is to be turned + * on or off. * - * Return: void + * The name 'ttop' indicates that only top-level API calls + * should be shown. This also turns on tracing as if the + * 'trace' word was shown. * - * Programmer: Robb Matzke + * Return: void + * + * Programmer: Robb Matzke * Wednesday, August 19, 1998 * - * Modifications: - * Robb Matzke, 2002-08-08 - * Accepts the `ttop' word. If enabled then show only the - * top level API calls, otherwise show all API calls. Also - * turns on tracing as if the `trace' word was present. *------------------------------------------------------------------------- */ static void @@ -587,55 +586,57 @@ H5_debug_mask(const char *s) hbool_t clear; while (s && *s) { - if (HDisalpha(*s) || '-'==*s || '+'==*s) { - /* Enable or Disable debugging? */ - if ('-'==*s) { - clear = TRUE; - s++; - } else if ('+'==*s) { - clear = FALSE; - s++; - } else { - clear = FALSE; - } - - /* Get the name */ - for (i=0; HDisalpha(*s); i++, s++) - if (i=(size_t)H5_NPKGS) - fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); - } - - } else if (HDisdigit(*s)) { - int fd = (int)HDstrtol(s, &rest, 0); - H5_debug_open_stream_t *open_stream; - - if((stream = HDfdopen(fd, "w")) != NULL) { - (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0); - - if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { + } else if (!HDstrcmp(pkg_name, "all")) { + for (i=0; i<(size_t)H5_NPKGS; i++) + H5_debug_g.pkg[i].stream = clear ? NULL : stream; + } else { + for (i=0; i<(size_t)H5_NPKGS; i++) { + if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) { + H5_debug_g.pkg[i].stream = clear ? NULL : stream; + break; + } /* end if */ + } /* end for */ + if (i>=(size_t)H5_NPKGS) + fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); + } /* end if-else */ + + } else if (HDisdigit(*s)) { + int fd = (int)HDstrtol(s, &rest, 0); + H5_debug_open_stream_t *open_stream; + + if((stream = HDfdopen(fd, "w")) != NULL) { + (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0); + + if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { (void)HDfclose(stream); return; } /* end if */ @@ -644,11 +645,15 @@ H5_debug_mask(const char *s) open_stream->next = H5_debug_g.open_stream; H5_debug_g.open_stream = open_stream; } /* end if */ - s = rest; - } else { - s++; - } - } + + s = rest; + } else { + s++; + } /* end if-else */ + } /* end while */ + + return; + } /* end H5_debug_mask() */ #ifdef H5_HAVE_PARALLEL diff --git a/src/H5B.c b/src/H5B.c index 3b34c4d..9182d25 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -1734,14 +1734,13 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ HDassert(shared->sizeof_rnode); - /* Allocate shared buffers */ + /* Allocate and clear shared buffers */ if(NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") -#ifdef H5_CLEAR_MEMORY -HDmemset(shared->page, 0, shared->sizeof_rnode); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") + HDmemset(shared->page, 0, shared->sizeof_rnode); + if(NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1)))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") /* Initialize the offsets into the native key buffer */ for(u = 0; u < (shared->two_k + 1); u++) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 2c40761..928a7ee 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -890,10 +890,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of internal node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1300,10 +1298,8 @@ H5B2__cache_leaf_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED l /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of leaf node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 0676f30..578eeb9 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -153,9 +153,7 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, /* Allocate "page" for node I/O */ if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(hdr->page, 0, hdr->node_size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(hdr->page, 0, hdr->node_size); /* Allocate array of node info structs */ if(NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1)))) diff --git a/src/H5B2int.c b/src/H5B2int.c index a9c9ecc..aefb189 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2962,17 +2962,15 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent, H5B2_node_ptr_t /* Increment ref. count on B-tree header */ if(H5B2__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") /* Share B-tree header information */ leaf->hdr = hdr; /* Allocate space for the native keys in memory */ if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") + HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); /* Set number of records */ leaf->nrec = 0; @@ -2986,15 +2984,15 @@ HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec) /* Allocate space on disk for the leaf */ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") /* Cache the new B-tree node */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") done: if(ret_value < 0) { - if(leaf) + if(leaf) if(H5B2__leaf_free(leaf) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node") } /* end if */ @@ -3092,16 +3090,12 @@ H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent, /* Allocate space for the native keys in memory */ if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); /* Allocate space for the node pointers in memory */ if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); /* Set number of records & depth of the node */ internal->nrec = 0; diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 73136b4..2036257 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -353,10 +353,8 @@ H5B__serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 6276af1..dfa18fb 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1027,10 +1027,9 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -if(dset_contig->sieve_size > len) - HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); -#endif /* H5_CLEAR_MEMORY */ + /* Clear memory */ + if(dset_contig->sieve_size > len) + HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc = addr; diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f4aa240..778baa0 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -1295,9 +1295,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof) } /* end else */ -#ifdef H5_CLEAR_MEMORY HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; file->eof = new_eof; @@ -1469,10 +1467,8 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ -#ifdef H5_CLEAR_MEMORY if(file->eof < new_eof) HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; /* Update backing store, if using it and if closing */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index d8cd614..ef7c827 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -164,9 +164,9 @@ H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY - HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); } /* end if */ /* Read the part before the metadata accumulator */ @@ -395,9 +395,9 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, const H5F_io_info_t *fio_info, /* Update accumulator info */ accum->buf = new_buf; accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); } /* end if */ } /* end if */ @@ -628,9 +628,9 @@ H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Copy the new metadata to the buffer */ @@ -661,6 +661,7 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Check if we need to resize the buffer */ if(size > accum->alloc_size) { size_t new_size; /* New size of accumulator */ + size_t clear_size; /* Size of memory that needs clearing */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); @@ -671,12 +672,10 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -{ -size_t clear_size = MAX(accum->size, size); -HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); -} -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + clear_size = MAX(accum->size, size); + HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); } /* end if */ else { /* Check if we should shrink the accumulator buffer */ @@ -721,9 +720,9 @@ HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Update the metadata accumulator information */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index a4f9530..ed1c4a3 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -328,10 +328,8 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, if(H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") -#ifdef H5_CLEAR_MEMORY /* Clear rest of symbol table node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 1ab5522..2ef99fd 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -37,13 +37,6 @@ #include "H5RSprivate.h" /* Reference-counted strings */ /* - * Define this to enable debugging. - */ -#ifdef NDEBUG -# undef H5G_DEBUG -#endif - -/* * The disk size for a symbol table entry... */ #define H5G_SIZEOF_SCRATCH 16 diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 73db840..1272ab0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -146,9 +146,7 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo /* XXX: Change to using free-list factories */ if((dblock->blk = H5FL_BLK_MALLOC(direct_block, dblock->size)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(dblock->blk, 0, dblock->size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(dblock->blk, 0, dblock->size); dblock->write_buf = NULL; dblock->write_size = 0; diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index bdfe30d..711ceb9 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -177,10 +177,9 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8)); *id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2; } /* end else */ + HDmemcpy(id, obj, obj_size); -#ifdef H5_CLEAR_MEMORY -HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); /* Update statistics about heap */ hdr->tiny_size += obj_size; diff --git a/src/H5HG.c b/src/H5HG.c index 41c5007..f95b607 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -154,22 +154,20 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size) /* Create it */ H5_CHECK_OVERFLOW(size, size_t, hsize_t); if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") heap->addr = addr; heap->size = size; heap->shared = H5F_SHARED(f); if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(heap->chunk, 0, size); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HDmemset(heap->chunk, 0, size); heap->nalloc = H5HG_NOBJS(f, size); heap->nused = 1; /* account for index 0, which is used for the free object */ if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") /* Initialize the header */ HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -452,9 +450,7 @@ H5HG_extend(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t need) /* Re-allocate the heap information in memory */ if(NULL == (new_chunk = H5FL_BLK_REALLOC(gheap_chunk, heap->chunk, (heap->size + need)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(new_chunk + heap->size, 0, need); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(new_chunk + heap->size, 0, need); /* Adjust the size of the heap */ old_size = heap->size; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 678da7f..d0dde89 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -630,10 +630,8 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of local heap */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index bb07f4e..22ed308 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -21,8 +21,6 @@ * * Purpose: Private header file for file memory management. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MFprivate_H @@ -36,13 +34,6 @@ /* Library Private Macros */ /**************************/ -/* - * Feature: Define H5MF_DEBUG on the compiler command line if you want to - * see diagnostics from this layer. - */ -#ifdef NDEBUG -# undef H5MF_DEBUG -#endif /****************************/ /* Library Private Typedefs */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 03a4668..44872ba 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2517,8 +2517,8 @@ done: * * If the length of the filename, which determines the * required value of size, is unknown, a preliminary call to - * H5Pget_virtual_filename with the last two parameters set - * to NULL can be made. The return value of this call will + * H5Pget_virtual_filename with 'name' set to NULL and 'size' + * set to zero can be made. The return value of this call will * be the size in bytes of the filename. That value, plus 1 * for a NULL terminator, is then assigned to size for a * second H5Pget_virtual_filename call, which will retrieve @@ -2578,14 +2578,14 @@ done: * additional characters, if any, are not returned to the * user application. * - * If the length of the filename, which determines the + * If the length of the dataset name, which determines the * required value of size, is unknown, a preliminary call to - * H5Pget_virtual_dsetname with the last two parameters set - * to NULL can be made. The return value of this call will - * be the size in bytes of the filename. That value, plus 1 + * H5Pget_virtual_dsetname with 'name' set to NULL and 'size' + * set to zero can be made. The return value of this call will + * be the size in bytes of the dataset name. That value, plus 1 * for a NULL terminator, is then assigned to size for a * second H5Pget_virtual_dsetname call, which will retrieve - * the actual filename. + * the actual dataset name. * * Return: Returns the length of the name if successful, otherwise * returns a negative value. diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 7b94743..ff2b09f 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -769,9 +769,8 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, /* sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size); -#ifdef H5_CLEAR_MEMORY + /* Clear memory */ HDmemset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image))); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5STprivate.h b/src/H5STprivate.h index 892f04a..9b49b07 100644 --- a/src/H5STprivate.h +++ b/src/H5STprivate.h @@ -58,7 +58,9 @@ H5_DLL H5ST_ptr_t H5ST_findfirst(H5ST_tree_t *p); H5_DLL H5ST_ptr_t H5ST_findnext(H5ST_ptr_t p); H5_DLL void *H5ST_remove(H5ST_tree_t *root, const char *s); H5_DLL herr_t H5ST_delete(H5ST_tree_t *root, H5ST_ptr_t p); -H5_DLL herr_t H5ST_dump(H5ST_ptr_t p); +#ifdef H5ST_DEBUG +H5_DLL herr_t H5ST_dump(H5ST_tree_t *tree); +#endif /* H5ST_DEBUG */ #endif /* _H5STprivate_H */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 0dc12a3..14ca9db 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -883,10 +883,8 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") -#ifdef H5_CLEAR_MEMORY /* Initialize the parameters to a known state */ HDmemset(cd_values, 0, sizeof(cd_values)); -#endif /* H5_CLEAR_MEMORY */ /* Get the filter's current parameters */ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) @@ -1266,13 +1264,11 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value for(i = 0; i < sizeof(unsigned long long); i++) ((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long long)0xff << i*8)) >> i*8); -#ifdef H5_CLEAR_MEMORY /* Zero out remaining, unused bytes */ /* (Looks like an error in the original determination of how many * bytes would be needed for parameters. - QAK, 2010/08/19) */ HDmemset(outbuf + 13, 0, (size_t)8); -#endif /* H5_CLEAR_MEMORY */ /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 90224c1..3bb2936 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -3,40 +3,47 @@ General Information: ------------------- - HDF5 Version: @H5_VERSION@ - Configured on: @CONFIG_DATE@ - Configured by: @CONFIG_USER@ - Configure mode: @CONFIG_MODE@ - Host system: @host_cpu@-@host_vendor@-@host_os@ - Uname information: @UNAME_INFO@ - Byte sex: @BYTESEX@ - Libraries: @STATIC_SHARED@ - Installation point: @prefix@ + HDF5 Version: @H5_VERSION@ + Configured on: @CONFIG_DATE@ + Configured by: @CONFIG_USER@ + Host system: @host_cpu@-@host_vendor@-@host_os@ + Uname information: @UNAME_INFO@ + Byte sex: @BYTESEX@ + Installation point: @prefix@ Compiling Options: ------------------ - Compilation Mode: @CONFIG_MODE@ - C Compiler: @CC_VERSION@ - CFLAGS: @CFLAGS@ - H5_CFLAGS: @H5_CFLAGS@ - AM_CFLAGS: @AM_CFLAGS@ - CPPFLAGS: @CPPFLAGS@ - H5_CPPFLAGS: @H5_CPPFLAGS@ - AM_CPPFLAGS: @AM_CPPFLAGS@ - Shared C Library: @enable_shared@ - Static C Library: @enable_static@ + Build Mode: @BUILD_MODE@ + Debugging Symbols: @SYMBOLS@ + Asserts: @ASSERTS@ + Profiling: @PROFILING@ + Optimization Level: @OPTIMIZATION@ + +Linking Options: +---------------- + Libraries: @STATIC_SHARED@ Statically Linked Executables: @LT_STATIC_EXEC@ LDFLAGS: @LDFLAGS@ H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ - Extra libraries: @LIBS@ - Archiver: @AR@ - Ranlib: @RANLIB@ - Debugged Packages: @DEBUG_PKG@ - API Tracing: @TRACE_API@ + Extra libraries: @LIBS@ + Archiver: @AR@ + Ranlib: @RANLIB@ Languages: ---------- + C: yes + C Compiler: @CC_VERSION@ + CPPFLAGS: @CPPFLAGS@ + H5_CPPFLAGS: @H5_CPPFLAGS@ + AM_CPPFLAGS: @AM_CPPFLAGS@ + C Flags: @CFLAGS@ + H5 C Flags: @H5_CFLAGS@ + AM C Flags: @AM_CFLAGS@ + Shared C Library: @enable_shared@ + Static C Library: @enable_static@ + + Fortran: @HDF_FORTRAN@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC_VERSION@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@ @@ -56,17 +63,19 @@ Languages: Features: --------- Parallel HDF5: @PARALLEL@ - High Level library: @HDF5_HL@ + High-level library: @HDF5_HL@ Threadsafety: @THREADSAFE@ - Default API Mapping: @DEFAULT_API_VERSION@ - With Deprecated Public Symbols: @DEPRECATED_SYMBOLS@ + Default API mapping: @DEFAULT_API_VERSION@ + With deprecated public symbols: @DEPRECATED_SYMBOLS@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @MPE@ Direct VFD: @DIRECT_VFD@ dmalloc: @HAVE_DMALLOC@ -Clear file buffers before write: @CLEARFILEBUF@ + Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ + API tracing: @TRACE_API@ Using memory checker: @USINGMEMCHECKER@ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ - Function Stack Tracing: @CODESTACK@ - Strict File Format Checks: @STRICT_FORMAT_CHECKS@ - Optimization Instrumentation: @INSTRUMENT@ + Metadata trace file: @METADATATRACEFILE@ + Function stack tracing: @CODESTACK@ + Strict file format checks: @STRICT_FORMAT_CHECKS@ + Optimization instrumentation: @INSTRUMENT_LIBRARY@ diff --git a/test/objcopy.c b/test/objcopy.c index 241f30b..7ee6196 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2390,9 +2390,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t TESTING("H5Ocopy(): compound dataset"); -#ifdef H5_CLEAR_MEMORY HDmemset(buf, 0, sizeof(buf)); -#endif /* H5_CLEAR_MEMORY */ for(i = 0; i < DIM_SIZE_1; i++) { buf[i].a = i; buf[i].d = (double)1.0F / (double)(i + 1); -- cgit v0.12 From d8186e3871b1d84870af0965219869fc2557ae3e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 1 Feb 2016 14:38:08 -0500 Subject: [svn-r29024] Merge of r29023 from trunk. Fixes typos in configure that prevent using symbols flags (e.g.: -g). Tested on: Local linux VM --- config/cce-flags | 4 ++-- config/gnu-flags | 4 ++-- config/ibm-flags | 4 ++-- config/intel-flags | 4 ++-- config/pgi-flags | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/cce-flags b/config/cce-flags index bdfb5f9..e479363 100644 --- a/config/cce-flags +++ b/config/cce-flags @@ -64,8 +64,8 @@ if test "X-cce" = "X-$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling # Use this for profiling with gprof diff --git a/config/gnu-flags b/config/gnu-flags index 232bf05..ecb5859 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -127,8 +127,8 @@ case "$cc_vendor-$cc_version" in DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profile PROFILE_CFLAGS="-pg" diff --git a/config/ibm-flags b/config/ibm-flags index 731968d..60a7af9 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -74,8 +74,8 @@ if test "XL" = "$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling PROFILE_CFLAGS="-pg" diff --git a/config/intel-flags b/config/intel-flags index a3238fa..060e78a 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -80,8 +80,8 @@ if test "X-icc" = "X-$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling # Use this for profiling with gprof diff --git a/config/pgi-flags b/config/pgi-flags index 674f60e..a6dcba3 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -90,8 +90,8 @@ if test "X-pgcc" = "X-$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling PROFILE_CFLAGS="-Mprof=func,line" -- cgit v0.12 From a6bfa0a0aeccc101c03501956be6eef41ae723f2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 1 Feb 2016 22:57:06 -0500 Subject: [svn-r29028] Description: When SWMR writes are enabled, correct record update algorithm to indicate to parent node when a child node that was "only" modified was also "shadowed", so that parent node can update itself (since the address of its child node will move when it is shadowed). Re-enable v2 B-tree SWMR testing. Tested on: MacOSX/64 10.11.3 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5B2.c | 12 +++++- src/H5B2int.c | 119 ++++++++++++++++++++++++++++++++++++---------------- src/H5B2pkg.h | 1 + test/testswmr.sh.in | 6 +-- 4 files changed, 97 insertions(+), 41 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 0b2c52d..463a50a 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -354,9 +354,19 @@ H5B2_update(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, void *op_ HDassert(H5B2_UPDATE_UNKNOWN != status); /* Use insert algorithm if nodes to leaf full */ - if(H5B2_UPDATE_INSERT_CHILD_FULL == status) + if(H5B2_UPDATE_INSERT_CHILD_FULL == status) { if(H5B2__insert_hdr(hdr, dxpl_id, udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree") + } /* end if */ + else if(H5B2_UPDATE_SHADOW_DONE == status || H5B2_UPDATE_INSERT_DONE == status) { + /* Mark B-tree header as dirty */ + if(H5B2__hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + } /* end else-if */ + else { + /* Sanity check */ + HDassert(H5B2_UPDATE_MODIFY_DONE == status); + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2int.c b/src/H5B2int.c index aefb189..8f6cf7a 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -80,9 +80,10 @@ static herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx, void *swap_loc); static herr_t H5B2__shadow_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, - uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, H5B2_internal_t **internal); + uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, H5B2_internal_t **internal, + hbool_t *was_shadowed); static herr_t H5B2__shadow_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, - H5B2_node_ptr_t *curr_node_ptr, H5B2_leaf_t **leaf); + H5B2_node_ptr_t *curr_node_ptr, H5B2_leaf_t **leaf, hbool_t *was_shadowed); static herr_t H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent, H5B2_node_ptr_t *node_ptr, uint16_t depth); #ifdef H5B2_DEBUG @@ -232,7 +233,7 @@ H5B2__split1(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow the left node if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &left_int) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &left_int, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") left_addr = internal->node_ptrs[idx].addr; } /* end if */ @@ -268,7 +269,7 @@ H5B2__split1(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow the left node if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &left_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &left_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") left_addr = internal->node_ptrs[idx].addr; } /* end if */ @@ -571,9 +572,9 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow both nodes if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &left_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &left_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx + 1]), &right_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx + 1]), &right_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") left_addr = internal->node_ptrs[idx].addr; right_addr = internal->node_ptrs[idx + 1].addr; @@ -606,9 +607,9 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow both nodes if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &left_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &left_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx + 1]), &right_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx + 1]), &right_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") left_addr = internal->node_ptrs[idx].addr; right_addr = internal->node_ptrs[idx + 1].addr; @@ -960,11 +961,11 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow all nodes if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx - 1]), &left_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx - 1]), &left_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &middle_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &middle_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx + 1]), &right_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx + 1]), &right_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") left_addr = internal->node_ptrs[idx - 1].addr; middle_addr = internal->node_ptrs[idx].addr; @@ -1006,11 +1007,11 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow all nodes if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx - 1]), &left_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx - 1]), &left_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &middle_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &middle_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx + 1]), &right_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx + 1]), &right_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") left_addr = internal->node_ptrs[idx - 1].addr; middle_addr = internal->node_ptrs[idx].addr; @@ -1607,7 +1608,7 @@ H5B2__merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow the left node if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &left_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &left_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") left_addr = internal->node_ptrs[idx].addr; } /* end if */ @@ -1639,7 +1640,7 @@ H5B2__merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow the left node if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &left_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &left_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") left_addr = internal->node_ptrs[idx].addr; } /* end if */ @@ -1857,9 +1858,9 @@ H5B2__merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow left and middle nodes if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx - 1]), &left_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx - 1]), &left_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") - if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &middle_internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[idx]), &middle_internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") left_addr = internal->node_ptrs[idx - 1].addr; middle_addr = internal->node_ptrs[idx].addr; @@ -1900,9 +1901,9 @@ H5B2__merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* Shadow left and middle nodes if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx - 1]), &left_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx - 1]), &left_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") - if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &middle_leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx]), &middle_leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") left_addr = internal->node_ptrs[idx - 1].addr; middle_addr = internal->node_ptrs[idx].addr; @@ -2408,7 +2409,7 @@ done: if(leaf) { /* Shadow the node if doing SWMR writes */ if(hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) - if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf, NULL) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node") if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") @@ -2563,7 +2564,7 @@ done: if(internal) { /* Shadow the node if doing SWMR writes */ if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) - if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal, NULL) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node") if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") @@ -2707,10 +2708,19 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr done: /* Release the B-tree leaf node */ if(leaf) { - /* Shadow the node if doing SWMR writes */ - if(hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) - if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf) < 0) + /* Check if we should shadow this node */ + if(hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) { + hbool_t was_shadowed; /* Whether the node was actually shadowed */ + + /* Attempt to shadow the node if doing SWMR writes */ + if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf, &was_shadowed) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node") + + /* Change the state to "shadowed" if only modified currently */ + /* (Triggers parent to be marked dirty) */ + if(*status == H5B2_UPDATE_MODIFY_DONE) + *status = H5B2_UPDATE_SHADOW_DONE; + } /* end if */ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") } /* end if */ @@ -2817,6 +2827,15 @@ H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, /* No action */ break; + case H5B2_UPDATE_SHADOW_DONE: + /* If child node was shadowed (if SWMR is enabled), mark this node dirty */ + if(hdr->swmr_write) + internal_flags |= H5AC__DIRTIED_FLAG; + + /* No further modifications up the tree are necessary though, so downgrade to merely "modified" */ + *status = H5B2_UPDATE_MODIFY_DONE; + break; + case H5B2_UPDATE_INSERT_DONE: /* Mark node as dirty */ internal_flags |= H5AC__DIRTIED_FLAG; @@ -2915,10 +2934,19 @@ HDfprintf(stderr, "%s: Punting back to caller\n", FUNC); done: /* Release the internal B-tree node */ if(internal) { - /* Shadow the node if doing SWMR writes */ - if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) - if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal) < 0) + /* Check if we should shadow this node */ + if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) { + hbool_t was_shadowed; /* Whether the node was actually shadowed */ + + /* Attempt to shadow the node if doing SWMR writes */ + if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal, &was_shadowed) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node") + + /* Change the state to "shadowed" if only modified currently */ + /* (Triggers parent to be marked dirty) */ + if(*status == H5B2_UPDATE_MODIFY_DONE) + *status = H5B2_UPDATE_SHADOW_DONE; + } /* end if */ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") } /* end if */ @@ -3366,7 +3394,7 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(leaf->nrec > 0) { /* Shadow the node if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") leaf_addr = curr_node_ptr->addr; } /* end if */ @@ -3542,7 +3570,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, /* Shadow the node if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") internal_addr = curr_node_ptr->addr; } /* end if */ @@ -3759,7 +3787,7 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, if(leaf->nrec > 0) { /* Shadow the node if doing SWMR writes */ if(hdr->swmr_write) { - if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf) < 0) + if(H5B2__shadow_leaf(hdr, dxpl_id, curr_node_ptr, &leaf, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") leaf_addr = curr_node_ptr->addr; } /* end if */ @@ -3941,7 +3969,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* Shadow the node if doing SWMR writes */ if(hdr->swmr_write && !collapsed_root) { - if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal) < 0) + if(H5B2__shadow_internal(hdr, dxpl_id, depth, curr_node_ptr, &internal, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") internal_addr = curr_node_ptr->addr; } /* end if */ @@ -4537,7 +4565,7 @@ done: /*------------------------------------------------------------------------- * Function: H5B2__shadow_internal * - * Purpose: "Shadow: an internal node - copy it to a new location, + * Purpose: "Shadow" an internal node - copy it to a new location, * leaving the data in the old location intact (for now). * This is done when writing in SWMR mode to ensure that * readers do not see nodes that are out of date with @@ -4552,7 +4580,8 @@ done: */ static herr_t H5B2__shadow_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, - H5B2_node_ptr_t *curr_node_ptr, H5B2_internal_t **internal) + H5B2_node_ptr_t *curr_node_ptr, H5B2_internal_t **internal, + hbool_t *was_shadowed) { hbool_t node_pinned = FALSE; hbool_t node_protected = TRUE; @@ -4619,7 +4648,16 @@ H5B2__shadow_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, else (*internal)->shadowed_next = *internal; hdr->shadowed_internal = *internal; + + /* Indicate that the node was shadowed to parent */ + if(was_shadowed) + *was_shadowed = TRUE; } /* end if */ + else { + /* Indicate that the node was _not_ shadowed to parent */ + if(was_shadowed) + *was_shadowed = FALSE; + } /* end else */ done: if(node_pinned) @@ -4638,7 +4676,7 @@ done: /*------------------------------------------------------------------------- * Function: H5B2__shadow_leaf * - * Purpose: "Shadow: a leaf node - copy it to a new location, leaving + * Purpose: "Shadow" a leaf node - copy it to a new location, leaving * the data in the old location intact (for now). This is * done when writing in SWMR mode to ensure that readers do * not see nodes that are out of date with respect to each @@ -4653,7 +4691,7 @@ done: */ static herr_t H5B2__shadow_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, - H5B2_node_ptr_t *curr_node_ptr, H5B2_leaf_t **leaf) + H5B2_node_ptr_t *curr_node_ptr, H5B2_leaf_t **leaf, hbool_t *was_shadowed) { hbool_t node_pinned = FALSE; hbool_t node_protected = TRUE; @@ -4719,7 +4757,16 @@ H5B2__shadow_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, else (*leaf)->shadowed_next = *leaf; hdr->shadowed_leaf = *leaf; + + /* Indicate that the node was shadowed to parent */ + if(was_shadowed) + *was_shadowed = TRUE; } /* end if */ + else { + /* Indicate that the node was _not_ shadowed to parent */ + if(was_shadowed) + *was_shadowed = FALSE; + } /* end else */ done: if(node_pinned) diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 46f3d83..38b4bad 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -242,6 +242,7 @@ typedef enum H5B2_nodepos_t { typedef enum H5B2_update_status_t { H5B2_UPDATE_UNKNOWN, /* Unknown update status (initial state) */ H5B2_UPDATE_MODIFY_DONE, /* Update successfully modified existing record */ + H5B2_UPDATE_SHADOW_DONE, /* Update modified existing record and modified node was shadowed */ H5B2_UPDATE_INSERT_DONE, /* Update inserted record successfully */ H5B2_UPDATE_INSERT_CHILD_FULL /* Update will insert record, but child is full */ } H5B2_update_status_t; diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index c0f70b6..75d9bda 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -124,9 +124,7 @@ while [ $# -gt 0 ]; do done # Loop over index types -# Comment out until I figure out the v2 B-tree bug -QAK -#for index_type in "-i ea" "-i b2" -for index_type in "-i ea" +for index_type in "-i ea" "-i b2" do # Try with and without compression for compress in "" "-c 5" @@ -450,7 +448,7 @@ do pid_readers="" echo launch $Nrdrs_spa swmr_sparse_readers while [ $n -lt $Nrdrs_spa ]; do - # The sparse writer spits out a LOT of data so it's set to 'quiet' + # The sparse reader spits out a LOT of data so it's set to 'quiet' ./swmr_sparse_reader -q $Nrecs_spa & pid_readers="$pid_readers $!" n=`expr $n + 1` -- cgit v0.12 From 56a8a212ebcd67912e79d612dae36285bea9e286 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 5 Feb 2016 14:17:02 -0500 Subject: [svn-r29048] Fix to h5format_convert tool: (1) Downgrade layout version to 3 for contiguous and compact dataset (2) Add new test files for testing with/without messages in superblock extension. Tested on jam, osx1010test, platypus, quail, ostrich, kite, moohan, kituo, mayll, emu. --- src/H5D.c | 42 +- src/H5Dint.c | 131 ++-- tools/h5format_convert/h5fc_gentest.c | 683 +++++++++++---------- tools/h5format_convert/h5format_convert.c | 98 +-- tools/h5format_convert/testfiles/h5fc_d_file.ddl | 14 +- tools/h5format_convert/testfiles/h5fc_dname.ddl | 14 +- tools/h5format_convert/testfiles/h5fc_ext1_f.ddl | 58 ++ tools/h5format_convert/testfiles/h5fc_ext1_f.h5 | Bin 0 -> 6760 bytes tools/h5format_convert/testfiles/h5fc_ext1_i.ddl | 58 ++ tools/h5format_convert/testfiles/h5fc_ext1_i.h5 | Bin 0 -> 6526 bytes tools/h5format_convert/testfiles/h5fc_ext1_s.ddl | 58 ++ tools/h5format_convert/testfiles/h5fc_ext1_s.h5 | Bin 0 -> 6592 bytes tools/h5format_convert/testfiles/h5fc_ext2_if.ddl | 58 ++ tools/h5format_convert/testfiles/h5fc_ext2_if.h5 | Bin 0 -> 6526 bytes tools/h5format_convert/testfiles/h5fc_ext2_is.ddl | 58 ++ tools/h5format_convert/testfiles/h5fc_ext2_is.h5 | Bin 0 -> 6642 bytes tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl | 58 ++ tools/h5format_convert/testfiles/h5fc_ext2_sf.h5 | Bin 0 -> 5076 bytes tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl | 58 ++ tools/h5format_convert/testfiles/h5fc_ext3_isf.h5 | Bin 0 -> 6679 bytes tools/h5format_convert/testfiles/h5fc_ext_none.h5 | Bin 0 -> 6474 bytes tools/h5format_convert/testfiles/h5fc_help.ddl | 14 +- tools/h5format_convert/testfiles/h5fc_latest_v3.h5 | Bin 6130 -> 0 bytes tools/h5format_convert/testfiles/h5fc_non_v3.h5 | Bin 4336 -> 6896 bytes tools/h5format_convert/testfiles/h5fc_nooption.ddl | 14 +- tools/h5format_convert/testfiles/h5fc_v1.h5 | Bin 8252 -> 0 bytes tools/h5format_convert/testfiles/h5fc_v_all.ddl | 66 +- tools/h5format_convert/testfiles/h5fc_v_bt1.ddl | 6 +- tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl | 4 +- tools/h5format_convert/testfiles/h5fc_v_n_all.ddl | 32 +- .../testfiles/h5fc_v_ndata_bt1.ddl | 6 +- .../testfiles/h5fc_v_non_chunked.ddl | 6 +- .../h5format_convert/testfiles/old_h5fc_ext1_f.ddl | 58 ++ .../h5format_convert/testfiles/old_h5fc_ext1_f.h5 | Bin 0 -> 19987 bytes .../h5format_convert/testfiles/old_h5fc_ext1_i.ddl | 58 ++ .../h5format_convert/testfiles/old_h5fc_ext1_i.h5 | Bin 0 -> 32716 bytes .../h5format_convert/testfiles/old_h5fc_ext1_s.ddl | 58 ++ .../h5format_convert/testfiles/old_h5fc_ext1_s.h5 | Bin 0 -> 20032 bytes .../testfiles/old_h5fc_ext2_if.ddl | 58 ++ .../h5format_convert/testfiles/old_h5fc_ext2_if.h5 | Bin 0 -> 32720 bytes .../testfiles/old_h5fc_ext2_is.ddl | 58 ++ .../h5format_convert/testfiles/old_h5fc_ext2_is.h5 | Bin 0 -> 32872 bytes .../testfiles/old_h5fc_ext2_sf.ddl | 58 ++ .../h5format_convert/testfiles/old_h5fc_ext2_sf.h5 | Bin 0 -> 18512 bytes .../testfiles/old_h5fc_ext3_isf.ddl | 58 ++ .../testfiles/old_h5fc_ext3_isf.h5 | Bin 0 -> 32896 bytes .../testfiles/old_h5fc_ext_none.h5 | Bin 0 -> 19912 bytes tools/h5format_convert/testh5fc.sh.in | 188 ++++-- 48 files changed, 1594 insertions(+), 536 deletions(-) create mode 100644 tools/h5format_convert/testfiles/h5fc_ext1_f.ddl create mode 100644 tools/h5format_convert/testfiles/h5fc_ext1_f.h5 create mode 100644 tools/h5format_convert/testfiles/h5fc_ext1_i.ddl create mode 100644 tools/h5format_convert/testfiles/h5fc_ext1_i.h5 create mode 100644 tools/h5format_convert/testfiles/h5fc_ext1_s.ddl create mode 100644 tools/h5format_convert/testfiles/h5fc_ext1_s.h5 create mode 100644 tools/h5format_convert/testfiles/h5fc_ext2_if.ddl create mode 100644 tools/h5format_convert/testfiles/h5fc_ext2_if.h5 create mode 100644 tools/h5format_convert/testfiles/h5fc_ext2_is.ddl create mode 100644 tools/h5format_convert/testfiles/h5fc_ext2_is.h5 create mode 100644 tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl create mode 100644 tools/h5format_convert/testfiles/h5fc_ext2_sf.h5 create mode 100644 tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl create mode 100644 tools/h5format_convert/testfiles/h5fc_ext3_isf.h5 create mode 100644 tools/h5format_convert/testfiles/h5fc_ext_none.h5 delete mode 100644 tools/h5format_convert/testfiles/h5fc_latest_v3.h5 delete mode 100644 tools/h5format_convert/testfiles/h5fc_v1.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext1_f.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext1_i.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext1_s.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext2_if.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext2_is.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 create mode 100644 tools/h5format_convert/testfiles/old_h5fc_ext_none.h5 diff --git a/src/H5D.c b/src/H5D.c index 18c2edb..82aac6e 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -993,7 +993,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Dformat_convert (Internal) * - * Purpose: Convert a dataset's chunk indexing type to version 1 B-tree + * Purpose: For chunked: + * Convert the chunk indexing type to version 1 B-tree if not + * For compact/contiguous: + * Downgrade layout version to 3 if greater than 3 + * For virtual: no conversion * * Return: Non-negative on success, negative on failure * @@ -1014,17 +1018,31 @@ H5Dformat_convert(hid_t dset_id) if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - /* Nothing to do if not a chunked dataset */ - if(dset->shared->layout.type != H5D_CHUNKED) - HGOTO_DONE(SUCCEED) - - /* Nothing to do if the chunk indexing type is already version 1 B-tree */ - if(dset->shared->layout.u.chunk.idx_type == H5D_CHUNK_IDX_BTREE) - HGOTO_DONE(SUCCEED) - - /* Call private function to do the conversion */ - if((H5D__format_convert(dset, H5AC_dxpl_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to convert chunk indexing type for dataset") + switch(dset->shared->layout.type) { + case H5D_CHUNKED: + /* Convert the chunk indexing type to version 1 B-tree if not */ + if(dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE) { + if((H5D__format_convert(dset, H5AC_dxpl_id)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset") + } + break; + + case H5D_CONTIGUOUS: + case H5D_COMPACT: + /* Downgrade the layout version to 3 if greater than 3 */ + if(dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT) { + if((H5D__format_convert(dset, H5AC_dxpl_id)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset") + } + break; + + case H5D_VIRTUAL: + /* Nothing to do even though layout is version 4 */ + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") + } /* end switch */ done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dint.c b/src/H5Dint.c index ed0e63e..ea3b749 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2955,7 +2955,8 @@ done: /*------------------------------------------------------------------------- * Function: H5D__format_convert * - * Purpose: To convert a dataset's chunk indexing type to version 1 btree + * Purpose: For chunked: downgrade the chunk indexing type to version 1 B-tree + * For compact/contiguous: downgrade layout version to 3 * * Return: Success: Non-negative * Failure: Negative @@ -2970,7 +2971,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) H5O_t *oh = NULL; /* Pointer to dataset's object header */ H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */ H5D_chk_idx_info_t idx_info; /* Index info for the current layout */ - H5O_layout_t newlayout; /* The new layout */ + H5O_layout_t newlayout; /* The new layout */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -2978,64 +2979,86 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) /* Check args */ HDassert(dataset); - /* Set up the current index info */ - idx_info.f = dataset->oloc.file; - idx_info.dxpl_id = dxpl_id; - idx_info.pline = &dataset->shared->dcpl_cache.pline; - idx_info.layout = &dataset->shared->layout.u.chunk; - idx_info.storage = &dataset->shared->layout.storage.u.chunk; - - /* Copy the current layout info to the new layout */ - HDmemcpy(&newlayout, &dataset->shared->layout, sizeof(H5O_layout_t)); - - /* Set up info for version 1 B-tree in the new layout */ - newlayout.version = H5O_LAYOUT_VERSION_3; - newlayout.storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; - newlayout.storage.u.chunk.idx_addr = HADDR_UNDEF; - newlayout.storage.u.chunk.ops = H5D_COPS_BTREE; - newlayout.storage.u.chunk.u.btree.shared = NULL; - - /* Set up the index info to version 1 B-tree */ - new_idx_info.f = dataset->oloc.file; - new_idx_info.dxpl_id = dxpl_id; - new_idx_info.pline = &dataset->shared->dcpl_cache.pline; - new_idx_info.layout = &newlayout.u.chunk; - new_idx_info.storage = &newlayout.storage.u.chunk; - - /* Initialize version 1 B-tree */ - if(newlayout.storage.u.chunk.ops->init && - (newlayout.storage.u.chunk.ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + switch(dataset->shared->layout.type) { + case H5D_CHUNKED: + { + HDassert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE); + + /* Set up the current index info */ + idx_info.f = dataset->oloc.file; + idx_info.dxpl_id = dxpl_id; + idx_info.pline = &dataset->shared->dcpl_cache.pline; + idx_info.layout = &dataset->shared->layout.u.chunk; + idx_info.storage = &dataset->shared->layout.storage.u.chunk; + + /* Copy the current layout info to the new layout */ + HDmemcpy(&newlayout, &dataset->shared->layout, sizeof(H5O_layout_t)); + + /* Set up info for version 1 B-tree in the new layout */ + newlayout.version = H5O_LAYOUT_VERSION_3; + newlayout.storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; + newlayout.storage.u.chunk.idx_addr = HADDR_UNDEF; + newlayout.storage.u.chunk.ops = H5D_COPS_BTREE; + newlayout.storage.u.chunk.u.btree.shared = NULL; + + /* Set up the index info to version 1 B-tree */ + new_idx_info.f = dataset->oloc.file; + new_idx_info.dxpl_id = dxpl_id; + new_idx_info.pline = &dataset->shared->dcpl_cache.pline; + new_idx_info.layout = &newlayout.u.chunk; + new_idx_info.storage = &newlayout.storage.u.chunk; + + /* Initialize version 1 B-tree */ + if(newlayout.storage.u.chunk.ops->init && + (newlayout.storage.u.chunk.ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") - /* If the current chunk index exists */ - if(H5F_addr_defined(dataset->shared->layout.storage.u.chunk.idx_addr)) { - /* Create v1 B-tree chunk index */ - if((newlayout.storage.u.chunk.ops->create)(&new_idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") - - /* Iterate over the chunks in the current index and insert the chunk addresses - * into the version 1 B-tree chunk index */ - if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info") - } /* end if */ + /* If the current chunk index exists */ + if(H5F_addr_defined(dataset->shared->layout.storage.u.chunk.idx_addr)) { + /* Create v1 B-tree chunk index */ + if((newlayout.storage.u.chunk.ops->create)(&new_idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") + + /* Iterate over the chunks in the current index and insert the chunk addresses + * into the version 1 B-tree chunk index */ + if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info") + } /* end if */ + + /* Release the old (i.e. current) chunk index */ + if(dataset->shared->layout.storage.u.chunk.ops->dest && + (dataset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") - /* Release the old (i.e. current) chunk index */ - if(dataset->shared->layout.storage.u.chunk.ops->dest && - (dataset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + /* Delete the "layout" message */ + if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, TRUE, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") - /* Delete the "layout" message */ - if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, TRUE, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") + HDmemcpy(&dataset->shared->layout, &newlayout, sizeof(H5O_layout_t)); - HDmemcpy(&dataset->shared->layout, &newlayout, sizeof(H5O_layout_t)); + if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") - if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") + /* Append the new layout message to the object header */ + if(H5O_msg_append_oh(dataset->oloc.file, dxpl_id, oh, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &newlayout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message") - /* Append the new layout message to the object header */ - if(H5O_msg_append_oh(dataset->oloc.file, dxpl_id, oh, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &newlayout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message") + break; + } + + case H5D_CONTIGUOUS: + case H5D_COMPACT: + HDassert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT); + dataset->shared->layout.version = H5O_LAYOUT_VERSION_DEFAULT; + if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") + break; + + case H5D_VIRTUAL: + default: + HDassert(0); + break; + } done: /* Release pointer to object header */ diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c index 888aa27..54ef3df 100644 --- a/tools/h5format_convert/h5fc_gentest.c +++ b/tools/h5format_convert/h5fc_gentest.c @@ -23,338 +23,52 @@ * of the expected output and update the corresponding *.ddl files. */ #include "hdf5.h" +#include "H5private.h" + +#define NON_V3_FILE "h5fc_non_v3.h5" +#define EDGE_V3_FILE "h5fc_edge_v3.h5" + +const char *FILENAME[] = { + "h5fc_ext1_i.h5", /* 0 */ + "h5fc_ext1_s.h5", /* 1 */ + "h5fc_ext1_f.h5", /* 2 */ + "h5fc_ext2_is.h5", /* 3 */ + "h5fc_ext2_if.h5", /* 4 */ + "h5fc_ext2_sf.h5", /* 5 */ + "h5fc_ext3_isf.h5", /* 6 */ + "h5fc_ext_none.h5", /* 7 */ + NULL +}; #define GROUP "GROUP" -#define OLD_V1_FILE "h5fc_v1.h5" -#define DSET_NON_CHUNKED "DSET_NON_CHUNKED" #define DSET_BT1 "DSET_BT1" #define DSET_NDATA_BT1 "DSET_NDATA_BT1" +#define DSET_COMPACT "DSET_COMPACT" +#define DSET_CONTIGUOUS "DSET_CONTIGUOUS" -#define LATEST_V3_FILE "h5fc_latest_v3.h5" #define DSET_EA "DSET_EA" #define DSET_NDATA_EA "DSET_NDATA_EA" #define DSET_BT2 "DSET_BT2" #define DSET_NDATA_BT2 "DSET_NDATA_BT2" #define DSET_FA "DSET_FA" -#define DSET_NDATA_FA "DSET_NDATA_FA" -#define DSET_NONE "DSET_NONE" -#define DSET_NDATA_NONE "DSET_NDATA_NONE" - -#define NON_V3_FILE "h5fc_non_v3.h5" - -#define EDGE_V3_FILE "h5fc_edge_v3.h5" -#define DSET_EDGE "DSET_EDGE" - -/* - * Function: gen_old() - * - * Create an old format file with: - * 1) 1 non-chunked dataset - * 2) 2 chunked datasets with version 1 B-tree chunk indexing type: with/without data - */ -static void -gen_old(const char *fname) -{ - hid_t fid = -1; /* file id */ - hid_t fcpl = -1; - hid_t gid = -1; /* group id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did1 = -1, did2 = -1; /* dataset id */ - hsize_t dims1[1] = {10}; /* dataset dimension */ - hsize_t dims2[2] = {4, 6}; /* dataset dimension */ - hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ - int i; /* local index variable */ - int buf[24]; /* data buffer */ - - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - goto error; - - if(H5Pset_istore_k(fcpl, 64) < 0) - goto error; - - /* Create file */ - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) - goto error; - - /* Create a group */ - if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - - - /* - * Create a non-chunked dataset - */ - - /* Create dataspace */ - if((sid = H5Screate_simple(1, dims1, NULL)) < 0) - goto error; - - /* Create the dataset */ - if((did1 = H5Dcreate2(fid, DSET_NON_CHUNKED, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - - /* Closing */ - if(H5Sclose(sid) < 0) - goto error; - if(H5Dclose(did1) < 0) - goto error; - - /* - * Create two chunked datasets with version 1 B-tree chunk indexing type - * (one with data, one without data) - */ - - /* Create data */ - for(i = 0; i < 24; i++) - buf[i] = i; - - /* Set chunk */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - if(H5Pset_chunk(dcpl, 2, c_dims) < 0) - goto error; - - /* Create dataspace */ - if((sid = H5Screate_simple(2, dims2, NULL)) < 0) - goto error; - - /* Create the 2 datasets */ - if((did1 = H5Dcreate2(fid, DSET_NDATA_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - if((did2 = H5Dcreate2(gid, DSET_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - /* Write to one dataset */ - if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; - - /* Closing */ - if(H5Pclose(dcpl) < 0) - goto error; - if(H5Sclose(sid) < 0) - goto error; - if(H5Dclose(did1) < 0) - goto error; - if(H5Dclose(did2) < 0) - goto error; - - if(H5Gclose(gid) < 0) - goto error; - if(H5Fclose(fid) < 0) - goto error; - -error: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - H5Dclose(did1); - H5Dclose(did2); - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - -} /* gen_old() */ - -/* - * Function: gen_latest() - * - * Create a file with write+latest-format--this will result in v3 superblock+latest version support: - * 1) 2 chunked datasets with extensible array chunk indexing type (with/without data) - * 2) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) - * 3) 2 chunked datasets with fixed array chunk indexing type (with/without data) - * 4) 2 chunked datasets with implicit array chunk indexing type (with/without data) - */ -static void -gen_latest(const char *fname) -{ - hid_t fid = -1; /* file id */ - hid_t fapl = -1; /* file access property list */ - hid_t fcpl = -1; /* file creation property list */ - hid_t gid = -1; /* group id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did1 = -1, did2 = -1; /* dataset id */ - hsize_t dims2[2] = {4, 6}; /* dataset dimension */ - hsize_t max_dims[2]; /* maximum dataset dimension */ - hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ - int i; /* local index variable */ - int buf[24]; /* data buffer */ - - /* Create a new format file */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; - - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - goto error; - if(H5Pset_shared_mesg_nindexes(fcpl, 4) < 0) - goto error; - - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - goto error; - - /* Create a group */ - if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - - /* Set chunk */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - if(H5Pset_chunk(dcpl, 2, c_dims) < 0) - goto error; - - /* - * Create 2 chunked datasets with extensible array chunk indexing type - * (one with data; one without data) - */ - - /* Create dataspace */ - max_dims[0] = 10; - max_dims[1] = H5S_UNLIMITED; - if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) - goto error; - - /* Create the 2 datasets */ - if((did1 = H5Dcreate2(gid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - if((did2 = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - /* Create data */ - for(i = 0; i < 24; i++) - buf[i] = i; - - /* Write to one dataset */ - if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; - - /* Closing */ - if(H5Sclose(sid) < 0) - goto error; - if(H5Dclose(did1) < 0) - goto error; - if(H5Dclose(did2) < 0) - goto error; - - - /* - * Create 2 chunked datasets with version 2 B-tree chunk indexing type - * (one with data; one without data) - */ - - /* Create dataspace */ - max_dims[0] = 10; - max_dims[0] = H5S_UNLIMITED; - max_dims[1] = H5S_UNLIMITED; - if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) - goto error; - - /* Create the 2 datasets */ - if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - if((did2 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - /* Write to one dataset */ - if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; - - /* Closing */ - if(H5Sclose(sid) < 0) - goto error; - if(H5Dclose(did1) < 0) - goto error; - if(H5Dclose(did2) < 0) - goto error; - - /* - * Create 2 chunked datasets with fixed array chunk indexing type - * (one with data; one without data) - */ - - /* Create dataspace */ - max_dims[0] = 20; - max_dims[1] = 10; - if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) - goto error; - - /* Create the datasets */ - if((did1 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - if((did2 = H5Dcreate2(gid, DSET_NDATA_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - /* Write to the dataset */ - if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; - - /* Closing */ - if(H5Sclose(sid) < 0) - goto error; - if(H5Dclose(did1) < 0) - goto error; - if(H5Dclose(did2) < 0) - goto error; - - - /* - * Create 2 chunked datasets with implicit chunk indexing type - * (one with data; one without data) - */ - - /* Create dataspace */ - if((sid = H5Screate_simple(2, dims2, NULL)) < 0) - goto error; - - /* Set early allocation */ - if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) - goto error; - - /* Create the 2 datasets */ - if((did1 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - if((did2 = H5Dcreate2(gid, DSET_NDATA_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - - /* Write to one dataset */ - if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; - - /* Closing */ - if(H5Dclose(did1) < 0) - goto error; - if(H5Dclose(did2) < 0) - goto error; - if(H5Sclose(sid) < 0) - goto error; - - if(H5Pclose(dcpl) < 0) - goto error; - if(H5Gclose(gid) < 0) - goto error; - if(H5Fclose(fid) < 0) - goto error; - -error: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - H5Dclose(did1); - H5Dclose(did2); - H5Gclose(gid); - H5Fclose(fid); - H5Pclose(fapl); - } H5E_END_TRY; +#define DSET_NDATA_FA "DSET_NDATA_FA" +#define DSET_NONE "DSET_NONE" +#define DSET_NDATA_NONE "DSET_NDATA_NONE" + +#define DSET_EDGE "DSET_EDGE" + +#define ISTORE_IK 64 -} /* gen_latest() */ +/* + * Function: gen_latest() + * + * Create a file with write+latest-format--this will result in v3 superblock+latest version support: + * 1) 2 chunked datasets with extensible array chunk indexing type (with/without data) + * 2) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) + * 3) 2 chunked datasets with fixed array chunk indexing type (with/without data) + * 4) 2 chunked datasets with implicit array chunk indexing type (with/without data) + */ /* * Function: gen_non() @@ -365,7 +79,7 @@ error: * Re-open the file with write+non-latest-format and create: * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data) * 4) 1 chunked dataset with extensible array indexing type (with data) - * 5) 1 non-chunked dataset + * 5) 1 compact and 1 contiguous datasets */ static void gen_non(const char *fname) @@ -409,7 +123,7 @@ gen_non(const char *fname) goto error; /* - * Create a chunked dataset with extensible array chunk indexing type (without data) + * Create a chunked dataset with extensible array chunk indexing type (without data) */ /* Create dataspace */ @@ -492,7 +206,7 @@ gen_non(const char *fname) goto error; /* - * Create a dataset with version extensible array chunk indexing type (with data) in the group + * Create a dataset with extensible array chunk indexing type (with data) in the group */ /* Create dataspace */ @@ -512,35 +226,68 @@ gen_non(const char *fname) /* Closing */ if(H5Sclose(sid) < 0) goto error; + if(H5Pclose(dcpl) < 0) + goto error; if(H5Dclose(did1) < 0) goto error; if(H5Dclose(did2) < 0) goto error; /* - * Create a non-chunked dataset in the group + * Create a compact dataset in the group */ /* Create dataspace */ if((sid = H5Screate_simple(1, dims1, NULL)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) + goto error; + /* Create the dataset */ - if((did1 = H5Dcreate2(gid, DSET_NON_CHUNKED, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((did1 = H5Dcreate2(gid, DSET_COMPACT, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* Closing */ + if(H5Dclose(did1) < 0) + goto error; + if(H5Pclose(dcpl) < 0) + goto error; if(H5Sclose(sid) < 0) goto error; - if(H5Dclose(did1) < 0) + + /* + * Create a contiguous dataset with (2d with data) in the file + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0) goto error; - if(H5Gclose(gid) < 0) + if((sid = H5Screate_simple(2, dims2, NULL)) < 0) goto error; - if(H5Fclose(fid) < 0) + + /* Create the dataset */ + if((did2 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + /* Write to the dataset */ + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; + + /* Closing */ + if(H5Dclose(did2) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; + if(H5Sclose(sid) < 0) + goto error; + + if(H5Gclose(gid) < 0) + goto error; + if(H5Fclose(fid) < 0) + goto error; error: H5E_BEGIN_TRY { @@ -632,18 +379,286 @@ error: } /* gen_edge() */ -int main(void) + +/* + * Function: gen_ext() + * + * Create a file with/without latest format with: + * 1) 1 contiguous dataset (without data) + * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data) + * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) + * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data) + * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data) + * It will create the file with/without messages in the superblock extension depending + * on the parameter "what". + */ +static void +gen_ext(const char *fname, unsigned new, unsigned what) { - /* Generate an old format file with v1 superbock */ - gen_old(OLD_V1_FILE); + hid_t fid = -1; /* file id */ + hid_t fapl = -1; /* file access property list */ + hid_t fcpl = -1; /* file creation property list */ + hid_t gid = -1; /* group id */ + hid_t sid = -1; /* space id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did1 = -1, did2 = -1; /* dataset id */ + hsize_t dims1[1] = {10}; /* dataset dimension */ + hsize_t dims2[2] = {4, 6}; /* dataset dimension */ + hsize_t max_dims[2]; /* maximum dataset dimension */ + hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ + int i; /* local index variable */ + int buf[24]; /* data buffer */ + + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + if(new) { + /* Create a new format file */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + goto error; + } + + /* Create a file creation property list */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + + /* Generate messages that might be placed in superblock extension */ + switch(what) { + case 0: + H5Pset_istore_k(fcpl, ISTORE_IK); + break; + case 1: + H5Pset_shared_mesg_nindexes(fcpl, 4); + break; + case 2: + H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); + break; + case 3: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_shared_mesg_nindexes(fcpl, 4); + break; + case 4: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_file_space(fcpl, 0, (hsize_t)2); + break; + case 5: + H5Pset_shared_mesg_nindexes(fcpl, 4); + H5Pset_file_space(fcpl, H5F_FILE_SPACE_VFD, (hsize_t)0); + break; + case 6: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_shared_mesg_nindexes(fcpl, 4); + H5Pset_file_space(fcpl, H5F_FILE_SPACE_AGGR_VFD, (hsize_t)0); + break; + default: + break; + } + + /* Create the file */ + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + goto error; + + /* Create a group */ + if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Set chunk */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl, 2, c_dims) < 0) + goto error; + + + /* + * Create a contiguous dataset + */ + + /* Create dataspace */ + if((sid = H5Screate_simple(1, dims1, NULL)) < 0) + goto error; + + /* Create the dataset */ + if((did1 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Closing */ + if(H5Sclose(sid) < 0) + goto error; + if(H5Dclose(did1) < 0) + goto error; + + /* + * Create 2 chunked datasets with extensible array chunk indexing type + * (one with data; one without data) + */ + + /* Create dataspace */ + max_dims[0] = 10; + max_dims[1] = H5S_UNLIMITED; + if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) + goto error; + + /* Create the 2 datasets */ + if((did1 = H5Dcreate2(gid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + if((did2 = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + /* Create data */ + for(i = 0; i < 24; i++) + buf[i] = i; + + /* Write to one dataset */ + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; - /* Generate a latest-format file with v3 superblock */ - gen_latest(LATEST_V3_FILE); + /* Closing */ + if(H5Sclose(sid) < 0) + goto error; + if(H5Dclose(did1) < 0) + goto error; + if(H5Dclose(did2) < 0) + goto error; + + + /* + * Create 2 chunked datasets with version 2 B-tree chunk indexing type + * (one with data; one without data) + */ + + /* Create dataspace */ + max_dims[0] = 10; + max_dims[0] = H5S_UNLIMITED; + max_dims[1] = H5S_UNLIMITED; + if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) + goto error; + + /* Create the 2 datasets */ + if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + if((did2 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + /* Write to one dataset */ + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; + + /* Closing */ + if(H5Sclose(sid) < 0) + goto error; + if(H5Dclose(did1) < 0) + goto error; + if(H5Dclose(did2) < 0) + goto error; + + /* + * Create 2 chunked datasets with fixed array chunk indexing type + * (one with data; one without data) + */ + + /* Create dataspace */ + max_dims[0] = 20; + max_dims[1] = 10; + if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) + goto error; + + /* Create the datasets */ + if((did1 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + if((did2 = H5Dcreate2(gid, DSET_NDATA_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + /* Write to the dataset */ + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; + + /* Closing */ + if(H5Sclose(sid) < 0) + goto error; + if(H5Dclose(did1) < 0) + goto error; + if(H5Dclose(did2) < 0) + goto error; + + + /* + * Create 2 chunked datasets with implicit chunk indexing type + * (one with data; one without data) + */ + + /* Create dataspace */ + if((sid = H5Screate_simple(2, dims2, NULL)) < 0) + goto error; + + /* Set early allocation */ + if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) + goto error; + + /* Create the 2 datasets */ + if((did1 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + if((did2 = H5Dcreate2(gid, DSET_NDATA_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + /* Write to one dataset */ + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; + + /* Closing */ + if(H5Dclose(did1) < 0) + goto error; + if(H5Dclose(did2) < 0) + goto error; + if(H5Sclose(sid) < 0) + goto error; + + if(H5Pclose(dcpl) < 0) + goto error; + if(H5Gclose(gid) < 0) + goto error; + if(H5Fclose(fid) < 0) + goto error; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Sclose(sid); + H5Dclose(did1); + H5Dclose(did2); + H5Gclose(gid); + H5Fclose(fid); + H5Pclose(fapl); + H5Pclose(fcpl); + } H5E_END_TRY; + +} /* gen_ext() */ + +int main(void) +{ + unsigned i, new; /* Generate a non-latest-format file with v3 superblock */ gen_non(NON_V3_FILE); - /* Generate a new format file with a no-filter-edge-chunk dataset for testing */ + /* Generate a new format file with a no-filter-edge-chunk dataset */ gen_edge(EDGE_V3_FILE); + + /* Generate old/new format file with/without messages in the superblock extension */ + for(new = FALSE; new <= TRUE; new++) { + for(i = 0; i < 8; i++) { + char filename[50]; + + HDmemset(filename, 0, sizeof(filename)); + if(!new) + HDstrcat(filename, "old_"); + HDstrcat(filename, FILENAME[i]); + + gen_ext(filename, new, i); + } + } /* end for new */ + return 0; } diff --git a/tools/h5format_convert/h5format_convert.c b/tools/h5format_convert/h5format_convert.c index 54c666d..105ac5d 100644 --- a/tools/h5format_convert/h5format_convert.c +++ b/tools/h5format_convert/h5format_convert.c @@ -88,16 +88,20 @@ static void usage(const char *prog) printf("Examples of use:\n"); printf("\n"); printf("h5format_convert -d /group/dataset file_name\n"); - printf(" Convert the chunk indexing type to version 1 B-tree\n"); - printf(" for the chunked dataset in the HDF5 file .\n"); + printf(" Convert the dataset in the HDF5 file :\n"); + printf(" a. chunked dataset: convert the chunk indexing type to version 1 B-tree\n"); + printf(" b. compact/contiguous dataset: downgrade the layout version to 3\n"); + printf(" c. virtual dataset: no action\n"); printf("\n"); printf("h5format_convert file_name\n"); - printf(" Convert the chunk indexing type to version 1 B-tree\n"); - printf(" for all the chunked datasets in the HDF5 file .\n"); + printf(" Convert all datasets in the HDF5 file :\n"); + printf(" a. chunked dataset: convert the chunk indexing type to version 1 B-tree\n"); + printf(" b. compact/contiguous dataset: downgrade the layout version to 3\n"); + printf(" c. virtual dataset: no action\n"); printf("\n"); printf("h5format_convert -n -d /group/dataset file_name\n"); printf(" Go through all the steps except the actual conversion when \n"); - printf(" converting the chunked dataset in the HDF5 file .\n"); + printf(" converting the dataset in the HDF5 file .\n"); } /* usage() */ /*------------------------------------------------------------------------- @@ -200,11 +204,15 @@ leave(int ret) /*------------------------------------------------------------------------- * Function: convert() * - * Purpose: To change the chunk indexing type for the dataset to version 1 B-tree. - * -- the dataset has to be chunked - * -- the dataset's chunk indexing type is not already version 1 B-tree. - * If the above conditions are not fulfilled, the tool will not perform - * the conversion but will exit with success. + * Purpose: To downgrade a dataset's indexing type or layout version: + * For chunked: + * Downgrade the chunk indexing type to version 1 B-tree + * If type is already version 1 B-tree, no further action + * For compact/contiguous: + * Downgrade the layout version from 4 to 3 + * If version is already <= 3, no further action + * For virtual: + * No further action * * Return: Success: 0 * Failure: 1 @@ -244,34 +252,49 @@ convert(hid_t fid, const char *dname) } else if(verbose_g) printf("Retrieve the dataset's layout\n"); - /* No further action if not a chunked dataset */ - if(layout_type != H5D_CHUNKED) { - if(verbose_g) - printf("Dataset is not chunked: no further action\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + switch(layout_type) { + case H5D_CHUNKED: + if(verbose_g) + printf("Dataset is a chunked dataset\n"); - } else if(verbose_g) - printf("Verify the dataset is a chunked dataset\n"); + /* Get the dataset's chunk indexing type */ + if(H5Dget_chunk_index_type(did, &idx_type) < 0) { + error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } else if(verbose_g) + printf("Retrieve the dataset's chunk indexing type\n"); - /* Get the dataset's chunk indexing type */ - if(H5Dget_chunk_index_type(did, &idx_type) < 0) { - error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; + if(idx_type == H5D_CHUNK_IDX_BTREE) { + if(verbose_g) + printf("Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; + } else if (verbose_g) + printf("Dataset's chunk indexing type is not version 1 B-tree\n"); + break; - } else if(verbose_g) - printf("Retrieve the dataset's chunk indexing type\n"); + case H5D_CONTIGUOUS: + if(verbose_g) + printf("Dataset is a contiguous dataset: downgrade layout version as needed\n"); + break; - /* No further action if the chunk indexing type is already version 1 B-tree */ - if(idx_type == H5D_CHUNK_IDX_BTREE) { - if(verbose_g) - printf("Chunk indexing type is already version 1 B-tree: no further action\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + case H5D_COMPACT: + if(verbose_g) + printf("Dataset is a compact dataset: downgrade layout version as needed\n"); + break; - } else if (verbose_g) - printf("Verify the dataset's chunk indexing type is not version 1 B-tree\n"); + case H5D_VIRTUAL: + if(verbose_g) + printf("No further action for virtual dataset\n"); + goto done; + + default: + error_msg("unknown layout type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + + } /* end switch */ /* No further action if it is a noop */ if(noop_g) { @@ -284,12 +307,11 @@ convert(hid_t fid, const char *dname) if(verbose_g) printf("Converting the dataset...\n"); - /* Convert the dataset's chunk indexing type to version 1 B-tree */ + /* Downgrade the dataset */ if(H5Dformat_convert(did) < 0) { - error_msg("unable to convert chunk indexing for \"%s\"\n", dname); + error_msg("unable to downgrade dataset for \"%s\"\n", dname); h5tools_setstatus(EXIT_FAILURE); goto error; - } else if(verbose_g) printf("Done\n"); @@ -377,9 +399,6 @@ main(int argc, const char *argv[]) H5E_auto2_t func; void *edata; hid_t fid = -1; - hid_t fcpl = -1; - H5F_file_space_type_t strategy; - hsize_t threshold; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -429,6 +448,7 @@ main(int argc, const char *argv[]) printf("Processing the file's superblock...\n"); } + /* Process superblock */ if(H5Fformat_convert(fid) < 0) { error_msg("unable to convert file's superblock\"%s\"\n", fname_g); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/h5format_convert/testfiles/h5fc_d_file.ddl b/tools/h5format_convert/testfiles/h5fc_d_file.ddl index 3641a4f..ad7a2f4 100644 --- a/tools/h5format_convert/testfiles/h5fc_d_file.ddl +++ b/tools/h5format_convert/testfiles/h5fc_d_file.ddl @@ -9,14 +9,18 @@ usage: h5format_convert [OPTIONS] file_name Examples of use: h5format_convert -d /group/dataset file_name - Convert the chunk indexing type to version 1 B-tree - for the chunked dataset in the HDF5 file . + Convert the dataset in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert file_name - Convert the chunk indexing type to version 1 B-tree - for all the chunked datasets in the HDF5 file . + Convert all datasets in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when - converting the chunked dataset in the HDF5 file . + converting the dataset in the HDF5 file . h5format_convert error: missing file name diff --git a/tools/h5format_convert/testfiles/h5fc_dname.ddl b/tools/h5format_convert/testfiles/h5fc_dname.ddl index c391764..0de42cb 100644 --- a/tools/h5format_convert/testfiles/h5fc_dname.ddl +++ b/tools/h5format_convert/testfiles/h5fc_dname.ddl @@ -9,14 +9,18 @@ usage: h5format_convert [OPTIONS] file_name Examples of use: h5format_convert -d /group/dataset file_name - Convert the chunk indexing type to version 1 B-tree - for the chunked dataset in the HDF5 file . + Convert the dataset in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert file_name - Convert the chunk indexing type to version 1 B-tree - for all the chunked datasets in the HDF5 file . + Convert all datasets in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when - converting the chunked dataset in the HDF5 file . + converting the dataset in the HDF5 file . h5format_convert error: No dataset name diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl new file mode 100644 index 0000000..fb5192d --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 32 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_f.h5 b/tools/h5format_convert/testfiles/h5fc_ext1_f.h5 new file mode 100644 index 0000000..b5c5867 Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext1_f.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl new file mode 100644 index 0000000..2fff4ac --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_i.h5 b/tools/h5format_convert/testfiles/h5fc_ext1_i.h5 new file mode 100644 index 0000000..960a8d5 Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext1_i.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl new file mode 100644 index 0000000..fb5192d --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 32 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_s.h5 b/tools/h5format_convert/testfiles/h5fc_ext1_s.h5 new file mode 100644 index 0000000..103bde6 Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext1_s.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl new file mode 100644 index 0000000..2fff4ac --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_if.h5 b/tools/h5format_convert/testfiles/h5fc_ext2_if.h5 new file mode 100644 index 0000000..88e42e7 Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext2_if.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl new file mode 100644 index 0000000..2fff4ac --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_is.h5 b/tools/h5format_convert/testfiles/h5fc_ext2_is.h5 new file mode 100644 index 0000000..4d76436 Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext2_is.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl new file mode 100644 index 0000000..fb5192d --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 32 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_sf.h5 b/tools/h5format_convert/testfiles/h5fc_ext2_sf.h5 new file mode 100644 index 0000000..c59a3ca Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext2_sf.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl b/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl new file mode 100644 index 0000000..2fff4ac --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/h5fc_ext3_isf.h5 b/tools/h5format_convert/testfiles/h5fc_ext3_isf.h5 new file mode 100644 index 0000000..d00fc55 Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext3_isf.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_ext_none.h5 b/tools/h5format_convert/testfiles/h5fc_ext_none.h5 new file mode 100644 index 0000000..b1b1553 Binary files /dev/null and b/tools/h5format_convert/testfiles/h5fc_ext_none.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_help.ddl b/tools/h5format_convert/testfiles/h5fc_help.ddl index 9081ab8..aef8c63 100644 --- a/tools/h5format_convert/testfiles/h5fc_help.ddl +++ b/tools/h5format_convert/testfiles/h5fc_help.ddl @@ -9,13 +9,17 @@ usage: h5format_convert [OPTIONS] file_name Examples of use: h5format_convert -d /group/dataset file_name - Convert the chunk indexing type to version 1 B-tree - for the chunked dataset in the HDF5 file . + Convert the dataset in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert file_name - Convert the chunk indexing type to version 1 B-tree - for all the chunked datasets in the HDF5 file . + Convert all datasets in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when - converting the chunked dataset in the HDF5 file . + converting the dataset in the HDF5 file . diff --git a/tools/h5format_convert/testfiles/h5fc_latest_v3.h5 b/tools/h5format_convert/testfiles/h5fc_latest_v3.h5 deleted file mode 100644 index f7de743..0000000 Binary files a/tools/h5format_convert/testfiles/h5fc_latest_v3.h5 and /dev/null differ diff --git a/tools/h5format_convert/testfiles/h5fc_non_v3.h5 b/tools/h5format_convert/testfiles/h5fc_non_v3.h5 index b1bffa8..af2e8c4 100644 Binary files a/tools/h5format_convert/testfiles/h5fc_non_v3.h5 and b/tools/h5format_convert/testfiles/h5fc_non_v3.h5 differ diff --git a/tools/h5format_convert/testfiles/h5fc_nooption.ddl b/tools/h5format_convert/testfiles/h5fc_nooption.ddl index 9081ab8..aef8c63 100644 --- a/tools/h5format_convert/testfiles/h5fc_nooption.ddl +++ b/tools/h5format_convert/testfiles/h5fc_nooption.ddl @@ -9,13 +9,17 @@ usage: h5format_convert [OPTIONS] file_name Examples of use: h5format_convert -d /group/dataset file_name - Convert the chunk indexing type to version 1 B-tree - for the chunked dataset in the HDF5 file . + Convert the dataset in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert file_name - Convert the chunk indexing type to version 1 B-tree - for all the chunked datasets in the HDF5 file . + Convert all datasets in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when - converting the chunked dataset in the HDF5 file . + converting the dataset in the HDF5 file . diff --git a/tools/h5format_convert/testfiles/h5fc_v1.h5 b/tools/h5format_convert/testfiles/h5fc_v1.h5 deleted file mode 100644 index d3d66f8..0000000 Binary files a/tools/h5format_convert/testfiles/h5fc_v1.h5 and /dev/null differ diff --git a/tools/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_all.ddl index 9898faa..5e7365d 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_all.ddl @@ -1,26 +1,76 @@ Process command line options Open the file tmp.h5 Processing all datasets in the file... -Going to process dataset:/DSET_NDATA_BT1... +Going to process dataset:/DSET_CONTIGUOUS... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a contiguous dataset: downgrade layout version as needed +Converting the dataset... +Done +Close the dataset +Close the dataset creation property list +Going to process dataset:/DSET_EA... +Open the dataset +Retrieve the dataset's layout +Dataset is a chunked dataset +Retrieve the dataset's chunk indexing type +Dataset's chunk indexing type is already version 1 B-tree: no further action +Close the dataset +Close the dataset creation property list +Going to process dataset:/DSET_FA... +Open the dataset +Retrieve the dataset's layout +Dataset is a chunked dataset +Retrieve the dataset's chunk indexing type +Dataset's chunk indexing type is already version 1 B-tree: no further action +Close the dataset +Close the dataset creation property list +Going to process dataset:/DSET_NDATA_BT2... +Open the dataset +Retrieve the dataset's layout +Dataset is a chunked dataset +Retrieve the dataset's chunk indexing type +Dataset's chunk indexing type is already version 1 B-tree: no further action +Close the dataset +Close the dataset creation property list +Going to process dataset:/DSET_NONE... +Open the dataset +Retrieve the dataset's layout +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Chunk indexing type is already version 1 B-tree: no further action +Dataset's chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list -Going to process dataset:/DSET_NON_CHUNKED... +Going to process dataset:/GROUP/DSET_BT2... Open the dataset Retrieve the dataset's layout -Dataset is not chunked: no further action +Dataset is a chunked dataset +Retrieve the dataset's chunk indexing type +Dataset's chunk indexing type is already version 1 B-tree: no further action +Close the dataset +Close the dataset creation property list +Going to process dataset:/GROUP/DSET_NDATA_EA... +Open the dataset +Retrieve the dataset's layout +Dataset is a chunked dataset +Retrieve the dataset's chunk indexing type +Dataset's chunk indexing type is already version 1 B-tree: no further action +Close the dataset +Close the dataset creation property list +Going to process dataset:/GROUP/DSET_NDATA_FA... +Open the dataset +Retrieve the dataset's layout +Dataset is a chunked dataset +Retrieve the dataset's chunk indexing type +Dataset's chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list -Going to process dataset:/GROUP/DSET_BT1... +Going to process dataset:/GROUP/DSET_NDATA_NONE... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Chunk indexing type is already version 1 B-tree: no further action +Dataset's chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list Processing the file's superblock... diff --git a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl index 3bafc78..c501eb0 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl @@ -1,11 +1,11 @@ Process command line options Open the file tmp.h5 -Going to process dataset: /GROUP/DSET_BT1... +Going to process dataset: /GROUP/DSET_BT2... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Chunk indexing type is already version 1 B-tree: no further action +Dataset's chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list Processing the file's superblock... diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl index 242386d..ff5da4a 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl @@ -4,9 +4,9 @@ Open the file tmp.h5 Going to process dataset: /DSET_EA... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Verify the dataset's chunk indexing type is not version 1 B-tree +Dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl index 3dec4a6..d2ffbbf 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -2,46 +2,54 @@ Process command line options It is noop... Open the file tmp.h5 Processing all datasets in the file... +Going to process dataset:/DSET_CONTIGUOUS... +Open the dataset +Retrieve the dataset's layout +Dataset is a contiguous dataset: downgrade layout version as needed +Not converting the dataset +Close the dataset +Close the dataset creation property list Going to process dataset:/DSET_NDATA_BT2... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Verify the dataset's chunk indexing type is not version 1 B-tree +Dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list Going to process dataset:/DSET_NDATA_EA... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Verify the dataset's chunk indexing type is not version 1 B-tree +Dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list Going to process dataset:/GROUP/DSET_BT2... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Verify the dataset's chunk indexing type is not version 1 B-tree +Dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list -Going to process dataset:/GROUP/DSET_EA... +Going to process dataset:/GROUP/DSET_COMPACT... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset -Retrieve the dataset's chunk indexing type -Verify the dataset's chunk indexing type is not version 1 B-tree +Dataset is a contiguous dataset: downgrade layout version as needed Not converting the dataset Close the dataset Close the dataset creation property list -Going to process dataset:/GROUP/DSET_NON_CHUNKED... +Going to process dataset:/GROUP/DSET_EA... Open the dataset Retrieve the dataset's layout -Dataset is not chunked: no further action +Dataset is a chunked dataset +Retrieve the dataset's chunk indexing type +Dataset's chunk indexing type is not version 1 B-tree +Not converting the dataset Close the dataset Close the dataset creation property list Not processing the file's superblock... diff --git a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl index a326dc5..ba794a7 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl @@ -1,12 +1,12 @@ Process command line options It is noop... Open the file tmp.h5 -Going to process dataset: /DSET_NDATA_BT1... +Going to process dataset: /DSET_NDATA_BT2... Open the dataset Retrieve the dataset's layout -Verify the dataset is a chunked dataset +Dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Chunk indexing type is already version 1 B-tree: no further action +Dataset's chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list Not processing the file's superblock... diff --git a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl index bbc7229..aba0740 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl @@ -1,9 +1,11 @@ Process command line options Open the file tmp.h5 -Going to process dataset: /DSET_NON_CHUNKED... +Going to process dataset: /DSET_CONTIGUOUS... Open the dataset Retrieve the dataset's layout -Dataset is not chunked: no further action +Dataset is a contiguous dataset: downgrade layout version as needed +Converting the dataset... +Done Close the dataset Close the dataset creation property list Processing the file's superblock... diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl new file mode 100644 index 0000000..fb5192d --- /dev/null +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 32 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_f.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.h5 new file mode 100644 index 0000000..3cbc7f4 Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.h5 differ diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl new file mode 100644 index 0000000..c906082 --- /dev/null +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 1 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_i.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.h5 new file mode 100644 index 0000000..a2c9187 Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.h5 differ diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl new file mode 100644 index 0000000..fb5192d --- /dev/null +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 32 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_s.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.h5 new file mode 100644 index 0000000..fdf4f33 Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.h5 differ diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl new file mode 100644 index 0000000..2fff4ac --- /dev/null +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_if.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.h5 new file mode 100644 index 0000000..6bf0a2f Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.h5 differ diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl new file mode 100644 index 0000000..2fff4ac --- /dev/null +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_is.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.h5 new file mode 100644 index 0000000..c0c7ecc Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.h5 differ diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl new file mode 100644 index 0000000..fb5192d --- /dev/null +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 32 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 new file mode 100644 index 0000000..055cabf Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 differ diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl new file mode 100644 index 0000000..2fff4ac --- /dev/null +++ b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl @@ -0,0 +1,58 @@ +HDF5 "./testfiles/tmp.h5" { +SUPER_BLOCK { + SUPERBLOCK_VERSION 2 + FREELIST_VERSION 0 + SYMBOLTABLE_VERSION 0 + OBJECTHEADER_VERSION 0 + OFFSET_SIZE 8 + LENGTH_SIZE 8 + BTREE_RANK 16 + BTREE_LEAF 4 + ISTORE_K 64 + FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL + FREE_SPACE_THRESHOLD 1 + USER_BLOCK { + USERBLOCK_SIZE 0 + } +} +GROUP "/" { + DATASET "DSET_CONTIGUOUS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + } + DATASET "DSET_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + GROUP "GROUP" { + DATASET "DSET_BT2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_EA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) } + } + DATASET "DSET_NDATA_FA" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) } + } + DATASET "DSET_NDATA_NONE" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } + } + } +} +} diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 new file mode 100644 index 0000000..f4caaf4 Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 differ diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext_none.h5 b/tools/h5format_convert/testfiles/old_h5fc_ext_none.h5 new file mode 100644 index 0000000..d0bf344 Binary files /dev/null and b/tools/h5format_convert/testfiles/old_h5fc_ext_none.h5 differ diff --git a/tools/h5format_convert/testh5fc.sh.in b/tools/h5format_convert/testh5fc.sh.in index dc5aa48..f712434 100644 --- a/tools/h5format_convert/testh5fc.sh.in +++ b/tools/h5format_convert/testh5fc.sh.in @@ -41,6 +41,8 @@ RM='rm -rf' CMP='cmp -s' DIFF='diff -c' CP='cp' +H5DUMP=../h5dump/h5dump # The h5dump tool name +H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary DIRNAME='dirname' LS='ls' AWK='awk' @@ -79,10 +81,24 @@ TMPFILE=tmp.h5 # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_HDF5_TEST_FILES=" -$SRC_H5FORMCONV_TESTFILES/h5fc_v1.h5 -$SRC_H5FORMCONV_TESTFILES/h5fc_latest_v3.h5 $SRC_H5FORMCONV_TESTFILES/h5fc_non_v3.h5 $SRC_H5FORMCONV_TESTFILES/h5fc_edge_v3.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext_none.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext_none.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_i.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_s.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_f.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_if.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_is.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_sf.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_ext3_isf.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_i.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_s.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_f.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_if.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_is.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_sf.h5 +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.h5 " LIST_OTHER_TEST_FILES=" @@ -98,6 +114,20 @@ $SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_all.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_n_1d.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_n_all.ddl +$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_i.ddl +$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_s.ddl +$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_f.ddl +$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_if.ddl +$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_is.ddl +$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_sf.ddl +$SRC_H5FORMCONV_TESTFILES/h5fc_ext3_isf.ddl +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_i.ddl +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_s.ddl +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_f.ddl +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_if.ddl +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_is.ddl +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_sf.ddl +$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.ddl " # @@ -199,14 +229,7 @@ TOOLTEST_OUT() { cat $actual_err >> $actual # Compare output - if $CMP $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' - fi + COMPARE_OUT $expect $actual # Clean up output file if test -z "$HDF5_NOCLEANUP"; then @@ -243,8 +266,8 @@ CHECKING() { echo "Verifying $* $SPACES" | cut -c1-80 | tr -d '\012' } -# $1 dataset name # Assume $TESTDIR/$TMPFILE is the converted test file +# $1 dataset name IDX_CHECK() { CHECKING $1 $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPFILE $1 @@ -258,6 +281,39 @@ IDX_CHECK() { fi } +# $1 is the expected output +# $2 is the output from testing +COMPARE_OUT() { + if $CMP $1 $2; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi +} + +# Assume $TESTDIR/$TMPFILE is the converted test file +# $1 is the test file for verifying h5dump output +# $2 is the expected output from h5dump +H5DUMP_CHECK() { + CHECKING h5dump output for $1 + expect="$TESTDIR/$2" + actual="$TESTDIR/`basename $2 .ddl`.out" + actual_err="$TESTDIR/`basename $2 .ddl`.err" + $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$TMPFILE > $actual 2>$actual_err + cat $actual_err >> $actual + + # Compare output + COMPARE_OUT $expect $actual + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + $RM $actual $actual_err + fi +} + # Print a "SKIP" message SKIP() { TESTING $STAT $@ @@ -284,31 +340,31 @@ TOOLTEST_OUT h5fc_nooption.ddl '' TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5 # # -# h5format_convert -d h5fc_v1.h5 (just -d option, file exists) -# h5format_convert --dname h5fc_v1.h5 (just --dname option, file exists) +# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists) +# h5format_convert --dname old_h5fc_ext_none.h5 (just --dname option, file exists) # h5format_convert --dname (just --dname option) -# h5format_convert --dname=nonexist h5fc_v1.h5 (dataset does not exist, file exists) -TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 -d -TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 --dname +# h5format_convert --dname=nonexist old_h5fc_ext_none.h5 (dataset does not exist, file exists) +TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d +TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname TOOLTEST_OUT h5fc_dname.ddl '' --dname -TOOLTEST_OUT h5fc_nonexistdset_file.ddl h5fc_v1.h5 --dname=nonexist +TOOLTEST_OUT h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist # # # -# h5format_convert -d /DSET_NON_CHUNKED -v h5fc_v1.h5 (verbose, non-chunked dataset) -# h5format_convert -d /GROUP/DSET_BT1 --verbose h5fc_v1.h5 (verbose, bt1 dataset) -# h5format_convert -d /DSET_NDATA_BT1 -v -n h5fc_v1.h5 (verbose, noop, bt1+nodata dataset) -# h5format_convert -v h5fc_v1.h5 (verbose, all datasets) -TOOLTEST_OUT h5fc_v_non_chunked.ddl h5fc_v1.h5 -d /DSET_NON_CHUNKED -v -TOOLTEST_OUT h5fc_v_bt1.ddl h5fc_v1.h5 -d /GROUP/DSET_BT1 --verbose -TOOLTEST_OUT h5fc_v_ndata_bt1.ddl h5fc_v1.h5 -d /DSET_NDATA_BT1 -v -n -TOOLTEST_OUT h5fc_v_all.ddl h5fc_v1.h5 -v +# h5format_convert -d /DSET_CONTIGUOUS -v old_h5fc_ext_none.h5 (verbose, contiguous dataset) +# h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset) +# h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset) +# h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets) +TOOLTEST_OUT h5fc_v_non_chunked.ddl old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v +TOOLTEST_OUT h5fc_v_bt1.ddl old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose +TOOLTEST_OUT h5fc_v_ndata_bt1.ddl old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n +TOOLTEST_OUT h5fc_v_all.ddl old_h5fc_ext_none.h5 -v # # # -# h5format_convert -d /DSET_EA -v -n h5fc_latest_v3.h5 (verbose, noop, one ea dataset) +# h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset) # h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets) -TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_latest_v3.h5 -d /DSET_EA -v -n +TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_ext_none.h5 -d /DSET_EA -v -n TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n # # @@ -316,45 +372,45 @@ TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n # No output from tests # 1) Use the tool to convert the dataset # 2) Verify the chunk indexing type is correct -# h5format_convert -d /DSET_EA h5fc_latest_v3.h5 -# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_latest_v3.h5 -# h5format_convert -d /GROUP/DSET_BT2 h5fc_latest_v3.h5 -# h5format_convert -d /DSET_NDATA_BT2 h5fc_latest_v3.h5 -# h5format_convert -d /DSET_FA h5fc_latest_v3.h5 -# h5format_convert -d /GROUP/DSET_FA h5fc_latest_v3.h5 -# h5format_convert -d /DSET_NONE h5fc_latest_v3.h5 -# h5format_convert -d /GROUP/DSET_NONE h5fc_latest_v3.h5 -TOOLTEST h5fc_latest_v3.h5 -d /DSET_EA +# h5format_convert -d /DSET_EA h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_BT2 h5fc_ext_none.h5 +# h5format_convert -d /DSET_NDATA_BT2 h5fc_ext_none.h5 +# h5format_convert -d /DSET_FA h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5 +# h5format_convert -d /DSET_NONE h5fc_ext_none.h5 +# h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5 +TOOLTEST h5fc_ext_none.h5 -d /DSET_EA IDX_CHECK /DSET_EA # -TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_EA +TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_EA IDX_CHECK /GROUP/DSET_NDATA_EA # -TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_BT2 +TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_BT2 IDX_CHECK /GROUP/DSET_BT2 # -TOOLTEST h5fc_latest_v3.h5 -d /DSET_NDATA_BT2 +TOOLTEST h5fc_ext_none.h5 -d /DSET_NDATA_BT2 IDX_CHECK /DSET_NDATA_BT2 # -TOOLTEST h5fc_latest_v3.h5 -d /DSET_FA +TOOLTEST h5fc_ext_none.h5 -d /DSET_FA IDX_CHECK /DSET_FA # -TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_FA +TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_FA IDX_CHECK /GROUP/DSET_NDATA_FA # -TOOLTEST h5fc_latest_v3.h5 -d /DSET_NONE +TOOLTEST h5fc_ext_none.h5 -d /DSET_NONE IDX_CHECK /DSET_NONE # -TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_NONE +TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_NONE IDX_CHECK /GROUP/DSET_NDATA_NONE # # # # No output from tests: just check exit code -# h5format_convert -d /DSET_NDATA_BT1 h5fc_v1.h5 (v1-btree dataset) -# h5format_convert -d /GROUP/DSET_NON_CHUNKED h5fc_non_v3.h5 (non-chunked dataset) -TOOLTEST h5fc_v1.h5 -d /DSET_NDATA_BT1 -TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_NON_CHUNKED +# h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset) +# h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset) +TOOLTEST old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 +TOOLTEST h5fc_non_v3.h5 -d /DSET_CONTIGUOUS # # # @@ -386,6 +442,44 @@ TOOLTEST h5fc_edge_v3.h5 IDX_CHECK /DSET_EDGE # # + +# The following test files have messages in the superblock extension. +# Verify h5dump output for correctness after conversion +TOOLTEST h5fc_ext1_i.h5 +H5DUMP_CHECK h5fc_ext1_i.h5 h5fc_ext1_i.ddl +TOOLTEST h5fc_ext1_s.h5 +H5DUMP_CHECK h5fc_ext1_s.h5 h5fc_ext1_s.ddl +TOOLTEST h5fc_ext1_f.h5 +H5DUMP_CHECK h5fc_ext1_f.h5 h5fc_ext1_f.ddl +# +TOOLTEST h5fc_ext2_if.h5 +H5DUMP_CHECK h5fc_ext2_if.h5 h5fc_ext2_if.ddl +TOOLTEST h5fc_ext2_is.h5 +H5DUMP_CHECK h5fc_ext2_is.h5 h5fc_ext2_is.ddl +TOOLTEST h5fc_ext2_sf.h5 +H5DUMP_CHECK h5fc_ext2_sf.h5 h5fc_ext2_sf.ddl +# +TOOLTEST h5fc_ext3_isf.h5 +H5DUMP_CHECK h5fc_ext3_isf.h5 h5fc_ext3_isf.ddl +# +# +# +TOOLTEST old_h5fc_ext1_i.h5 +H5DUMP_CHECK old_h5fc_ext1_i.h5 old_h5fc_ext1_i.ddl +TOOLTEST old_h5fc_ext1_s.h5 +H5DUMP_CHECK old_h5fc_ext1_s.h5 old_h5fc_ext1_s.ddl +TOOLTEST old_h5fc_ext1_f.h5 +H5DUMP_CHECK old_h5fc_ext1_f.h5 old_h5fc_ext1_f.ddl +# +TOOLTEST old_h5fc_ext2_if.h5 +H5DUMP_CHECK old_h5fc_ext2_if.h5 old_h5fc_ext2_if.ddl +TOOLTEST old_h5fc_ext2_is.h5 +H5DUMP_CHECK old_h5fc_ext2_is.h5 old_h5fc_ext2_is.ddl +TOOLTEST old_h5fc_ext2_sf.h5 +H5DUMP_CHECK old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf.ddl +# +TOOLTEST old_h5fc_ext3_isf.h5 +H5DUMP_CHECK old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf.ddl # # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR -- cgit v0.12 From 65ba538f5b65d3768ecc94813948717b01ca6690 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 6 Feb 2016 05:52:19 -0500 Subject: [svn-r29052] Merged r28735 from HDF5 1.10.0 alpha branch. Fix for incorrect chunk size setup with array types in new chunk indices (extensible and fixed arrays, v2 B-trees) which was reported by ITER (JIRA issue SWMR-99). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 Autotools serial, parallel (MPICH 3.1.4) --- src/H5Dchunk.c | 71 +++++++++++++++++++++++----------- src/H5Dlayout.c | 112 ++++++++++++++++++++++++++++-------------------------- src/H5Dpkg.h | 1 + src/H5Olayout.c | 116 ++++++++++++++++++++++++++++---------------------------- 4 files changed, 166 insertions(+), 134 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index a3ef0e5..4a7977b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -555,6 +555,52 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__chunk_set_sizes + * + * Purpose: Sets chunk and type sizes. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * December 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__chunk_set_sizes(H5D_t *dset) +{ + uint64_t chunk_size; /* Size of chunk in bytes */ + unsigned u; /* Iterator */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(dset); + + /* Increment # of chunk dimensions, to account for datatype size as last element */ + dset->shared->layout.u.chunk.ndims++; + + /* Set the last dimension of the chunk size to the size of the datatype */ + dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(dset->shared->type); + + /* Compute and store the total size of a chunk */ + /* (Use 64-bit value to ensure that we can detect >4GB chunks) */ + for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++) + chunk_size *= (uint64_t)dset->shared->layout.u.chunk.dim[u]; + + /* Check for chunk larger than can be represented in 32-bits */ + /* (Chunk size is encoded in 32-bit value in v1 B-tree records) */ + if(chunk_size > (uint64_t)0xffffffff) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB") + + H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__chunk_set_sizes */ + + +/*------------------------------------------------------------------------- * Function: H5D__chunk_construct * * Purpose: Constructs new chunked layout information for dataset @@ -569,8 +615,6 @@ done: static herr_t H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) { - const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ - uint64_t chunk_size; /* Size of chunk in bytes */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -583,22 +627,18 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) /* Check for invalid chunk dimension rank */ if(0 == dset->shared->layout.u.chunk.ndims) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?") - - /* Set up layout information */ if(dset->shared->layout.u.chunk.ndims != dset->shared->ndims) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimensionality of chunks doesn't match the dataspace") - /* Increment # of chunk dimensions, to account for datatype size as last element */ - dset->shared->layout.u.chunk.ndims++; + /* Set chunk sizes */ + if(H5D__chunk_set_sizes(dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes") HDassert((unsigned)(dset->shared->layout.u.chunk.ndims) <= NELMTS(dset->shared->layout.u.chunk.dim)); /* Chunked storage is not compatible with external storage (currently) */ if(dset->shared->dcpl_cache.efl.nused > 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "external storage not supported with chunked layout") - /* Set the last dimension of the chunk size to the size of the datatype */ - dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(type); - /* Sanity check dimensions */ for(u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) { /* Don't allow zero-sized chunk dimensions */ @@ -614,19 +654,6 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions") } /* end for */ - /* Compute the total size of a chunk */ - /* (Use 64-bit value to ensure that we can detect >4GB chunks) */ - for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++) - chunk_size *= (uint64_t)dset->shared->layout.u.chunk.dim[u]; - - /* Check for chunk larger than can be represented in 32-bits */ - /* (Chunk size is encoded in 32-bit value in v1 B-tree records) */ - if(chunk_size > (uint64_t)0xffffffff) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB") - - /* Retain computed chunk size */ - H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t); - /* Reset address and pointer of the array struct for the chunked storage index */ if(H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index") diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 37cf2cc..293ee42 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -23,10 +23,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLprivate.h" /* Local heaps */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLprivate.h" /* Local heaps */ /****************/ @@ -61,15 +61,15 @@ /*------------------------------------------------------------------------- - * Function: H5D__layout_set_io_ops + * Function: H5D__layout_set_io_ops * - * Purpose: Set the I/O operation function pointers for a dataset, + * Purpose: Set the I/O operation function pointers for a dataset, * according to the dataset's layout * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 + * Programmer: Quincey Koziol + * Thursday, March 20, 2008 * *------------------------------------------------------------------------- */ @@ -105,7 +105,7 @@ H5D__layout_set_io_ops(const H5D_t *dataset) dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_NONE; break; - case H5D_CHUNK_IDX_SINGLE: + case H5D_CHUNK_IDX_SINGLE: dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_SINGLE; break; @@ -226,16 +226,16 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, "v1 B-tree index type found for layout message >v3") case H5D_CHUNK_IDX_NONE: - /* nothing */ + /* nothing */ break; - case H5D_CHUNK_IDX_SINGLE: - /* Possible filter information */ - if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { - ret_value += H5F_SIZEOF_SIZE(f); /* Size of chunk (in file) */ - ret_value += 4; /* Filter mask for chunk */ - } /* end if */ - break; + case H5D_CHUNK_IDX_SINGLE: + /* Possible filter information */ + if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { + ret_value += H5F_SIZEOF_SIZE(f); /* Size of chunk (in file) */ + ret_value += 4; /* Filter mask for chunk */ + } /* end if */ + break; case H5D_CHUNK_IDX_FARRAY: /* Fixed array creation parameters */ @@ -247,7 +247,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ ret_value += H5D_EARRAY_CREATE_PARAM_SIZE; break; - case H5D_CHUNK_IDX_BT2: + case H5D_CHUNK_IDX_BT2: /* v2 B-tree creation parameters */ ret_value += H5D_BT2_CREATE_PARAM_SIZE; break; @@ -282,10 +282,10 @@ done: * Function: H5D__layout_set_latest_version * * Purpose: Set the encoding for a layout to the latest version. - * Part of the coding in this routine is moved to - * H5D__layout_set_latest_indexing(). + * Part of the coding in this routine is moved to + * H5D__layout_set_latest_indexing(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, January 15, 2009 @@ -321,9 +321,9 @@ done: * Function: H5D__layout_set_latest_indexing * * Purpose: Set the latest indexing type for a layout message - * This is moved from H5D_layout_set_latest_version(). + * This is moved from H5D_layout_set_latest_version(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, January 15, 2009 @@ -353,25 +353,25 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank") ndims = (unsigned)sndims; - /* Avoid scalar/null dataspace */ - if(ndims > 0) { - hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */ - hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */ - unsigned unlim_count = 0; /* Count of unlimited max. dimensions */ - hbool_t single = TRUE; /* Fulfill single chunk indexing */ - unsigned u; /* Local index variable */ - - /* Query the dataspace's dimensions */ - if(H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions") - - /* Spin through the max. dimensions, looking for unlimited dimensions */ - for(u = 0; u < ndims; u++) { - if(max_dims[u] == H5S_UNLIMITED) - unlim_count++; - if(cur_dims[u] != max_dims[u] || cur_dims[u] != layout->u.chunk.dim[u]) - single = FALSE; - } /* end for */ + /* Avoid scalar/null dataspace */ + if(ndims > 0) { + hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */ + hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */ + unsigned unlim_count = 0; /* Count of unlimited max. dimensions */ + hbool_t single = TRUE; /* Fulfill single chunk indexing */ + unsigned u; /* Local index variable */ + + /* Query the dataspace's dimensions */ + if(H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions") + + /* Spin through the max. dimensions, looking for unlimited dimensions */ + for(u = 0; u < ndims; u++) { + if(max_dims[u] == H5S_UNLIMITED) + unlim_count++; + if(cur_dims[u] != max_dims[u] || cur_dims[u] != layout->u.chunk.dim[u]) + single = FALSE; + } /* end for */ /* Chunked datasets with unlimited dimension(s) */ if(unlim_count) { /* dataset with unlimited dimension(s) must be chunked */ @@ -407,7 +407,7 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, } /* end else */ } /* end if */ else { /* Chunked dataset with fixed dimensions */ - /* Check for correct condition for using "single chunk" chunk index */ + /* Check for correct condition for using "single chunk" chunk index */ if(single) { layout->u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE; layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE; @@ -443,15 +443,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__layout_oh_create + * Function: H5D__layout_oh_create * - * Purpose: Create layout/pline/efl information for dataset + * Purpose: Create layout/pline/efl information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ @@ -460,7 +460,7 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, hid_t dapl_id) { H5O_layout_t *layout; /* Dataset's layout information */ - const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ + const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ unsigned layout_mesg_flags; /* Flags for inserting layout message */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -589,6 +589,8 @@ herr_t H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t *plist) { htri_t msg_exists; /* Whether a particular type of message exists */ + uint64_t chunk_size; /* Size of chunk in bytes */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -645,12 +647,14 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t /* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */ if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims--; + /* Copy layout to the DCPL */ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout") - /* Adjust chunk dimensions back again (*sigh*) */ - if(H5D_CHUNKED == dataset->shared->layout.type) - dataset->shared->layout.u.chunk.ndims++; + + /* Set chunk sizes */ + if(H5D__chunk_set_sizes(dataset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 49d3461..e7a2192 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -667,6 +667,7 @@ H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hid_t dxpl_id, hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim); +H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index ca56255..5963094 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -19,19 +19,19 @@ * Purpose: Messages related to data layout. */ -#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MFprivate.h" /* File space management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Sprivate.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File space management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Sprivate.h" /* Dataspaces */ /* Local macros */ @@ -53,31 +53,31 @@ static herr_t H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id); -static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, - int indent, int fwidth); +static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, + FILE * stream, int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{ - H5O_LAYOUT_ID, /*message id number */ - "layout", /*message name for debugging */ - sizeof(H5O_layout_t), /*native message size */ - 0, /* messages are sharable? */ - H5O__layout_decode, /*decode message */ - H5O__layout_encode, /*encode message */ - H5O__layout_copy, /*copy the native value */ - H5O__layout_size, /*size of message on disk */ - H5O__layout_reset, /*reset method */ - H5O__layout_free, /*free the struct */ - H5O__layout_delete, /* file delete method */ - NULL, /* link method */ - NULL, /*set share method */ - NULL, /*can share method */ - NULL, /* pre copy native value to file */ - H5O__layout_copy_file, /* copy native value to file */ - NULL, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O__layout_debug /*debug the message */ + H5O_LAYOUT_ID, /* message id number */ + "layout", /* message name for debugging */ + sizeof(H5O_layout_t), /* native message size */ + 0, /* messages are sharable? */ + H5O__layout_decode, /* decode message */ + H5O__layout_encode, /* encode message */ + H5O__layout_copy, /* copy the native value */ + H5O__layout_size, /* size of message on disk */ + H5O__layout_reset, /* reset method */ + H5O__layout_free, /* free the struct */ + H5O__layout_delete, /* file delete method */ + NULL, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + NULL, /* pre copy native value to file */ + H5O__layout_copy_file, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__layout_debug /* debug the message */ }}; @@ -125,7 +125,7 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message") if(mesg->version < H5O_LAYOUT_VERSION_3) { - unsigned ndims; /* Num dimensions in chunk */ + unsigned ndims; /* Num dimensions in chunk */ /* Dimensionality */ ndims = *p++; @@ -297,21 +297,21 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED switch(mesg->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "v1 B-tree index type should never be in a v4 layout message") - break; + break; - case H5D_CHUNK_IDX_NONE: /* Implicit Index */ + case H5D_CHUNK_IDX_NONE: /* Implicit Index */ mesg->storage.u.chunk.ops = H5D_COPS_NONE; - break; + break; - case H5D_CHUNK_IDX_SINGLE: /* Single Chunk Index */ - if(mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { + case H5D_CHUNK_IDX_SINGLE: /* Single Chunk Index */ + if(mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { H5F_DECODE_LENGTH(f, p, mesg->storage.u.chunk.u.single.nbytes); UINT32DECODE(p, mesg->storage.u.chunk.u.single.filter_mask); } /* end if */ /* Set the chunk operations */ mesg->storage.u.chunk.ops = H5D_COPS_SINGLE; - break; + break; case H5D_CHUNK_IDX_FARRAY: /* Fixed array creation parameters */ @@ -345,8 +345,8 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED mesg->storage.u.chunk.ops = H5D_COPS_EARRAY; break; - case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */ - UINT32DECODE(p, mesg->u.chunk.u.btree2.cparam.node_size); + case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */ + UINT32DECODE(p, mesg->u.chunk.u.btree2.cparam.node_size); mesg->u.chunk.u.btree2.cparam.split_percent = *p++; mesg->u.chunk.u.btree2.cparam.merge_percent = *p++; @@ -633,15 +633,15 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "v1 B-tree index type should never be in a v4 layout message") break; - case H5D_CHUNK_IDX_NONE: /* Implicit */ + case H5D_CHUNK_IDX_NONE: /* Implicit */ break; - case H5D_CHUNK_IDX_SINGLE: /* Single Chunk */ - /* Filter information */ - if(mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { - H5F_ENCODE_LENGTH(f, p, mesg->storage.u.chunk.u.single.nbytes); - UINT32ENCODE(p, mesg->storage.u.chunk.u.single.filter_mask); - } /* end if */ + case H5D_CHUNK_IDX_SINGLE: /* Single Chunk */ + /* Filter information */ + if(mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { + H5F_ENCODE_LENGTH(f, p, mesg->storage.u.chunk.u.single.nbytes); + UINT32ENCODE(p, mesg->storage.u.chunk.u.single.filter_mask); + } /* end if */ break; case H5D_CHUNK_IDX_FARRAY: @@ -658,8 +658,8 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, *p++ = mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits; break; - case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */ - UINT32ENCODE(p, mesg->u.chunk.u.btree2.cparam.node_size); + case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */ + UINT32ENCODE(p, mesg->u.chunk.u.btree2.cparam.node_size); *p++ = mesg->u.chunk.u.btree2.cparam.split_percent; *p++ = mesg->u.chunk.u.btree2.cparam.merge_percent; break; @@ -669,7 +669,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid chunk index type") } /* end switch */ - /* + /* * Implicit index: Address of the chunks * Single chunk index: address of the single chunk * Other indexes: chunk index address @@ -918,14 +918,14 @@ H5O__layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo /*------------------------------------------------------------------------- - * Function: H5O__layout_reset + * Function: H5O__layout_reset * - * Purpose: Frees resources within a data type message, but doesn't free - * the message itself. + * Purpose: Frees resources within a data type message, but doesn't free + * the message itself. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, September 13, 2002 * *------------------------------------------------------------------------- @@ -1205,7 +1205,7 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const v "Index Type:", "Implicit"); break; - case H5D_CHUNK_IDX_SINGLE: + case H5D_CHUNK_IDX_SINGLE: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Single Chunk"); break; @@ -1222,7 +1222,7 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const v /* (Should print the extensible array creation parameters) */ break; - case H5D_CHUNK_IDX_BT2: + case H5D_CHUNK_IDX_BT2: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v2 B-tree"); /* (Should print the v2-Btree creation parameters) */ -- cgit v0.12 From 363e419340101c984f1f7b133df81776c4e3ed4f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 6 Feb 2016 12:45:22 -0500 Subject: [svn-r29054] Description: Correct error computing the number of bytes to encode dimensions with when using "latest format" by including the datatype's size in the computation. Tested on: Mac OSX/64 10.11.3 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Dchunk.c | 17 +++++++++++++++++ src/H5Pdcpl.c | 13 ------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4a7977b..612b419 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -570,11 +570,13 @@ herr_t H5D__chunk_set_sizes(H5D_t *dset) { uint64_t chunk_size; /* Size of chunk in bytes */ + unsigned max_enc_bytes_per_dim; /* Max. number of bytes required to encode this dimension */ unsigned u; /* Iterator */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity checks */ HDassert(dset); /* Increment # of chunk dimensions, to account for datatype size as last element */ @@ -583,6 +585,21 @@ H5D__chunk_set_sizes(H5D_t *dset) /* Set the last dimension of the chunk size to the size of the datatype */ dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(dset->shared->type); + /* Compute number of bytes to use for encoding chunk dimensions */ + max_enc_bytes_per_dim = 0; + for(u = 0; u < (unsigned)dset->shared->layout.u.chunk.ndims; u++) { + unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */ + + /* Get encoded size of dim, in bytes */ + enc_bytes_per_dim = (H5VM_log2_gen(dset->shared->layout.u.chunk.dim[u]) + 8) / 8; + + /* Check if this is the largest value so far */ + if(enc_bytes_per_dim > max_enc_bytes_per_dim) + max_enc_bytes_per_dim = enc_bytes_per_dim; + } /* end for */ + HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8); + dset->shared->layout.u.chunk.enc_bytes_per_dim = max_enc_bytes_per_dim; + /* Compute and store the total size of a chunk */ /* (Use 64-bit value to ensure that we can detect >4GB chunks) */ for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 44872ba..5836bf0 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1998,7 +1998,6 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) H5P_genplist_t *plist; /* Property list pointer */ H5O_layout_t chunk_layout; /* Layout information for setting chunk info */ uint64_t chunk_nelmts; /* Number of elements in chunk */ - unsigned max_enc_bytes_per_dim; /* Max. number of bytes required to encode this dimension */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2026,10 +2025,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) HDmemcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g)); HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim)); chunk_nelmts = 1; - max_enc_bytes_per_dim = 0; for(u = 0; u < (unsigned)ndims; u++) { - unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */ - if(dim[u] == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive") if(dim[u] != (dim[u] & 0xffffffff)) @@ -2038,16 +2034,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) if(chunk_nelmts > (uint64_t)0xffffffff) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of elements in chunk must be < 4GB") chunk_layout.u.chunk.dim[u] = (uint32_t)dim[u]; /* Store user's chunk dimensions */ - - /* Get encoded size of dim, in bytes */ - enc_bytes_per_dim = (H5VM_log2_gen(dim[u]) + 8) / 8; - - /* Check if this is the largest value so far */ - if(enc_bytes_per_dim > max_enc_bytes_per_dim) - max_enc_bytes_per_dim = enc_bytes_per_dim; } /* end for */ - HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8); - chunk_layout.u.chunk.enc_bytes_per_dim = max_enc_bytes_per_dim; /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) -- cgit v0.12 From 5f5b8a2e9dbeed4c19da8f4a37aa7354dcbed65b Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 8 Feb 2016 14:13:52 -0500 Subject: [svn-r29064] Update MANIFEST due to checkin #29048 to revise_chunks. Tested on jam, moohan, osx1010test. --- MANIFEST | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/MANIFEST b/MANIFEST index 9882fb1..0cbdda3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1284,9 +1284,37 @@ ./tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl ./tools/h5format_convert/testfiles/h5fc_nonexistfile.ddl ./tools/h5format_convert/testfiles/h5fc_non_v3.h5 -./tools/h5format_convert/testfiles/h5fc_latest_v3.h5 ./tools/h5format_convert/testfiles/h5fc_edge_v3.h5 -./tools/h5format_convert/testfiles/h5fc_v1.h5 +./tools/h5format_convert/testfiles/h5fc_ext1_f.h5 +./tools/h5format_convert/testfiles/h5fc_ext1_i.h5 +./tools/h5format_convert/testfiles/h5fc_ext1_s.h5 +./tools/h5format_convert/testfiles/h5fc_ext2_if.h5 +./tools/h5format_convert/testfiles/h5fc_ext2_is.h5 +./tools/h5format_convert/testfiles/h5fc_ext2_sf.h5 +./tools/h5format_convert/testfiles/h5fc_ext3_isf.h5 +./tools/h5format_convert/testfiles/h5fc_ext_none.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext1_f.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext1_i.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext1_s.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext2_if.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext2_is.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 +./tools/h5format_convert/testfiles/old_h5fc_ext_none.h5 +./tools/h5format_convert/testfiles/h5fc_ext1_f.ddl +./tools/h5format_convert/testfiles/h5fc_ext1_i.ddl +./tools/h5format_convert/testfiles/h5fc_ext1_s.ddl +./tools/h5format_convert/testfiles/h5fc_ext2_if.ddl +./tools/h5format_convert/testfiles/h5fc_ext2_is.ddl +./tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl +./tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl +./tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl +./tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl +./tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl +./tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl +./tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl +./tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl +./tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl ./tools/h5format_convert/testh5fc.sh.in # h5repack sources -- cgit v0.12 From 4ba33c06209525970d4dcd6732607a85e28dcc68 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 8 Feb 2016 18:48:24 -0500 Subject: [svn-r29068] Minor clean up of mixed tabs and spaces in testswmr.sh.in. Tested on: Local linux VM (testswmr.sh only) --- test/testswmr.sh.in | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index 75d9bda..32f80ff 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -161,7 +161,7 @@ do echo "## Use H5Fstart_swmr_write() to enable SWMR writing mode" echo "###############################################################################" - # Remove any possible writer message file before launching writer + # Remove any possible writer message file before launching writer rm -f $WRITER_MESSAGE # # Launch the Writer @@ -170,7 +170,7 @@ do ./swmr_start_write $compress $index_type $Nrecords $seed & pid_writer=$! $DPRINT pid_writer=$pid_writer - # + # Wait for message from writer process before starting reader(s) WAIT_MESSAGE $WRITER_MESSAGE @@ -228,7 +228,8 @@ do echo generator had error nerrors=`expr $nerrors + 1` fi - # Remove any possible writer message file before launching writer + + # Remove any possible writer message file before launching writer rm -f $WRITER_MESSAGE # # Launch the Writer @@ -237,7 +238,7 @@ do ./swmr_writer -o $Nrecords $seed & pid_writer=$! $DPRINT pid_writer=$pid_writer - # + # Wait for message from writer process before starting reader(s) WAIT_MESSAGE $WRITER_MESSAGE # @@ -286,7 +287,7 @@ do echo "###############################################################################" echo "## Remove test - test shrinking the dataset" echo "###############################################################################" - # + # Remove any possible writer message file before launching writer rm -f $WRITER_MESSAGE # Launch the Remove Writer @@ -295,7 +296,7 @@ do ./swmr_remove_writer -o $Nrecs_rem $seed & pid_writer=$! $DPRINT pid_writer=$pid_writer - # + # Wait for message from writer process before starting reader(s) WAIT_MESSAGE $WRITER_MESSAGE # @@ -361,7 +362,7 @@ do echo writer had error nerrors=`expr $nerrors + 1` fi - # + # Remove any possible writer message file before launching writer rm -f $WRITER_MESSAGE # @@ -371,7 +372,7 @@ do ./swmr_addrem_writer $Nrecords $seed & pid_writer=$! $DPRINT pid_writer=$pid_writer - # + # Wait for message from writer process before starting reader(s) WAIT_MESSAGE $WRITER_MESSAGE # @@ -431,7 +432,7 @@ do echo generator had error nerrors=`expr $nerrors + 1` fi - # + # Remove any possible writer message file before launching writer rm -f $WRITER_MESSAGE # Launch the Sparse writer @@ -439,7 +440,7 @@ do nice -n 20 ./swmr_sparse_writer $Nrecs_spa & pid_writer=$! $DPRINT pid_writer=$pid_writer - # + # Wait for message from writer process before starting reader(s) WAIT_MESSAGE $WRITER_MESSAGE # @@ -495,3 +496,4 @@ else echo "SWMR tests failed with $nerrors errors." exit 1 fi + -- cgit v0.12 From 6c60f4f78cf310959ca05fbddea9a1c3f876c583 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 12 Feb 2016 15:05:14 -0500 Subject: [svn-r29099] Merged r29094 from trunk. Fixes H5B slowdown. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial CMake serial --- configure.ac | 7 ++++++- src/CMakeLists.txt | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index de8a348..a85b0fe 100644 --- a/configure.ac +++ b/configure.ac @@ -2125,8 +2125,13 @@ AC_SUBST([INTERNAL_DEBUG_OUTPUT]) ## These are all the packages that use H5*_DEBUG. ## There is no harm in specifying a package not in this list; ## you'll just get an unused H5_DEBUG symbol. +## +## Some packages that define debug checks or output are +## too specialized or have huge performance hits. These +## are not listed in the "all" packages list. +## ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -all_packages="AC,B,B2,D,F,HL,I,O,S,ST,T,Z" +all_packages="AC,B2,D,F,HL,I,O,S,ST,T,Z" case "X-$INTERNAL_DEBUG_OUTPUT" in X-yes|X-all) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca71fca..6af2b9a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -872,7 +872,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS - "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5B_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" ) endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) @@ -924,7 +924,7 @@ if (BUILD_SHARED_LIBS) if (HDF5_ENABLE_DEBUG_APIS) set_property (TARGET ${HDF5_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS - "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" ) endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) -- cgit v0.12 From 4e7c243a4425cbfa26991696d108d75b29e96d49 Mon Sep 17 00:00:00 2001 From: John Mainzer Date: Sat, 13 Feb 2016 22:31:15 -0500 Subject: [svn-r29103] Checkin of test code for fix of HDFFV-9672. Tested: jam serial/debug mercury serial/debug, parallel/debug --- test/dsets.c | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 276 insertions(+) diff --git a/test/dsets.c b/test/dsets.c index 4b7123d..2996d3b 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -66,6 +66,7 @@ const char *FILENAME[] = { "earray_hdr_fd", /* 19 */ "farray_hdr_fd", /* 20 */ "bt2_hdr_fd", /* 21 */ + "dls_01_strings.h5",/* 22 */ /* used by dls_01 test only */ NULL }; #define FILENAME_BUF_SIZE 1024 @@ -11766,6 +11767,278 @@ error: return -1; } /* end test_gather_error() */ +/*------------------------------------------------------------------------- + * DLS bug -- HDFFV-9672 + * + * The following functions replicate the test code provided by DLS to + * expose bug hdffv-9672. All functions associated with this test + * have the prefix DLS_01_ + * + * The note documenting the bug is reproduced below: + * + * ------------------------------------------------------ + * + * Hi, + * We've found an issue regarding fixed length strings. + * + * If we create a chunked dataset of large fixed length strings + * (up to 1kb per string) with small chunk sizes (~8 elements per + * chunk) then the resulting dataset may not be read later. + * This only happens if the file is created with LIBVER_LATEST + * for the version bounds. + * + * Calling H5Oget_info(...) on the dataset results in the following: + * + * H5Dearray.c:250: H5D__earray_crt_context: Assertion + * `udata->chunk_size > 0' failed. + * + * Example: + * void create_data(...) + * { + * ... + * + * hsize_t chunks[1] = {8} ; + * + * err = H5Tset_size( tid, 256 ); + * + * err = H5Pset_chunk( dcpl, 1, chunks ); + * + * H5Dcreate2( fid, "data", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT ); + * + * // write data + * } + * + * void read_data(...) + * { + * ... + * + * H5O_into_t info; status = H5Oget_info( did, &info ) // crash + * ... + * } + * + * If the size of the chunk is increased (usually matching the + * string length) then this problem disappears. + * + * A full program that produces such a file (and crashes trying to + * read it) is attached. + * + * Tested with 1.10.0-alpha1. + * + * Regards, + * + * Charles Mita + * Software Engineer + * Diamond Light Source Ltd. + * +44 1235 778029 + * + * ------------------------------------------------------ + * + * The bug in question turned out to be caused by a failure to update + * the enc_bytes_per_dim field in the layout if the size of the + * underlying type required more bytes to encode than any of the + * chunk dimensions. + * + * At least in debug builds, the following test code exposes the + * failure via an assertion failure. + * + * Note that the test code make no attempt to run with different + * file drivers, as the bug is in the actual on disk encoding of + * the chunk layout. + * + * JRM -- 2/5/16 + * + *------------------------------------------------------------------------- + */ + +#define DLS_01_DATASET "data" +#define DLS_01_STR_SIZE 256 +#define DLS_01_CHUNK_SIZE 8 +#define DLS_01_DIMS 4 + +static herr_t dls_01_setup_file( hid_t fid ); +static herr_t dls_01_write_data( hid_t fid, char* buffer ); +static herr_t dls_01_read_stuff( hid_t fid ); +static herr_t dls_01_main( void ); + +static herr_t +dls_01_setup_file( hid_t fid ) { + + int status = 0; + hid_t sid = 0, did = 0, tid = 0, dcpl = 0; + int ndims = 1; + hsize_t max_shape[1] = {H5S_UNLIMITED}; + hsize_t initial_shape[1] = {0}; + hsize_t chunks[1] = {DLS_01_CHUNK_SIZE}; + + sid = H5Screate_simple( ndims, initial_shape, max_shape ); + if ( sid <= 0 ) TEST_ERROR + + tid = H5Tcopy( H5T_C_S1 ); + if ( tid <= 0 ) TEST_ERROR + + status = H5Tset_size( tid, DLS_01_STR_SIZE ); + if ( status != 0 ) TEST_ERROR + + dcpl = H5Pcreate( H5P_DATASET_CREATE ); + if ( dcpl <= 0 ) TEST_ERROR + + status = H5Pset_chunk( dcpl, ndims, chunks ); + if ( status != 0 ) TEST_ERROR + + did = H5Dcreate2( fid, DLS_01_DATASET, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT ); + if ( did <= 0 ) TEST_ERROR + + status = H5Dclose( did ); + if ( status != 0 ) TEST_ERROR + + status = H5Pclose( dcpl ); + if ( status != 0 ) TEST_ERROR + + status = H5Tclose( tid ); + if ( status != 0 ) TEST_ERROR + + status = H5Sclose( sid ); + if ( status != 0 ) TEST_ERROR + + return 0; + +error: + + return -1; + +} /* dls_01_setup_file */ + +static herr_t +dls_01_write_data( hid_t fid, char* buffer ) { + + int status = 0; + hid_t did = 0, tid = 0; + hsize_t extent[1] = {4}; + + did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT ); + if ( did <= 0 ) TEST_ERROR + + tid = H5Dget_type( did ); + if ( tid <= 0 ) TEST_ERROR + + status = H5Dset_extent( did, extent ); + if ( status != 0 ) TEST_ERROR + + status = H5Dwrite( did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer ); + if ( status != 0 ) TEST_ERROR + + status = H5Fflush( fid, H5F_SCOPE_LOCAL ); + if ( status != 0 ) TEST_ERROR + + status = H5Tclose( tid ); + if ( status != 0 ) TEST_ERROR + + status = H5Dclose( did ); + if ( status != 0 ) TEST_ERROR + + return 0; + +error: + + return -1; + +} /* dls_01_write_data */ + +static herr_t +dls_01_read_stuff( hid_t fid ) { + + int status = 0; + hid_t did = 0; + H5O_info_t info; + + did = H5Dopen( fid, DLS_01_DATASET, H5P_DEFAULT ); + if ( did <= 0 ) TEST_ERROR + + status = H5Oget_info( did, &info ); + if ( status != 0 ) TEST_ERROR + + status = H5Dclose( did ); + if ( status != 0 ) TEST_ERROR + + return 0; + +error: + + return -1; + +} /* dls_01_read_stuff() */ + +static herr_t +dls_01_main( void ) { + + char filename[512]; + int status = 0; + hid_t fapl = 0, fid = 0; + const char* strings[DLS_01_DIMS] = + { "String 1", "Test string 2", "Another string", "Final String" }; + char* buffer = NULL; + + TESTING("Testing DLS bugfix 1"); + + if ( NULL == h5_fixname(FILENAME[22], H5P_DEFAULT, filename, + sizeof(filename)) ) + TEST_ERROR + + buffer = (char *)HDcalloc( DLS_01_DIMS, DLS_01_STR_SIZE ); + if ( NULL == buffer ) + TEST_ERROR + + HDstrcpy( buffer, strings[0] ); + HDstrcpy( buffer + DLS_01_STR_SIZE, strings[1] ); + HDstrcpy( buffer + DLS_01_STR_SIZE * 2, strings[2] ); + HDstrcpy( buffer + DLS_01_STR_SIZE * 3, strings[3] ); + + fapl = H5Pcreate( H5P_FILE_ACCESS ); + if ( fapl <= 0 ) TEST_ERROR + + status = H5Pset_libver_bounds( fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST ); + if ( status != 0 ) TEST_ERROR + + fid = H5Fcreate( filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ); + if ( fid <= 0 ) TEST_ERROR + + if ( 0 != dls_01_setup_file( fid ) ) + goto error; + + if ( 0 != dls_01_write_data( fid, buffer ) ) + goto error; + + status = H5Fclose( fid ); + if ( status != 0 ) TEST_ERROR + + fid = H5Fopen( filename, H5F_ACC_RDONLY, fapl ); + if ( fid <= 0 ) TEST_ERROR + + if ( 0 != dls_01_read_stuff( fid ) ) + goto error; + + status = H5Fclose( fid ); + if ( status != 0 ) TEST_ERROR + + status = H5Pclose( fapl ); + if ( status != 0 ) TEST_ERROR + + HDfree(buffer); + + PASSED(); + + return 0; + +error: + + if ( buffer ) HDfree(buffer); + + return -1; + +} /* dls_01_main() */ + + + /*------------------------------------------------------------------------- * Function: main @@ -11920,6 +12193,9 @@ main(void) nerrors += (test_scatter_error() < 0 ? 1 : 0); nerrors += (test_gather_error() < 0 ? 1 : 0); + /* Run misc tests */ + nerrors += dls_01_main(); + /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); -- cgit v0.12 From 9490d3aff473266c19c3ef24dd75576032376a30 Mon Sep 17 00:00:00 2001 From: John Mainzer Date: Mon, 15 Feb 2016 05:13:35 -0500 Subject: [svn-r29114] Updated test code of HDFFV-9672 to correct error exposed by builds with the --with-default-api-version=v16 configure option. Tested on Mercury (serial/debug & serial/debug/v16_api) Jam (serial/debug) NOTE: In the serial/debug test on Mercury, I encountered the following assertion failure in testh5watch.sh: H5Fsfile.c:63: H5F_sfile_assert_num: Assertion `H5F_sfile_head_g == ((void *)0)' failed. As this was clearly unrelated to my change, I went ahead with the checkin. --- test/dsets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dsets.c b/test/dsets.c index 2996d3b..e06d81d 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -11951,7 +11951,7 @@ dls_01_read_stuff( hid_t fid ) { hid_t did = 0; H5O_info_t info; - did = H5Dopen( fid, DLS_01_DATASET, H5P_DEFAULT ); + did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT ); if ( did <= 0 ) TEST_ERROR status = H5Oget_info( did, &info ); -- cgit v0.12 From c4ef0b65a0499e33e88ef51129f2376e0ac8a072 Mon Sep 17 00:00:00 2001 From: John Mainzer Date: Wed, 17 Feb 2016 06:47:45 -0500 Subject: [svn-r29136] Added code to main routine of objcopy to close the FAPL fapl2 shortly before exit. This in turn hides the property list management failure that is otherwise expressed on library shutdown when run with either the split or multi file drivers. Needless to say, this is a bandaid. The actual cause of the problem must be found and dealt with. Tested on Jam -- serial/debug/check-vfd --- test/objcopy.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/objcopy.c b/test/objcopy.c index 7ee6196..f4b6a3e 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -13595,6 +13595,16 @@ main(void) puts ("All object copying tests passed."); + /* call H5Pclose(fapl2) to mask property list management bug. + * + * Needless to say, this bug must be fixed properly, but we + * will sweep it under the rug for now. + * + * To expose the bug, delete this call, and run with either split + * or multi file driver. + */ + H5Pclose(fapl2); + h5_cleanup(FILENAME, fapl); return 0; -- cgit v0.12 From 26e52066be1a09d4fb8cf041a1cfacfc09edc6d3 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 18 Feb 2016 10:44:39 -0500 Subject: [svn-r29146] Merged autotools changes from the trunk: r29050, 29090, 29127, 29129, 29131, 29134, 29139, 29142 Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial (debug/release w/ C++ & Fortran) autotools parallel (MPICH 3.1.2, debug w/ Fortran) --- config/cce-fflags | 6 +-- config/cce-flags | 10 ++--- config/gnu-cxxflags | 36 ++++++++++++--- config/gnu-fflags | 3 +- config/gnu-flags | 6 +-- config/i686-pc-cygwin | 22 ++++++++-- config/ibm-aix | 49 +++++++++++++++++---- config/ibm-flags | 6 +-- config/intel-fflags | 1 + config/intel-flags | 7 +-- config/linux-gnulibc1 | 24 ++++++++-- config/pgi-fflags | 3 +- config/pgi-flags | 12 ++--- config/solaris | 91 +++++++++++++++++++++++++++++--------- config/x86_64-pc-cygwin | 23 ++++++++-- configure.ac | 114 ++++++++++++++++++++++++++---------------------- 16 files changed, 283 insertions(+), 130 deletions(-) diff --git a/config/cce-fflags b/config/cce-fflags index b96551d..233f9ff 100644 --- a/config/cce-fflags +++ b/config/cce-fflags @@ -52,15 +52,15 @@ if test "X-cce" = "X-$f9x_vendor"; then H5_FCFLAGS="${H5_FCFLAGS} -hnocaf" # Production - # -Wl,-s to remove all symbols for smaller file - # Note that this will likely override the symbols flag - PROD_FCFLAGS="-Wl,-s" + PROD_FCFLAGS= # Debug DEBUG_FCFLAGS= # Symbols + # -Wl,-s to remove all symbols for smaller file SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-Wl,-s" # Profiling # Use this for profiling with gprof diff --git a/config/cce-flags b/config/cce-flags index e479363..8f3b2dc 100644 --- a/config/cce-flags +++ b/config/cce-flags @@ -54,23 +54,20 @@ if test "X-cce" = "X-$cc_vendor"; then H5_CFLAGS="${H5_CFLAGS:--hc99 $arch}" # Production - # -Wl,-s to remove all symbols for smaller file - PROD_CFLAGS="-Wl,-s" - PROD_CPPFLAGS= + PROD_CFLAGS= # Debug # NDEBUG is handled explicitly in configure DEBUG_CFLAGS= - DEBUG_CPPFLAGS= # Symbols + # -Wl,-s to remove all symbols for smaller file SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS="-Wl,-s" # Profiling # Use this for profiling with gprof PROFILE_CFLAGS="-p" - PROFILE_CPPFLAGS= # Optimization HIGH_OPT_CFLAGS="-O3" @@ -87,3 +84,4 @@ if test "X-$cc_flags_set" = "X-"; then cc_vendor= cc_version= fi + diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index ee690db..8d1ca67 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -100,30 +100,54 @@ case "$cxx_vendor-$cxx_version" in H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-promo -Woverloaded-virtual -Wold-style-cast -Weffc++ -Wreorder -Wnon-virtual-dtor -Wctor-dtor-privacy -Wabi" # Production + # NDEBUG is handled explicitly by the configure script case "$cxx_vendor-$cxx_version" in g++-[34].*) - PROD_CXXFLAGS="-O3" + PROD_CXXFLAGS= ;; g++-5.*) - PROD_CXXFLAGS="-O3 -fstdarg-opt" + PROD_CXXFLAGS="-fstdarg-opt" ;; *) - PROD_CXXFLAGS="-O -finline-functions" + PROD_CXXFLAGS="-finline-functions" ;; esac # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags case "$cxx_vendor-$cxx_version" in g++-5.*) - DEBUG_CXXFLAGS="-Og -g -ftrapv -fno-common" + DEBUG_CXXFLAGS="-ftrapv -fno-common" ;; *) - DEBUG_CXXFLAGS="-g" + DEBUG_CXXFLAGS= ;; esac + # Symbols + NO_SYMBOLS_CXXFLAGS="-s" + SYMBOLS_CXXFLAGS="-g" + # Profile - PROFILE_CXXFLAGS="-Og -g -pg" + PROFILE_CXXFLAGS="-pg" + + # Optimization + case "$cxx_vendor-$cxx_version" in + g++-[34].*) + HIGH_OPT_CXXFLAGS="-O3" + DEBUG_OPT_CXXFLAGS= + ;; + g++-5.*) + HIGH_OPT_CXXFLAGS="-O3" + DEBUG_OPT_CXXFLAGS="-Og" + ;; + *) + HIGH_OPT_CXXFLAGS="-O" + DEBUG_OPT_CXXFLAGS= + ;; + esac + NO_OPT_CXXFLAGS="-O0" # Flags are set cxx_flags_set=yes diff --git a/config/gnu-fflags b/config/gnu-fflags index 3a90c10..62498a9 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -83,13 +83,14 @@ if test "X-gfortran" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" # Production - PROD_FCFLAGS="-s" + PROD_FCFLAGS= # Debug DEBUG_FCFLAGS="-fbounds-check" # Symbols SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" # Profiling PROFILE_FCFLAGS="-pg" diff --git a/config/gnu-flags b/config/gnu-flags index ecb5859..87aef3a 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -124,17 +124,15 @@ case "$cc_vendor-$cc_version" in ;; esac #DEBUG_CFLAGS="-fsanitize=undefined" - DEBUG_CPPFLAGS= # Symbols + NO_SYMBOLS_CFLAGS="-s" SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= # Profile PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= - # Optimization (only CFLAGS at this time) + # Optimization case "$cc_vendor-$cc_version" in gcc-[34].*) HIGH_OPT_CFLAGS="-O3" diff --git a/config/i686-pc-cygwin b/config/i686-pc-cygwin index 9b1ab74..7355e4a 100644 --- a/config/i686-pc-cygwin +++ b/config/i686-pc-cygwin @@ -104,9 +104,25 @@ case $FC_BASENAME in # (just in case since this should be a default EIP) H5_FCFLAGS="$H5_FCFLAGS -YEXT_NAMES=UCS" FSEARCH_DIRS="" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes ;; diff --git a/config/ibm-aix b/config/ibm-aix index 28498e2..ef052fb 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -59,9 +59,25 @@ if test "X-" = "X-$f9x_flags_set"; then FCFLAGS="$FCFLAGS ${F9XSUFFIXFLAG}" H5_FCFLAGS="$H5_FCFLAGS ${F9XSUFFIXFLAG}" FSEARCH_DIRS="-I./ -I../src" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Produciton + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS= + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes fi @@ -91,13 +107,30 @@ case $CC_BASENAME in ;; *) + # Undetermined compiler + # Use very generic flags H5_CFLAGS="$H5_CFLAGS -ansi" - DEBUG_CFLAGS="-g" - DEBUG_CPPFLAGS= - PROD_CFLAGS="-O" - PROD_CPPFLAGS= + + # Produciton + PROD_CFLAGS= + + # Debug + DEBUG_CFLAGS= + + # Symbols + SYMBOLS_CFLAGS="-g" + NO_SYMBOLS_CFLAGS= + + # Profiling PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= + + # Optimization + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + + # Flags are set + cc_flags_set=yes ;; esac diff --git a/config/ibm-flags b/config/ibm-flags index 60a7af9..412817c 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -66,20 +66,17 @@ if test "XL" = "$cc_vendor"; then # Produciton PROD_CFLAGS= - PROD_CPPFLAGS= # Debug # NDEBUG is handled explicitly in configure DEBUG_CFLAGS="-qfullpath" - DEBUG_CPPFLAGS= # Symbols SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS= # Profiling PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= # Optimization # -O causes test/dtypes to fail badly. Turn it off for now. @@ -125,3 +122,4 @@ if test X != X$CXX; then fi fi + diff --git a/config/intel-fflags b/config/intel-fflags index 1f7cf78..db9543e 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -80,6 +80,7 @@ if test "X-ifort" = "X-$f9x_vendor"; then # Symbols SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS= # Profiling # Use this for profiling with gprof diff --git a/config/intel-flags b/config/intel-flags index 060e78a..fe7b06d 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -70,23 +70,20 @@ if test "X-icc" = "X-$cc_vendor"; then # Default to C99 standard. H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch} -Wcheck -Wall" - # Production is set to default; see settings for specific version further down + # Production PROD_CFLAGS= - PROD_CPPFLAGS= # Debug # NDEBUG is handled explicitly in configure DEBUG_CFLAGS= - DEBUG_CPPFLAGS= # Symbols SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS= # Profiling # Use this for profiling with gprof PROFILE_CFLAGS="-p" - PROFILE_CPPFLAGS= # Optimization HIGH_OPT_CFLAGS="-O" diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 46771dc..5bea816 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -117,9 +117,25 @@ case $FC_BASENAME in # (just in case since this should be a default EIP) H5_FCFLAGS="$H5_FCFLAGS" FSEARCH_DIRS="" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes ;; @@ -183,7 +199,7 @@ case $FC in *mpif90*) fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ - sed ’s/\”/\\\”/g’ |\ + sed 's/\"/\\\"/g' |\ sed 's/^\([a-z]* \)/ built with \1/1'` fc_version_info=`echo $fc_version_info` ;; diff --git a/config/pgi-fflags b/config/pgi-fflags index fbcba52..08dfe6e 100644 --- a/config/pgi-fflags +++ b/config/pgi-fflags @@ -84,13 +84,14 @@ if test "X-pgf90" = "X-$f9x_vendor"; then #else # PROD_FCFLAGS="-O2 -s" #fi - PROD_FCFLAGS="-fast -s -Mnoframe" + PROD_FCFLAGS="-fast -Mnoframe" # Debug DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk" # Symbols SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" # Profiling PROFILE_FCFLAGS="-Mprof=func,line" diff --git a/config/pgi-flags b/config/pgi-flags index a6dcba3..f6878e6 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -73,31 +73,28 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Production case "$cc_vendor-$cc_version" in pgcc-10.6*) - PROD_CFLAGS="-s" + PROD_CFLAGS= ;; pgcc-9.*) - PROD_CFLAGS="-s" + PROD_CFLAGS= ;; *) - PROD_CFLAGS="-fast -s" + PROD_CFLAGS="-fast" ;; esac - PROD_CPPFLAGS= # Debug # NDEBUG is handled explicitly by the configure script DEBUG_CFLAGS="-Mbounds" - DEBUG_CPPFLAGS= # Symbols SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS="-s" # Profiling PROFILE_CFLAGS="-Mprof=func,line" # Use this for profiling with gprof #PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= # Optimization case "$cc_vendor-$cc_version" in @@ -118,7 +115,6 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Flags are set cc_flags_set=yes - fi # Clear cc info if no flags set diff --git a/config/solaris b/config/solaris index 310c373..72d7423 100644 --- a/config/solaris +++ b/config/solaris @@ -32,16 +32,32 @@ fi # Try solaris native compiler flags if test "X-" = "X-$cc_flags_set"; then H5_CFLAGS="$H5_CFLAGS -erroff=%none -DBSD_COMP" + + # Production + # NDEBUG is handled explicitly by the configure script + PROD_CFLAGS= + + # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags + DEBUG_CFLAGS= + + # Symbols + NO_SYMBOLS_CFLAGS="-s" + SYMBOLS_CFLAGS="-g" + + # Profile + PROFILE_CFLAGS="-xpg" + + # Optimization # -g produces rather slow code. "-g -O" produces much faster code with some # loss of debugger functions such as not able to print local variables. - DEBUG_CFLAGS="-g -O" - DEBUG_CPPFLAGS= - PROD_CFLAGS="-O -s" - PROD_CPPFLAGS= - PROFILE_CFLAGS=-xpg - PROFILE_CPPFLAGS= + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS="-O" + NO_OPT_CFLAGS= + cc_flags_set=yes -# Special linking flag is needed to build with Fortran on Solaris 5.9 + # Special linking flag is needed to build with Fortran on Solaris 5.9 system_version="`uname -r`" case "$system_version" in 5.9*) @@ -52,10 +68,6 @@ if test "X-" = "X-$cc_flags_set"; then ;; esac - # Turn off optimization flag for SUNpro compiler versions 4.x which - # have an optimization bug. Version 5.0 works. - ($CC -V 2>&1) | grep -s 'cc: .* C 4\.' >/dev/null 2>&1 \ - && PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O//'`" fi LIBS="$LIBS" @@ -69,12 +81,34 @@ fi if test "X-" = "X-$f9x_flags_set"; then F9XSUFFIXFLAG="" FSEARCH_DIRS="" + H5_FCFLAGS="$H5_FCFLAGS" + + # TODO: Revisit these flags. + + # Production + # NDEBUG is handled explicitly by the configure script + PROD_FCFLAGS= + + # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags + DEBUG_FCFLAGS= + + # Symbols + NO_SYMBOLS_FCFLAGS= + SYMBOLS_FCFLAGS="-g" + + # Profile + PROFILE_FCFLAGS= + + # Optimization # -g produces rather slow code. "-g -O" produces much faster code with some # loss of debugger functions such as not able to print local variables. - DEBUG_FCFLAGS="-g -O" - PROD_FCFLAGS="-O2" - PROFILE_FCFLAGS="" + HIGH_OPT_FCFLAGS="-O2" + DEBUG_OPT_FCFLAGS="-O" + NO_OPT_FCFLAGS= + f9x_flags_set=yes fi @@ -107,14 +141,30 @@ fi if test -z "$cxx_flags_set"; then H5_CXXFLAGS="$H5_CXXFLAGS -instances=static" H5_CPPFLAGS="$H5_CPPFLAGS -LANG:std" + + # Production + # NDEBUG is handled explicitly by the configure script + PROD_CXXFLAGS= + + # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags + DEBUG_CXXFLAGS= + + # Symbols + NO_SYMBOLS_CXXFLAGS="-s" + SYMBOLS_CXXFLAGS="-g" + + # Profile + PROFILE_CXXFLAGS="-xpg" + + # Optimization # -g produces rather slow code. "-g -O" produces much faster code with some # loss of debugger functions such as not able to print local variables. - DEBUG_CXXFLAGS="-g -O" - DEBUG_CPPFLAGS= - PROD_CXXFLAGS="-O -s" - PROD_CPPFLAGS= - PROFILE_CXXFLAGS=-xpg - PROFILE_CPPFLAGS= + HIGH_OPT_CXXFLAGS="-O" + DEBUG_OPT_CXXFLAGS="-O" + NO_OPT_CXXFLAGS= + cxx_flags_set=yes fi @@ -156,4 +206,3 @@ case $CXX in ;; esac - diff --git a/config/x86_64-pc-cygwin b/config/x86_64-pc-cygwin index 9b1ab74..210aa2b 100644 --- a/config/x86_64-pc-cygwin +++ b/config/x86_64-pc-cygwin @@ -104,9 +104,25 @@ case $FC_BASENAME in # (just in case since this should be a default EIP) H5_FCFLAGS="$H5_FCFLAGS -YEXT_NAMES=UCS" FSEARCH_DIRS="" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes ;; @@ -119,3 +135,4 @@ if test -z "$CXX"; then CXX=g++ CXX_BASENAME=g++ fi + diff --git a/configure.ac b/configure.ac index a85b0fe..8787262 100644 --- a/configure.ac +++ b/configure.ac @@ -158,59 +158,6 @@ AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` ## ---------------------------------------------------------------------- -## Determine build mode (debug, production, clean). -## This has to be done early since the build mode is referred to -## frequently. -## -AC_MSG_CHECKING([build mode]) -AC_ARG_ENABLE([build-mode], - [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)], - [Sets the build mode. Debug turns on symbols, API - tracing, asserts, and debug optimization, - as well as several other minor configure options - that aid in debugging. - Production turns high optimizations on. - Clean turns nothing on and disables optimization - (i.e.: a 'clean slate' configuration). - All these settings can be overridden by using - specific configure flags. - [default=debug] - ])], - [BUILD_MODE=$enableval]) - -## Set the default -## Depends on branch, set via script at branch creation time -if test "X-$BUILD_MODE" = X- ; then - BUILD_MODE=debug -fi - -## Allow this variable to be substituted in -## other files (src/libhdf5.settings.in, etc.) -AC_SUBST([BUILD_MODE]) - -case "X-$BUILD_MODE" in - X-clean) - AC_MSG_RESULT([clean]) - ;; - X-debug) - H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" - AC_MSG_RESULT([debug]) - ;; - X-production) - H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" - AC_MSG_RESULT([production]) - ;; - *) - AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.]) -esac - -## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check ## that it actually does what it's supposed to do. Catch this early ## since configure and scripts relies upon them heavily and there's @@ -320,6 +267,60 @@ while test -n "$hname"; do done ## ---------------------------------------------------------------------- +## Determine build mode (debug, production, clean). +## This has to be done early since the build mode is referred to +## frequently. +## +AC_MSG_CHECKING([build mode]) +AC_ARG_ENABLE([build-mode], + [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)], + [Sets the build mode. Debug turns on symbols, API + tracing, asserts, and debug optimization, + as well as several other minor configure options + that aid in debugging. + Production turns high optimizations on. + Clean turns nothing on and disables optimization + (i.e.: a 'clean slate' configuration). + All these settings can be overridden by using + specific configure flags. + [default=debug] + ])], + [BUILD_MODE=$enableval]) + +## Set the default +## Depends on branch, set via script at branch creation time +if test "X-$BUILD_MODE" = X- ; then + BUILD_MODE=debug +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([BUILD_MODE]) + +case "X-$BUILD_MODE" in + X-clean) + AC_MSG_RESULT([clean]) + ;; + X-debug) + AC_DEFINE([DEBUG_BUILD], [1], [Define if this is a debug build.]) + H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-production) + H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" + AC_MSG_RESULT([production]) + ;; + *) + AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.]) +esac + +## ---------------------------------------------------------------------- ## Some built-in configure checks can only see CFLAGS (not AM_CFLAGS), so ## we need to add this in so configure works as intended. We will need to ## reset this value at the end of configure, to preserve the user's settings. @@ -1934,6 +1935,9 @@ case "X-$SYMBOLS" in AC_MSG_RESULT([yes]) ;; X-no) + H5_CFLAGS="$H5_CFLAGS $NO_SYMBOLS_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $NO_SYMBOLS_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $NO_SYMBOLS_FCFLAGS" AC_MSG_RESULT([no]) ;; *) @@ -2074,21 +2078,25 @@ AC_SUBST([OPTIMIZATION]) case "X-$OPTIMIZATION" in X-high) H5_CFLAGS="$H5_CFLAGS $HIGH_OPT_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $HIGH_OPT_CXXFLAGS" H5_FCFLAGS="$H5_FCFLAGS $HIGH_OPT_FCFLAGS" AC_MSG_RESULT([high]) ;; X-debug) H5_CFLAGS="$H5_CFLAGS $DEBUG_OPT_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_OPT_CXXFLAGS" H5_FCFLAGS="$H5_FCFLAGS $DEBUG_OPT_FCFLAGS" AC_MSG_RESULT([debug]) ;; X-none) H5_CFLAGS="$H5_CFLAGS $NO_OPT_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $NO_OPT_CXXFLAGS" H5_FCFLAGS="$H5_FCFLAGS $NO_OPT_FCFLAGS" AC_MSG_RESULT([none]) ;; *) H5_CFLAGS="$H5_CFLAGS $OPTIMIZATION" + H5_CXXFLAGS="$H5_CXXFLAGS $OPTIMIZATION" H5_FCFLAGS="$H5_FCFLAGS $OPTIMIZATION" OPTIMIZATION="custom ($OPTIMIZATION)" AC_MSG_RESULT([$OPTIMIZATION]) -- cgit v0.12 From 649616ed99fab7e6d9cbc0ba11a5bff295cc18eb Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 18 Feb 2016 13:44:04 -0500 Subject: [svn-r29148] Merged autotools LFS changes (r29011) from trunk. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial (debug w/ C++ & Fortran) autotools parallel (MPICH 3.1.4, debug w/ Fortran) --- configure.ac | 22 ------------------- src/H5FDstdio.c | 21 +++++------------- src/H5private.h | 68 +++++++++++++++------------------------------------------ 3 files changed, 23 insertions(+), 88 deletions(-) diff --git a/configure.ac b/configure.ac index 8787262..1224af7 100644 --- a/configure.ac +++ b/configure.ac @@ -1046,10 +1046,6 @@ fi ## case "$host_cpu-$host_vendor-$host_os" in *linux*) - ## Make available various LFS-related routines using the following - ## _LARGEFILE*_SOURCE macros. - AM_CPPFLAGS="-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS" - ## Add POSIX support on Linux systems, so defines ## __USE_POSIX, which is required to get the prototype for fdopen ## defined correctly in . @@ -1084,23 +1080,6 @@ esac CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -]], - [[off64_t n = 0;]])], - [AC_CHECK_FUNCS([lseek64 fseeko64 ftello64 ftruncate64])], - [AC_MSG_RESULT([skipping test for lseek64, fseeko64 , ftello64, ftruncate64 because off64_t is not defined])]) - -AC_CHECK_FUNCS([fseeko ftello]) - -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -]], -[[struct stat64 sb;]])], -[AC_CHECK_FUNCS([stat64 fstat64])], -[AC_MSG_RESULT([skipping test for stat64 and fstat64])]) - ## Checkpoint the cache AC_CACHE_SAVE @@ -1151,7 +1130,6 @@ cat >>confdefs.h <<\EOF #include /*for off_t definition*/ EOF AC_CHECK_SIZEOF([off_t]) -AC_CHECK_SIZEOF([off64_t]) if test "X$C9x" = "Xyes"; then cat >>confdefs.h <<\EOF diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index bc0b342..13ccd5c 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -127,23 +127,14 @@ typedef struct H5FD_stdio_t { #endif /* H5_HAVE_MINGW */ #endif /* H5_HAVE_WIN32_API */ -/* Use file_xxx to indicate these are local macros, avoiding confusing - * with the global HD_xxx macros. - * Assume fseeko, which is POSIX standard, is always supported; - * but prefer to use fseeko64 if supported. +/* If these functions weren't re-defined for Windows, give them + * more platform-independent names. */ #ifndef file_fseek - #ifdef H5_HAVE_FSEEKO64 - #define file_fseek fseeko64 - #define file_offset_t off64_t - #define file_ftruncate ftruncate64 - #define file_ftell ftello64 - #else - #define file_fseek fseeko - #define file_offset_t off_t - #define file_ftruncate ftruncate - #define file_ftell ftello - #endif /* H5_HAVE_FSEEKO64 */ + #define file_fseek fseeko + #define file_offset_t off_t + #define file_ftruncate ftruncate + #define file_ftell ftello #endif /* file_fseek */ /* These macros check for overflow of various quantities. These macros diff --git a/src/H5private.h b/src/H5private.h index c536566..86d3b70 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -870,58 +870,31 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* HDfrexpl */ /* fscanf() variable arguments */ #ifndef HDfseek - #ifdef H5_HAVE_FSEEKO - #define HDfseek(F,O,W) fseeko(F,O,W) - #else /* H5_HAVE_FSEEKO */ - #define HDfseek(F,O,W) fseek(F,O,W) - #endif /* H5_HAVE_FSEEKO */ + #define HDfseek(F,O,W) fseeko(F,O,W) #endif /* HDfseek */ #ifndef HDfsetpos #define HDfsetpos(F,P) fsetpos(F,P) #endif /* HDfsetpos */ -/* definitions related to the file stat utilities. - * For Unix, if off_t is not 64bit big, try use the pseudo-standard - * xxx64 versions if available. - */ -#if !defined(HDfstat) || !defined(HDstat) || !defined(HDlstat) - #if H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64) - #ifndef HDfstat - #define HDfstat(F,B) fstat64(F,B) - #endif /* HDfstat */ - #ifndef HDlstat - #define HDlstat(S,B) lstat64(S,B) - #endif /* HDlstat */ - #ifndef HDstat - #define HDstat(S,B) stat64(S,B) - #endif /* HDstat */ - typedef struct stat64 h5_stat_t; - typedef off64_t h5_stat_size_t; - #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF64_T - #else /* H5_SIZEOF_OFF_T!=8 && ... */ - #ifndef HDfstat - #define HDfstat(F,B) fstat(F,B) - #endif /* HDfstat */ - #ifndef HDlstat - #define HDlstat(S,B) lstat(S,B) - #endif /* HDlstat */ - #ifndef HDstat - #define HDstat(S,B) stat(S,B) - #endif /* HDstat */ - typedef struct stat h5_stat_t; - typedef off_t h5_stat_size_t; - #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T - #endif /* H5_SIZEOF_OFF_T!=8 && ... */ -#endif /* !defined(HDfstat) || !defined(HDstat) */ +#ifndef HDfstat + #define HDfstat(F,B) fstat(F,B) +#endif /* HDfstat */ +#ifndef HDlstat + #define HDlstat(S,B) lstat(S,B) +#endif /* HDlstat */ +#ifndef HDstat + #define HDstat(S,B) stat(S,B) +#endif /* HDstat */ + +typedef struct stat h5_stat_t; +typedef off_t h5_stat_size_t; +#define HDoff_t off_t +#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #ifndef HDftell - #define HDftell(F) ftell(F) + #define HDftell(F) ftello(F) #endif /* HDftell */ #ifndef HDftruncate - #ifdef H5_HAVE_FTRUNCATE64 - #define HDftruncate(F,L) ftruncate64(F,L) - #else #define HDftruncate(F,L) ftruncate(F,L) - #endif #endif /* HDftruncate */ #ifndef HDfwrite #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) @@ -1064,15 +1037,8 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #ifndef HDlongjmp #define HDlongjmp(J,N) longjmp(J,N) #endif /* HDlongjmp */ -/* HDlseek and HDoff_t must be defined together for consistency. */ #ifndef HDlseek - #ifdef H5_HAVE_LSEEK64 - #define HDlseek(F,O,W) lseek64(F,O,W) - #define HDoff_t off64_t - #else - #define HDlseek(F,O,W) lseek(F,O,W) - #define HDoff_t off_t - #endif + #define HDlseek(F,O,W) lseek(F,O,W) #endif /* HDlseek */ #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) -- cgit v0.12 From 1c8dfd918b2baaeb5c3ce228be71c565f324ec55 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 19 Feb 2016 11:48:42 -0500 Subject: [svn-r29159] Merge of r29019 from trunk. Fixes double declaration of a couple of types from the LFS changes. Tested on: 64-bit Windows 10 w/ VS 2015 Pro --- src/H5private.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/H5private.h b/src/H5private.h index 86d3b70..b4fbc26 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -885,9 +885,15 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDstat(S,B) stat(S,B) #endif /* HDstat */ +#ifndef H5_HAVE_WIN32_API +/* These definitions differ in Windows and are defined in + * H5win32defs for that platform. + */ typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; -#define HDoff_t off_t +#define HDoff_t off_t +#endif /* H5_HAVE_WIN32_API */ + #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #ifndef HDftell -- cgit v0.12 From a4fa2198b135d3ef6af002b00b21cda59aca69ae Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 23 Feb 2016 15:49:39 -0500 Subject: [svn-r29189] Updated CMake to build SWMR and SWMR VDS test files. Many SWMR test files were updated to include h5test.h and use HD posix function wrappers so they will compile on Windows. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 & CMake 3.3.2 64-bit Windows 10 w/ VS 2015 Pro & CMake 3.3.1 --- test/CMakeLists.txt | 81 +++++++++++++++++++++- test/swmr_addrem_writer.c | 66 +++++++++--------- test/swmr_check_compat_vfd.c | 9 +-- test/swmr_common.c | 46 ++++++------ test/swmr_common.h | 12 +--- test/swmr_generator.c | 50 +++++++------ test/swmr_reader.c | 111 +++++++++++++++-------------- test/swmr_remove_reader.c | 115 +++++++++++++++--------------- test/swmr_remove_writer.c | 78 ++++++++++----------- test/swmr_sparse_reader.c | 98 +++++++++++++------------- test/swmr_sparse_writer.c | 51 +++++++------- test/swmr_start_write.c | 162 +++++++++++++++++++++---------------------- test/swmr_writer.c | 74 ++++++++++---------- 13 files changed, 501 insertions(+), 452 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3a69371..79a7158 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -67,6 +67,85 @@ if (BUILD_SHARED_LIBS) endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- +# Build SWMR test programs +# +# These programs are currently not used in CMake tests but we build them +# here anyway for manual testing and to ensure that the code compiles +# on all platforms. +#----------------------------------------------------------------------------- +MACRO (ADD_H5_SWMR_EXE file) + add_executable (${file} + ${HDF5_TEST_SOURCE_DIR}/${file}.c + ${HDF5_TEST_SOURCE_DIR}/swmr_common.c + ${HDF5_TEST_SOURCE_DIR}/swmr_common.h + ) + TARGET_NAMING (${file} STATIC) + TARGET_C_PROPERTIES (${file} STATIC " " " ") + target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (${file} PROPERTIES FOLDER test) + if (BUILD_SHARED_LIBS) + add_executable (${file}-shared + ${HDF5_TEST_SOURCE_DIR}/${file}.c + ${HDF5_TEST_SOURCE_DIR}/swmr_common.c + ${HDF5_TEST_SOURCE_DIR}/swmr_common.h + ) + TARGET_NAMING (${file}-shared SHARED) + TARGET_C_PROPERTIES (${file}-shared SHARED " " " ") + target_link_libraries (${file}-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (${file}-shared PROPERTIES FOLDER test) + endif (BUILD_SHARED_LIBS) +ENDMACRO (ADD_H5_SWMR_EXE file) + +set (H5_SWMR_TESTS + swmr_addrem_writer + swmr_check_compat_vfd + swmr_generator + swmr_reader + swmr_remove_reader + swmr_remove_writer + swmr_sparse_reader + swmr_sparse_writer + swmr_start_write + swmr_writer +) + +foreach (test ${H5_SWMR_TESTS}) + ADD_H5_SWMR_EXE(${test}) +endforeach (test ${H5_SWMR_TESTS}) + +#----------------------------------------------------------------------------- +# Build VDS SWMR test programs +# +# These programs are currently not used in CMake tests but we build them +# here anyway for manual testing and to ensure that the code compiles +# on all platforms. +#----------------------------------------------------------------------------- +MACRO (ADD_H5_VDS_SWMR_EXE file) + add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) + TARGET_NAMING (${file} STATIC) + TARGET_C_PROPERTIES (${file} STATIC " " " ") + target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (${file} PROPERTIES FOLDER test) + if (BUILD_SHARED_LIBS) + add_executable (${file}-shared ${HDF5_TEST_SOURCE_DIR}/${file}.c) + TARGET_NAMING (${file}-shared SHARED) + TARGET_C_PROPERTIES (${file}-shared SHARED " " " ") + target_link_libraries (${file}-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (${file}-shared PROPERTIES FOLDER test) + endif (BUILD_SHARED_LIBS) +ENDMACRO (ADD_H5_VDS_SWMR_EXE file) + +set (H5_VDS_SWMR_TESTS + vds_swmr_gen + vds_swmr_reader + vds_swmr_writer +) + +foreach (test ${H5_VDS_SWMR_TESTS}) + ADD_H5_VDS_SWMR_EXE(${test}) +endforeach (test ${H5_VDS_SWMR_TESTS}) + +#----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- # make plugins dir @@ -74,7 +153,7 @@ endif (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2") #----------------------------------------------------------------------------- - # Define Test Library Sources + # Define Plugin Test Sources #----------------------------------------------------------------------------- set (TEST_PLUGIN_LIBS dynlib1 diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c index 8ce3f6c..3034da5 100644 --- a/test/swmr_addrem_writer.c +++ b/test/swmr_addrem_writer.c @@ -33,9 +33,7 @@ /* Headers */ /***********/ -#include -#include - +#include "h5test.h" #include "swmr_common.h" /****************/ @@ -82,7 +80,7 @@ open_skeleton(const char *filename, unsigned verbose) hsize_t dim[2]; /* Dataspace dimension */ unsigned u, v; /* Local index variable */ - assert(filename); + HDassert(filename); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) @@ -99,8 +97,8 @@ open_skeleton(const char *filename, unsigned verbose) mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; H5Pget_mdc_config(fapl, &mdc_config); - fprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - fprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); + HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); + HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); mdc_config.set_initial_size = 1; mdc_config.initial_size = 16 * 1024 * 1024; /* mdc_config.epoch_length = 5000; */ @@ -122,7 +120,7 @@ open_skeleton(const char *filename, unsigned verbose) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening datasets\n"); + HDfprintf(stderr, "Opening datasets\n"); /* Open the datasets */ for(u = 0; u < NLEVELS; u++) @@ -178,10 +176,10 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl unsigned long op_to_flush; /* # of operations before flush */ unsigned long u, v; /* Local index variables */ - assert(fid > 0); + HDassert(fid > 0); /* Reset the buffer */ - memset(&buf, 0, sizeof(buf)); + HDmemset(&buf, 0, sizeof(buf)); /* Create a dataspace for the record to add */ if((mem_sid = H5Screate_simple(2, count, NULL)) < 0) @@ -196,7 +194,7 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl mdc_config_orig.version = H5AC__CURR_CACHE_CONFIG_VERSION; if(H5Fget_mdc_config(fid, &mdc_config_orig) < 0) return -1; - memcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); + HDmemcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); mdc_config_cork.evictions_enabled = FALSE; mdc_config_cork.incr_mode = H5C_incr__off; mdc_config_cork.flash_incr_mode = H5C_flash_incr__off; @@ -213,7 +211,7 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl symbol = choose_dataset(); /* Decide whether to shrink or expand, and by how much */ - count[1] = (hsize_t)random() % (MAX_SIZE_CHANGE * 2) + 1; + count[1] = (hsize_t)HDrandom() % (MAX_SIZE_CHANGE * 2) + 1; if(count[1] > MAX_SIZE_CHANGE) { /* Add records */ @@ -291,7 +289,7 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing datasets\n"); + HDfprintf(stderr, "Closing datasets\n"); /* Close the datasets */ for(u = 0; u < NLEVELS; u++) @@ -343,7 +341,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* # of records to write between flushing file */ case 'f': - flush_count = atol(argv[u + 1]); + flush_count = HDatol(argv[u + 1]); if(flush_count < 0) usage(); u += 2; @@ -358,7 +356,7 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = 1; - temp = atoi(argv[u + 1]); + temp = HDatoi(argv[u + 1]); if(temp < 0) usage(); else @@ -373,7 +371,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to append */ - nops = atol(argv[u]); + nops = HDatol(argv[u]); if(nops <= 0) usage(); @@ -388,24 +386,24 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\t# of operations between flushes = %ld\n", flush_count); - fprintf(stderr, "\t# of operations = %ld\n", nops); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\t# of operations between flushes = %ld\n", flush_count); + HDfprintf(stderr, "\t# of operations = %ld\n", nops); } /* end if */ /* Set the random seed */ if(0 == use_seed) { struct timeval t; - gettimeofday(&t, NULL); + HDgettimeofday(&t, NULL); random_seed = (unsigned)(t.tv_usec); } /* end if */ - srandom(random_seed); + HDsrandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ - fprintf(stderr, "Using writer random seed: %u\n", random_seed); + HDfprintf(stderr, "Using writer random seed: %u\n", random_seed); /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) @@ -413,12 +411,12 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening skeleton file: %s\n", FILENAME); + HDfprintf(stderr, "Opening skeleton file: %s\n", FILENAME); /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose)) < 0) { - fprintf(stderr, "Error opening skeleton file!\n"); - exit(1); + HDfprintf(stderr, "Error opening skeleton file!\n"); + HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -426,32 +424,32 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Adding and removing records\n"); + HDfprintf(stderr, "Adding and removing records\n"); /* Grow and shrink datasets */ if(addrem_records(fid, verbose, (unsigned long)nops, (unsigned long)flush_count) < 0) { - fprintf(stderr, "Error adding and removing records from datasets!\n"); - exit(1); + HDfprintf(stderr, "Error adding and removing records from datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close objects opened */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Error closing file!\n"); - exit(1); + HDfprintf(stderr, "Error closing file!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c index 87b87c4..1bbfda3 100644 --- a/test/swmr_check_compat_vfd.c +++ b/test/swmr_check_compat_vfd.c @@ -19,14 +19,12 @@ * It is intended for use in shell scripts. */ -#include - -#include "H5private.h" +#include "h5test.h" /* This file needs to access the file driver testing code */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING -#include "H5FDpkg.h" /* File drivers */ +#include "H5FDpkg.h" /* File drivers */ /*------------------------------------------------------------------------- @@ -56,4 +54,3 @@ main(void) return EXIT_FAILURE; } /* end main() */ - diff --git a/test/swmr_common.c b/test/swmr_common.c index 30e1b3e..96e4b76 100644 --- a/test/swmr_common.c +++ b/test/swmr_common.c @@ -26,8 +26,7 @@ /* Headers */ /***********/ -#include - +#include "h5test.h" #include "swmr_common.h" /*******************/ @@ -96,10 +95,10 @@ choose_dataset(void) unsigned offset; /* The "offset" of the dataset at that level */ /* Determine level of dataset */ - level = symbol_mapping[random() % NMAPPING]; + level = symbol_mapping[HDrandom() % NMAPPING]; /* Determine the offset of the level */ - offset = random() % symbol_count[level]; + offset = HDrandom() % symbol_count[level]; return &symbol_info[level][offset]; } /* end choose_dataset() */ @@ -172,7 +171,7 @@ create_symbol_datatype(void) int generate_name(char *name_buf, unsigned level, unsigned count) { - assert(name_buf); + HDassert(name_buf); sprintf(name_buf, "%u-%04u", level, count); @@ -198,13 +197,13 @@ generate_symbols(void) unsigned u, v; /* Local index variables */ for(u = 0; u < NLEVELS; u++) { - symbol_info[u] = (symbol_info_t *)malloc(symbol_count[u] * sizeof(symbol_info_t)); + symbol_info[u] = (symbol_info_t *)HDmalloc(symbol_count[u] * sizeof(symbol_info_t)); for(v = 0; v < symbol_count[u]; v++) { char name_buf[64]; generate_name(name_buf, u, v); - symbol_info[u][v].name = (char *)malloc(strlen(name_buf) + 1); - strcpy(symbol_info[u][v].name, name_buf); + symbol_info[u][v].name = (char *)HDmalloc(strlen(name_buf) + 1); + HDstrcpy(symbol_info[u][v].name, name_buf); symbol_info[u][v].dsid = -1; symbol_info[u][v].nrecords = 0; } /* end for */ @@ -234,8 +233,8 @@ shutdown_symbols(void) /* Clean up the symbols */ for(u = 0; u < NLEVELS; u++) { for(v = 0; v < symbol_count[u]; v++) - free(symbol_info[u][v].name); - free(symbol_info[u]); + HDfree(symbol_info[u][v].name); + HDfree(symbol_info[u]); } /* end for */ return 0; @@ -262,31 +261,30 @@ print_metadata_retries_info(hid_t fid) /* Retrieve the collection of retries */ if(H5Fget_metadata_read_retry_info(fid, &info) < 0) - return (-1); + return (-1); /* Print information for each non-NULL retries[i] */ for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) { unsigned power; unsigned j; - if(NULL == info.retries[i]) - continue; - - fprintf(stderr, "Metadata read retries for item %u:\n", i); - power = 1; - for(j = 0; j < info.nbins; j++) { - if(info.retries[i][j]) - fprintf(stderr, "\t# of retries for %u - %u retries: %u\n", - power, (power * 10) - 1, info.retries[i][j]); - power *= 10; - } /* end for */ + if(NULL == info.retries[i]) + continue; + + HDfprintf(stderr, "Metadata read retries for item %u:\n", i); + power = 1; + for(j = 0; j < info.nbins; j++) { + if(info.retries[i][j]) + HDfprintf(stderr, "\t# of retries for %u - %u retries: %u\n", + power, (power * 10) - 1, info.retries[i][j]); + power *= 10; + } /* end for */ } /* end for */ /* Free memory for each non-NULL retries[i] */ for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) if(info.retries[i] != NULL) - free(info.retries[i]); + HDfree(info.retries[i]); return 0; } /* print_metadata_retries_info() */ - diff --git a/test/swmr_common.h b/test/swmr_common.h index 1778f8e..31b5fa6 100644 --- a/test/swmr_common.h +++ b/test/swmr_common.h @@ -16,15 +16,10 @@ #ifndef _SWMR_COMMON_H #define _SWMR_COMMON_H -/* Headers needed */ +/***********/ +/* Headers */ +/***********/ -#include -#include -#include -#include -#include - -#include "hdf5.h" #include "h5test.h" /**********/ @@ -75,4 +70,3 @@ int shutdown_symbols(void); int print_metadata_retries_info(hid_t fid); #endif /* _SWMR_COMMON_H */ - diff --git a/test/swmr_generator.c b/test/swmr_generator.c index bbc1e18..23341c8 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -27,9 +27,7 @@ /* Headers */ /***********/ -#include -#include - +#include "h5test.h" #include "swmr_common.h" /****************/ @@ -95,8 +93,8 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write, #endif /* FILLVAL_WORKS */ unsigned u, v; /* Local index variable */ - assert(filename); - assert(index_type); + HDassert(filename); + HDassert(index_type); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) @@ -104,15 +102,15 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write, /* Can create a file for SWMR support with: (a) (write+latest-format) or (b) (SWMR write+non-latest-format) */ if(!swmr_write) { - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + return -1; } /* There are two chunk indexes tested here. * With one unlimited dimension, we get the extensible array index * type, with two unlimited dimensions, we get a v-2 B-tree. */ - if(!strcmp(index_type, "b2")) + if(!HDstrcmp(index_type, "b2")) max_dims[0] = H5S_UNLIMITED; #ifdef QAK @@ -122,8 +120,8 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write, mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; H5Pget_mdc_config(fapl, &mdc_config); - fprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - fprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); + HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); + HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); mdc_config.set_initial_size = 1; mdc_config.initial_size = 16 * 1024 * 1024; /* mdc_config.epoch_length = 5000; */ @@ -149,7 +147,7 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write, /* Emit informational message */ if(verbose) - fprintf(stderr, "Creating file\n"); + HDfprintf(stderr, "Creating file\n"); /* Create the file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (swmr_write ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl)) < 0) @@ -194,7 +192,7 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write, /* Currently fill values do not work because they can bump the dataspace * message to the second object header chunk. We should enable the fillval * here when this is fixed. -NAF 8/11/11 */ - memset(&fillval, 0, sizeof(fillval)); + HDmemset(&fillval, 0, sizeof(fillval)); fillval.rec_id = (uint64_t)ULLONG_MAX; if(H5Pset_fill_value(dcpl, tid, &fillval) < 0) return -1; @@ -202,7 +200,7 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write, /* Emit informational message */ if(verbose) - fprintf(stderr, "Creating datasets\n"); + HDfprintf(stderr, "Creating datasets\n"); /* Create the datasets */ for(u = 0; u < NLEVELS; u++) @@ -220,7 +218,7 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write, /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close everythign */ if(H5Pclose(dcpl) < 0) @@ -277,7 +275,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* Compress dataset chunks */ case 'c': - comp_level = atoi(argv[u + 1]); + comp_level = HDatoi(argv[u + 1]); if(comp_level < -1 || comp_level > 9) usage(); u += 2; @@ -295,7 +293,7 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = 1; - temp = atoi(argv[u + 1]); + temp = HDatoi(argv[u + 1]); if(temp < 0) usage(); else @@ -325,30 +323,30 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\tswmr writes %s\n", swmr_write ? "on" : "off"); - fprintf(stderr, "\tcompression level = %d\n", comp_level); - fprintf(stderr, "\tindex type = %s\n", index_type); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\tswmr writes %s\n", swmr_write ? "on" : "off"); + HDfprintf(stderr, "\tcompression level = %d\n", comp_level); + HDfprintf(stderr, "\tindex type = %s\n", index_type); } /* end if */ /* Set the random seed */ if(0 == use_seed) { struct timeval t; - gettimeofday(&t, NULL); + HDgettimeofday(&t, NULL); random_seed = (unsigned)(t.tv_usec); } /* end if */ - srandom(random_seed); + HDsrandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ - fprintf(stderr, "Using generator random seed (used in sparse test only): %u\n", random_seed); + HDfprintf(stderr, "Using generator random seed (used in sparse test only): %u\n", random_seed); /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating skeleton file: %s\n", FILENAME); + HDfprintf(stderr, "Generating skeleton file: %s\n", FILENAME); /* Generate file skeleton */ if(gen_skeleton(FILENAME, verbose, swmr_write, comp_level, index_type, random_seed) < 0) { - fprintf(stderr, "Error generating skeleton file!\n"); - exit(1); + HDfprintf(stderr, "Error generating skeleton file!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_reader.c b/test/swmr_reader.c index f7b7e96..ea91f07 100644 --- a/test/swmr_reader.c +++ b/test/swmr_reader.c @@ -30,10 +30,7 @@ /* Headers */ /***********/ -#include -#include -#include - +#include "h5test.h" #include "swmr_common.h" /********************/ @@ -90,10 +87,10 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor hssize_t snpoints; /* Number of elements in dataset */ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */ - assert(fid >= 0); - assert(sym_name); - assert(record); - assert(rec_sid >= 0); + HDassert(fid >= 0); + HDassert(sym_name); + HDassert(record); + HDassert(rec_sid >= 0); /* Open dataset for symbol */ if((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0) @@ -109,7 +106,7 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor /* Emit informational message */ if(verbose) - fprintf(stderr, "Symbol = '%s', # of records = %lld\n", sym_name, (long long)snpoints); + HDfprintf(stderr, "Symbol = '%s', # of records = %lld\n", sym_name, (long long)snpoints); /* Check if there are records for symbol */ if(snpoints > 0) { @@ -125,9 +122,9 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor /* Verify record value */ if(record->rec_id != start[1]) { - fprintf(stderr, "*** ERROR ***\n"); - fprintf(stderr, "Incorrect record value!\n"); - fprintf(stderr, "Symbol = '%s', # of records = %lld, record->rec_id = %llu\n", sym_name, (long long)snpoints, (unsigned long long)record->rec_id); + HDfprintf(stderr, "*** ERROR ***\n"); + HDfprintf(stderr, "Incorrect record value!\n"); + HDfprintf(stderr, "Symbol = '%s', # of records = %lld, record->rec_id = %llu\n", sym_name, (long long)snpoints, (unsigned long long)record->rec_id); return -1; } /* end if */ } /* end if */ @@ -193,17 +190,17 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, symbol_t record; /* The record to read from the dataset */ unsigned v; /* Local index variable */ - assert(filename); - assert(nseconds != 0); - assert(poll_time != 0); + HDassert(filename); + HDassert(nseconds != 0); + HDassert(poll_time != 0); /* Reset the record */ /* (record's 'info' field might need to change for each record read, also) */ - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); /* Emit informational message */ if(verbose) - fprintf(stderr, "Choosing datasets\n"); + HDfprintf(stderr, "Choosing datasets\n"); /* Allocate space for 'common' datasets, if any */ if(ncommon > 0) { @@ -217,19 +214,19 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Determine the offset of the symbol, within level 0 symbols */ /* (level 0 symbols are the most common symbols) */ - offset = (unsigned)(random() % symbol_count[0]); + offset = (unsigned)(HDrandom() % symbol_count[0]); sym_com[v] = &symbol_info[0][offset]; /* Emit informational message */ if(verbose) - fprintf(stderr, "Common symbol #%u = '%s'\n", v, symbol_info[0][offset].name); + HDfprintf(stderr, "Common symbol #%u = '%s'\n", v, symbol_info[0][offset].name); } /* end for */ } /* end if */ /* Allocate space for 'random' datasets, if any */ if(nrandom > 0) { /* Allocate array to hold pointers to symbols for random datasets */ - if(NULL == (sym_rand = (symbol_info_t **)malloc(sizeof(symbol_info_t *) * nrandom))) + if(NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom))) return -1; /* Determine the random datasets */ @@ -243,7 +240,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Random symbol #%u = '%s'\n", v, sym->name); + HDfprintf(stderr, "Random symbol #%u = '%s'\n", v, sym->name); } /* end for */ } /* end if */ @@ -253,10 +250,10 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Reading records\n"); + HDfprintf(stderr, "Reading records\n"); /* Get the starting time */ - start_time = time(NULL); + start_time = HDtime(NULL); curr_time = start_time; /* Create file access property list */ @@ -268,7 +265,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening file: %s\n", filename); + HDfprintf(stderr, "Opening file: %s\n", filename); /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) @@ -278,14 +275,14 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, if(ncommon > 0) { /* Emit informational message */ if(verbose) - fprintf(stderr, "Checking common symbols\n"); + HDfprintf(stderr, "Checking common symbols\n"); /* Iterate over common datasets */ for(v = 0; v < ncommon; v++) { /* Check common dataset */ if(check_dataset(fid, verbose, sym_com[v]->name, &record, mem_sid) < 0) return -1; - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); } /* end for */ } /* end if */ @@ -293,27 +290,27 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, if(nrandom > 0) { /* Emit informational message */ if(verbose) - fprintf(stderr, "Checking random symbols\n"); + HDfprintf(stderr, "Checking random symbols\n"); /* Iterate over random datasets */ for(v = 0; v < nrandom; v++) { /* Check random dataset */ if(check_dataset(fid, verbose, sym_rand[v]->name, &record, mem_sid) < 0) return -1; - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); } /* end for */ } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing file\n"); + HDfprintf(stderr, "Closing file\n"); /* Close the file */ if(H5Fclose(fid) < 0) return -1; /* Sleep for the appropriate # of seconds */ - sleep(poll_time); + HDsleep(poll_time); /* Retrieve the current time */ curr_time = time(NULL); @@ -329,18 +326,18 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing datasets\n"); + HDfprintf(stderr, "Closing datasets\n"); /* Close 'random' datasets, if any */ if(nrandom > 0) { /* Release array holding dataset ID's for random datasets */ - free(sym_rand); + HDfree(sym_rand); } /* end if */ /* Close 'common' datasets, if any */ if(ncommon > 0) { /* Release array holding dataset ID's for common datasets */ - free(sym_com); + HDfree(sym_com); } /* end if */ return 0; @@ -387,7 +384,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* # of common symbols to poll */ case 'h': - ncommon = atoi(argv[u + 1]); + ncommon = HDatoi(argv[u + 1]); if(ncommon < 0) usage(); u += 2; @@ -395,7 +392,7 @@ int main(int argc, const char *argv[]) /* # of random symbols to poll */ case 'l': - nrandom = atoi(argv[u + 1]); + nrandom = HDatoi(argv[u + 1]); if(nrandom < 0) usage(); u += 2; @@ -410,7 +407,7 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = 1; - temp = atoi(argv[u + 1]); + temp = HDatoi(argv[u + 1]); if(temp < 0) usage(); else @@ -420,7 +417,7 @@ int main(int argc, const char *argv[]) /* # of seconds between polling */ case 's': - poll_time = atoi(argv[u + 1]); + poll_time = HDatoi(argv[u + 1]); if(poll_time < 0) usage(); u += 2; @@ -433,7 +430,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to append */ - nseconds = atol(argv[u]); + nseconds = HDatol(argv[u]); if(nseconds <= 0) usage(); @@ -448,31 +445,31 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\t# of seconds between polling = %d\n", poll_time); - fprintf(stderr, "\t# of common symbols to poll = %d\n", ncommon); - fprintf(stderr, "\t# of random symbols to poll = %d\n", nrandom); - fprintf(stderr, "\t# of seconds to test = %ld\n", nseconds); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\t# of seconds between polling = %d\n", poll_time); + HDfprintf(stderr, "\t# of common symbols to poll = %d\n", ncommon); + HDfprintf(stderr, "\t# of random symbols to poll = %d\n", nrandom); + HDfprintf(stderr, "\t# of seconds to test = %ld\n", nseconds); } /* end if */ /* Set the random seed */ if(0 == use_seed) { struct timeval t; - gettimeofday(&t, NULL); + HDgettimeofday(&t, NULL); random_seed = (unsigned)(t.tv_usec); } /* end if */ - srandom(random_seed); + HDsrandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ - fprintf(stderr, "Using reader random seed: %u\n", random_seed); + HDfprintf(stderr, "Using reader random seed: %u\n", random_seed); /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) { - fprintf(stderr, "Error generating symbol names!\n"); - exit(1); + HDfprintf(stderr, "Error generating symbol names!\n"); + HDexit(1); } /* end if */ /* Create datatype for creating datasets */ @@ -481,28 +478,28 @@ int main(int argc, const char *argv[]) /* Reading records from datasets */ if(read_records(FILENAME, verbose, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { - fprintf(stderr, "Error reading records from datasets!\n"); - exit(1); + HDfprintf(stderr, "Error reading records from datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close objects created */ if(H5Tclose(symbol_tid) < 0) { - fprintf(stderr, "Error closing symbol datatype!\n"); - exit(1); + HDfprintf(stderr, "Error closing symbol datatype!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_remove_reader.c b/test/swmr_remove_reader.c index 76c44fa..a241481 100644 --- a/test/swmr_remove_reader.c +++ b/test/swmr_remove_reader.c @@ -31,10 +31,7 @@ /* Headers */ /***********/ -#include -#include -#include - +#include "h5test.h" #include "swmr_common.h" /*******************/ @@ -92,10 +89,10 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor hssize_t snpoints; /* Number of elements in dataset */ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */ - assert(fid >= 0); - assert(sym_name); - assert(record); - assert(rec_sid >= 0); + HDassert(fid >= 0); + HDassert(sym_name); + HDassert(record); + HDassert(rec_sid >= 0); /* Open dataset for symbol */ if((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0) @@ -111,13 +108,13 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor /* Emit informational message */ if(verbose) - fprintf(stderr, "Symbol = '%s', # of records = %lld\n", sym_name, (long long)snpoints); + HDfprintf(stderr, "Symbol = '%s', # of records = %lld\n", sym_name, (long long)snpoints); /* Check if there are records for symbol */ if(snpoints > 0) { /* Choose a random record in the dataset, choosing the last record half * the time */ - start[1] = (hsize_t)(random() % (snpoints * 2)); + start[1] = (hsize_t)(HDrandom() % (snpoints * 2)); if(start[1] > (hsize_t)(snpoints - 1)) start[1] = (hsize_t)(snpoints - 1); if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) @@ -140,9 +137,9 @@ check_dataset(hid_t fid, unsigned verbose, const char *sym_name, symbol_t *recor * chunk may be deleted before the object header has the updated * dimensions */ if(record->rec_id != start[1] && record->rec_id != (uint64_t)0) { - fprintf(stderr, "*** ERROR ***\n"); - fprintf(stderr, "Incorrect record value!\n"); - fprintf(stderr, "Symbol = '%s', # of records = %lld, record->rec_id = %llx\n", sym_name, (long long)snpoints, (unsigned long long)record->rec_id); + HDfprintf(stderr, "*** ERROR ***\n"); + HDfprintf(stderr, "Incorrect record value!\n"); + HDfprintf(stderr, "Symbol = '%s', # of records = %lld, record->rec_id = %llx\n", sym_name, (long long)snpoints, (unsigned long long)record->rec_id); return -1; } /* end if */ } /* end if */ @@ -208,22 +205,22 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, symbol_t record; /* The record to add to the dataset */ unsigned v; /* Local index variable */ - assert(filename); - assert(nseconds != 0); - assert(poll_time != 0); + HDassert(filename); + HDassert(nseconds != 0); + HDassert(poll_time != 0); /* Reset the record */ /* (record's 'info' field might need to change for each record written, also) */ - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); /* Emit informational message */ if(verbose) - fprintf(stderr, "Choosing datasets\n"); + HDfprintf(stderr, "Choosing datasets\n"); /* Allocate space for 'common' datasets, if any */ if(ncommon > 0) { /* Allocate array to hold pointers to symbols for common datasets */ - if(NULL == (sym_com = (symbol_info_t **)malloc(sizeof(symbol_info_t *) * ncommon))) + if(NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon))) return -1; /* Open the common datasets */ @@ -232,19 +229,19 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Determine the offset of the symbol, within level 0 symbols */ /* (level 0 symbols are the most common symbols) */ - offset = (unsigned)(random() % symbol_count[0]); + offset = (unsigned)(HDrandom() % symbol_count[0]); sym_com[v] = &symbol_info[0][offset]; /* Emit informational message */ if(verbose) - fprintf(stderr, "Common symbol #%u = '%s'\n", v, symbol_info[0][offset].name); + HDfprintf(stderr, "Common symbol #%u = '%s'\n", v, symbol_info[0][offset].name); } /* end for */ } /* end if */ /* Allocate space for 'random' datasets, if any */ if(nrandom > 0) { /* Allocate array to hold pointers to symbols for random datasets */ - if(NULL == (sym_rand = (symbol_info_t **)malloc(sizeof(symbol_info_t *) * nrandom))) + if(NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom))) return -1; /* Determine the random datasets */ @@ -258,7 +255,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Random symbol #%u = '%s'\n", v, sym->name); + HDfprintf(stderr, "Random symbol #%u = '%s'\n", v, sym->name); } /* end for */ } /* end if */ @@ -268,7 +265,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Reading records\n"); + HDfprintf(stderr, "Reading records\n"); /* Get the starting time */ start_time = time(NULL); @@ -283,7 +280,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening file: %s\n", filename); + HDfprintf(stderr, "Opening file: %s\n", filename); /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) @@ -293,14 +290,14 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, if(ncommon > 0) { /* Emit informational message */ if(verbose) - fprintf(stderr, "Checking common symbols\n"); + HDfprintf(stderr, "Checking common symbols\n"); /* Iterate over common datasets */ for(v = 0; v < ncommon; v++) { /* Check common dataset */ if(check_dataset(fid, verbose, sym_com[v]->name, &record, mem_sid) < 0) return -1; - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); } /* end for */ } /* end if */ @@ -308,30 +305,30 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, if(nrandom > 0) { /* Emit informational message */ if(verbose) - fprintf(stderr, "Checking random symbols\n"); + HDfprintf(stderr, "Checking random symbols\n"); /* Iterate over random datasets */ for(v = 0; v < nrandom; v++) { /* Check random dataset */ if(check_dataset(fid, verbose, sym_rand[v]->name, &record, mem_sid) < 0) return -1; - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); } /* end for */ } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing file\n"); + HDfprintf(stderr, "Closing file\n"); /* Close the file */ if(H5Fclose(fid) < 0) return -1; /* Sleep for the appropriate # of seconds */ - sleep(poll_time); + HDsleep(poll_time); /* Retrieve the current time */ - curr_time = time(NULL); + curr_time = HDtime(NULL); } /* end while */ /* Close the fapl */ @@ -344,18 +341,18 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing datasets\n"); + HDfprintf(stderr, "Closing datasets\n"); /* Close 'random' datasets, if any */ if(nrandom > 0) { /* Release array holding dataset ID's for random datasets */ - free(sym_rand); + HDfree(sym_rand); } /* end if */ /* Close 'common' datasets, if any */ if(ncommon > 0) { /* Release array holding dataset ID's for common datasets */ - free(sym_com); + HDfree(sym_com); } /* end if */ return 0; @@ -400,7 +397,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* # of common symbols to poll */ case 'h': - ncommon = atoi(argv[u + 1]); + ncommon = HDatoi(argv[u + 1]); if(ncommon < 0) usage(); u += 2; @@ -408,7 +405,7 @@ int main(int argc, const char *argv[]) /* # of random symbols to poll */ case 'l': - nrandom = atoi(argv[u + 1]); + nrandom = HDatoi(argv[u + 1]); if(nrandom < 0) usage(); u += 2; @@ -423,7 +420,7 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = 1; - temp = atoi(argv[u + 1]); + temp = HDatoi(argv[u + 1]); if(temp < 0) usage(); else @@ -433,7 +430,7 @@ int main(int argc, const char *argv[]) /* # of seconds between polling */ case 's': - poll_time = atoi(argv[u + 1]); + poll_time = HDatoi(argv[u + 1]); if(poll_time < 0) usage(); u += 2; @@ -446,7 +443,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to append */ - nseconds = atol(argv[u]); + nseconds = HDatol(argv[u]); if(nseconds <= 0) usage(); @@ -461,31 +458,31 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\t# of seconds between polling = %d\n", poll_time); - fprintf(stderr, "\t# of common symbols to poll = %d\n", ncommon); - fprintf(stderr, "\t# of random symbols to poll = %d\n", nrandom); - fprintf(stderr, "\t# of seconds to test = %ld\n", nseconds); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\t# of seconds between polling = %d\n", poll_time); + HDfprintf(stderr, "\t# of common symbols to poll = %d\n", ncommon); + HDfprintf(stderr, "\t# of random symbols to poll = %d\n", nrandom); + HDfprintf(stderr, "\t# of seconds to test = %ld\n", nseconds); } /* end if */ /* Set the random seed */ if(0 == use_seed) { struct timeval t; - gettimeofday(&t, NULL); + HDgettimeofday(&t, NULL); random_seed = (unsigned)(t.tv_usec); } /* end if */ - srandom(random_seed); + HDsrandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ - fprintf(stderr, "Using reader random seed: %u\n", random_seed); + HDfprintf(stderr, "Using reader random seed: %u\n", random_seed); /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) { - fprintf(stderr, "Error generating symbol names!\n"); - exit(1); + HDfprintf(stderr, "Error generating symbol names!\n"); + HDexit(1); } /* end if */ /* Create datatype for creating datasets */ @@ -494,28 +491,28 @@ int main(int argc, const char *argv[]) /* Reading records from datasets */ if(read_records(FILENAME, verbose, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { - fprintf(stderr, "Error reading records from datasets!\n"); - exit(1); + HDfprintf(stderr, "Error reading records from datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close objects created */ if(H5Tclose(symbol_tid) < 0) { - fprintf(stderr, "Error closing symbol datatype!\n"); - exit(1); + HDfprintf(stderr, "Error closing symbol datatype!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c index a4f030c..ce69877 100644 --- a/test/swmr_remove_writer.c +++ b/test/swmr_remove_writer.c @@ -33,9 +33,7 @@ /* Headers */ /***********/ -#include -#include - +#include "h5test.h" #include "swmr_common.h" /****************/ @@ -82,16 +80,16 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old) hsize_t dim[2]; /* Dataspace dimensions */ unsigned u, v; /* Local index variable */ - assert(filename); + HDassert(filename); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) return -1; if(!old) { - /* Set to use the latest library format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; + /* Set to use the latest library format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + return -1; } #ifdef QAK @@ -101,8 +99,8 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old) mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; H5Pget_mdc_config(fapl, &mdc_config); - fprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - fprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); + HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); + HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); mdc_config.set_initial_size = 1; mdc_config.initial_size = 16 * 1024 * 1024; /* mdc_config.epoch_length = 5000; */ @@ -124,7 +122,7 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening datasets\n"); + HDfprintf(stderr, "Opening datasets\n"); /* Open the datasets */ for(u = 0; u < NLEVELS; u++) @@ -174,7 +172,7 @@ remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned lon hsize_t dim[2] = {1,0}; /* Dataspace dimensions */ unsigned long u, v; /* Local index variables */ - assert(fid >= 0); + HDassert(fid >= 0); /* Remove records from random datasets, according to frequency distribution */ shrink_to_flush = flush_count; @@ -186,7 +184,7 @@ remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned lon symbol = choose_dataset(); /* Shrink the dataset's dataspace */ - remove_size = (hsize_t)random() % MAX_REMOVE_SIZE + 1; + remove_size = (hsize_t)HDrandom() % MAX_REMOVE_SIZE + 1; if(remove_size > symbol->nrecords) symbol->nrecords = 0; else @@ -214,7 +212,7 @@ remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned lon /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing datasets\n"); + HDfprintf(stderr, "Closing datasets\n"); /* Close the datasets */ for(u = 0; u < NLEVELS; u++) @@ -249,7 +247,7 @@ int main(int argc, const char *argv[]) long nshrinks = 0; /* # of times to shrink the dataset */ long flush_count = 1000; /* # of records to write between flushing file */ unsigned verbose = 1; /* Whether to emit some informational messages */ - unsigned old = 0; /* Whether to use non-latest-format when opening file */ + unsigned old = 0; /* Whether to use non-latest-format when opening file */ unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */ unsigned random_seed = 0; /* Random # seed */ unsigned u; /* Local index variable */ @@ -265,7 +263,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* # of records to write between flushing file */ case 'f': - flush_count = atol(argv[u + 1]); + flush_count = HDatol(argv[u + 1]); if(flush_count < 0) usage(); u += 2; @@ -280,16 +278,16 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = 1; - temp = atoi(argv[u + 1]); + temp = HDatoi(argv[u + 1]); random_seed = (unsigned)temp; u += 2; break; - /* Use non-latest-format when opening file */ + /* Use non-latest-format when opening file */ case 'o': - old = 1; - u++; - break; + old = 1; + u++; + break; default: usage(); @@ -298,7 +296,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to append */ - nshrinks = atol(argv[u]); + nshrinks = HDatol(argv[u]); if(nshrinks <= 0) usage(); @@ -313,24 +311,24 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\t# of shrinks between flushes = %ld\n", flush_count); - fprintf(stderr, "\t# of shrinks = %ld\n", nshrinks); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\t# of shrinks between flushes = %ld\n", flush_count); + HDfprintf(stderr, "\t# of shrinks = %ld\n", nshrinks); } /* end if */ /* Set the random seed */ if(0 == use_seed) { struct timeval t; - gettimeofday(&t, NULL); + HDgettimeofday(&t, NULL); random_seed = (unsigned)(t.tv_usec); } /* end if */ - srandom(random_seed); + HDsrandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ - fprintf(stderr, "Using writer random seed: %u\n", random_seed); + HDfprintf(stderr, "Using writer random seed: %u\n", random_seed); /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) @@ -338,12 +336,12 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening skeleton file: %s\n", FILENAME); + HDfprintf(stderr, "Opening skeleton file: %s\n", FILENAME); /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose, old)) < 0) { - fprintf(stderr, "Error opening skeleton file!\n"); - exit(1); + HDfprintf(stderr, "Error opening skeleton file!\n"); + HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -351,32 +349,32 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Removing records\n"); + HDfprintf(stderr, "Removing records\n"); /* Remove records from datasets */ if(remove_records(fid, verbose, (unsigned long)nshrinks, (unsigned long)flush_count) < 0) { - fprintf(stderr, "Error removing records from datasets!\n"); - exit(1); + HDfprintf(stderr, "Error removing records from datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close objects opened */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Error closing file!\n"); - exit(1); + HDfprintf(stderr, "Error closing file!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c index c7841a9..8053a8c 100644 --- a/test/swmr_sparse_reader.c +++ b/test/swmr_sparse_reader.c @@ -31,11 +31,9 @@ /* Headers */ /***********/ -#include +#include "h5test.h" #include "swmr_common.h" -#include - /****************/ /* Local Macros */ /****************/ @@ -98,10 +96,10 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t hsize_t start[2] = {0, 0}; /* Hyperslab selection values */ hsize_t count[2] = {1, 1}; /* Hyperslab selection values */ - assert(fid >= 0); - assert(symbol); - assert(record); - assert(rec_sid >= 0); + HDassert(fid >= 0); + HDassert(symbol); + HDassert(record); + HDassert(rec_sid >= 0); /* Open dataset for symbol */ if((dsid = H5Dopen2(fid, symbol->name, H5P_DEFAULT)) < 0) @@ -113,13 +111,13 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t /* Choose the random record in the dataset (will be the same as chosen by * the writer) */ - start[1] = (hsize_t)random() % symbol->nrecords; + start[1] = (hsize_t)HDrandom() % symbol->nrecords; if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) return -1; /* Emit informational message */ if(verbose) - fprintf(stderr, "Symbol = '%s', location = %lld\n", symbol->name, (long long)start); + HDfprintf(stderr, "Symbol = '%s', location = %lld\n", symbol->name, (long long)start); /* Read record from dataset */ record->rec_id = (uint64_t)ULLONG_MAX; @@ -128,10 +126,10 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t /* Verify record value */ if(record->rec_id != start[1]) { - fprintf(stderr, "*** ERROR ***\n"); - fprintf(stderr, "Incorrect record value!\n"); - fprintf(stderr, "Symbol = '%s', location = %lld, record->rec_id = %llu\n", symbol->name, (long long)start, (unsigned long long)record->rec_id); - return(-1); + HDfprintf(stderr, "*** ERROR ***\n"); + HDfprintf(stderr, "Incorrect record value!\n"); + HDfprintf(stderr, "Symbol = '%s', location = %lld, record->rec_id = %llu\n", symbol->name, (long long)start, (unsigned long long)record->rec_id); + return -1; } /* end if */ /* Close the dataset's dataspace */ @@ -187,8 +185,8 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, unsigned long u; /* Local index variable */ hid_t fapl; - assert(filename); - assert(poll_time != 0); + HDassert(filename); + HDassert(poll_time != 0); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) @@ -198,7 +196,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening file: %s\n", filename); + HDfprintf(stderr, "Opening file: %s\n", filename); /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) @@ -211,11 +209,11 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, return -1; if(H5Aclose(aid) < 0) return -1; - srandom(seed); + HDsrandom(seed); /* Reset the record */ /* (record's 'info' field might need to change for each record written, also) */ - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); /* Create a dataspace for the record to read */ if((mem_sid = H5Screate(H5S_SCALAR)) < 0) @@ -223,10 +221,10 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, /* Emit informational message */ if(verbose) - fprintf(stderr, "Reading records\n"); + HDfprintf(stderr, "Reading records\n"); /* Get the starting time */ - start_time = time(NULL); + start_time = HDtime(NULL); /* Read records */ for(u = 0; u < nrecords; u++) { @@ -264,16 +262,16 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, /* Check for timeout */ if(time(NULL) >= (time_t)(start_time + (time_t)TIMEOUT)) { - fprintf(stderr, "Reader timed out\n"); + HDfprintf(stderr, "Reader timed out\n"); return -1; } /* end if */ /* Pause */ - sleep(poll_time); + HDsleep(poll_time); - /* Retrieve and print the collection of metadata read retries */ - if(print_metadata_retries_info(fid) < 0) - fprintf(stderr, "Warning: could not obtain metadata retries info\n"); + /* Retrieve and print the collection of metadata read retries */ + if(print_metadata_retries_info(fid) < 0) + HDfprintf(stderr, "Warning: could not obtain metadata retries info\n"); /* Reopen the file */ if(H5Fclose(fid) < 0) @@ -285,23 +283,23 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, /* Emit informational message */ if(verbose) - fprintf(stderr, "Checking dataset %lu\n", u); + HDfprintf(stderr, "Checking dataset %lu\n", u); /* Check dataset */ if(check_dataset(fid, verbose, symbol, &record, mem_sid) < 0) return -1; - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); /* Check for reopen */ iter_to_reopen--; if(iter_to_reopen == 0) { /* Emit informational message */ if(verbose) - fprintf(stderr, "Reopening file: %s\n", filename); + HDfprintf(stderr, "Reopening file: %s\n", filename); - /* Retrieve and print the collection of metadata read retries */ - if(print_metadata_retries_info(fid) < 0) - fprintf(stderr, "Warning: could not obtain metadata retries info\n"); + /* Retrieve and print the collection of metadata read retries */ + if(print_metadata_retries_info(fid) < 0) + HDfprintf(stderr, "Warning: could not obtain metadata retries info\n"); /* Reopen the file */ if(H5Fclose(fid) < 0) @@ -314,7 +312,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, /* Retrieve and print the collection of metadata read retries */ if(print_metadata_retries_info(fid) < 0) - fprintf(stderr, "Warning: could not obtain metadata retries info\n"); + HDfprintf(stderr, "Warning: could not obtain metadata retries info\n"); /* Close file */ if(H5Fclose(fid) < 0) @@ -363,7 +361,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* # of reads between reopens */ case 'n': - reopen_count = atoi(argv[u + 1]); + reopen_count = HDatoi(argv[u + 1]); if(reopen_count < 0) usage(); u += 2; @@ -377,7 +375,7 @@ int main(int argc, const char *argv[]) /* # of seconds between polling */ case 's': - poll_time = atoi(argv[u + 1]); + poll_time = HDatoi(argv[u + 1]); if(poll_time < 0) usage(); u += 2; @@ -390,7 +388,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to read */ - nrecords = atol(argv[u]); + nrecords = HDatol(argv[u]); if(nrecords <= 0) usage(); @@ -401,20 +399,20 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\t# of seconds between polling = %d\n", poll_time); - fprintf(stderr, "\t# of reads between reopens = %d\n", reopen_count); - fprintf(stderr, "\t# of records to read = %ld\n", nrecords); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\t# of seconds between polling = %d\n", poll_time); + HDfprintf(stderr, "\t# of reads between reopens = %d\n", reopen_count); + HDfprintf(stderr, "\t# of records to read = %ld\n", nrecords); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) { - fprintf(stderr, "Error generating symbol names!\n"); - exit(1); + HDfprintf(stderr, "Error generating symbol names!\n"); + HDexit(1); } /* end if */ /* Create datatype for creating datasets */ @@ -423,28 +421,28 @@ int main(int argc, const char *argv[]) /* Reading records from datasets */ if(read_records(FILENAME, verbose, (unsigned long) nrecords, (unsigned)poll_time, (unsigned)reopen_count) < 0) { - fprintf(stderr, "Error reading records from datasets!\n"); - exit(1); + HDfprintf(stderr, "Error reading records from datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close objects created */ if(H5Tclose(symbol_tid) < 0) { - fprintf(stderr, "Error closing symbol datatype!\n"); - exit(1); + HDfprintf(stderr, "Error closing symbol datatype!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c index e752cb3..dbc8926 100644 --- a/test/swmr_sparse_writer.c +++ b/test/swmr_sparse_writer.c @@ -30,8 +30,7 @@ /* Headers */ /***********/ -#include - +#include "h5test.h" #include "swmr_common.h" /****************/ @@ -80,7 +79,7 @@ open_skeleton(const char *filename, unsigned verbose) unsigned seed; /* Seed for random number generator */ unsigned u, v; /* Local index variable */ - assert(filename); + HDassert(filename); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) @@ -97,8 +96,8 @@ open_skeleton(const char *filename, unsigned verbose) mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; H5Pget_mdc_config(fapl, &mdc_config); - fprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - fprintf(stderr,"mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); + HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); + HDfprintf(stderr,"mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); mdc_config.set_initial_size = 1; mdc_config.initial_size = 16 * 1024 * 1024; /* mdc_config.epoch_length = 5000; */ @@ -129,7 +128,7 @@ open_skeleton(const char *filename, unsigned verbose) return -1; if(H5Aclose(aid) < 0) return -1; - srandom(seed); + HDsrandom(seed); /* Open the datasets */ for(u = 0; u < NLEVELS; u++) @@ -185,7 +184,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f /* Reset the record */ /* (record's 'info' field might need to change for each record written, also) */ - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); /* Create a dataspace for the record to add */ if((mem_sid = H5Screate(H5S_SCALAR)) < 0) @@ -200,7 +199,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f mdc_config_orig.version = H5AC__CURR_CACHE_CONFIG_VERSION; if(H5Fget_mdc_config(fid, &mdc_config_orig) < 0) return -1; - memcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); + HDmemcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); mdc_config_cork.evictions_enabled = FALSE; mdc_config_cork.incr_mode = H5C_incr__off; mdc_config_cork.flash_incr_mode = H5C_flash_incr__off; @@ -241,7 +240,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f return -1; /* Get the coordinate to write */ - start[1] = (hsize_t)random() % symbol->nrecords; + start[1] = (hsize_t)HDrandom() % symbol->nrecords; /* Set the record's ID (equal to its position) */ record.rec_id = start[1]; @@ -385,7 +384,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to append */ - nrecords = atol(argv[u]); + nrecords = HDatol(argv[u]); if(nrecords <= 0) usage(); @@ -400,14 +399,14 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\t# of records between flushes = %ld\n", flush_count); - fprintf(stderr, "\t# of records to write = %ld\n", nrecords); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\t# of records between flushes = %ld\n", flush_count); + HDfprintf(stderr, "\t# of records to write = %ld\n", nrecords); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) @@ -415,12 +414,12 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening skeleton file: %s\n", FILENAME); + HDfprintf(stderr, "Opening skeleton file: %s\n", FILENAME); /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose)) < 0) { - fprintf(stderr, "Error opening skeleton file!\n"); - exit(1); + HDfprintf(stderr, "Error opening skeleton file!\n"); + HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -428,32 +427,32 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Adding records\n"); + HDfprintf(stderr, "Adding records\n"); /* Append records to datasets */ if(add_records(fid, verbose, (unsigned long)nrecords, (unsigned long)flush_count) < 0) { - fprintf(stderr, "Error appending records to datasets!\n"); - exit(1); + HDfprintf(stderr, "Error appending records to datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close objects opened */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Error closing file!\n"); - exit(1); + HDfprintf(stderr, "Error closing file!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index 0069bc7..ed3d6f3 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -18,12 +18,12 @@ * Created: swmr_start_write.c * * Purpose: This program enables SWMR writing mode via H5Fstart_swmr_write(). - * It writes data to a randomly selected subset of the datasets + * It writes data to a randomly selected subset of the datasets * in the SWMR test file; and it is intended to run concurrently * with the swmr_reader program. * * NOTE: The routines in this program are basically copied and modified from - * swmr*.c. + * swmr*.c. *------------------------------------------------------------------------- */ @@ -31,9 +31,7 @@ /* Headers */ /***********/ -#include -#include - +#include "h5test.h" #include "swmr_common.h" /********************/ @@ -61,12 +59,12 @@ static void usage(void); * which will be used for testing H5Fstart_swmr_write(). * * Parameters: - * filename: The SWMR test file's name. + * filename: The SWMR test file's name. * verbose: whether verbose console output is desired. * index_type: The chunk index type (b1 | b2 | ea | fa) - * random_seed: The random seed to store in the file. - * The sparse tests use this value. - * + * random_seed: The random seed to store in the file. + * The sparse tests use this value. + * * Return: Success: the file ID * Failure: -1 * @@ -86,8 +84,8 @@ create_file(const char *filename, unsigned verbose, symbol_t fillval; /* Dataset fill value */ #endif /* FILLVAL_WORKS */ - assert(filename); - assert(index_type); + HDassert(filename); + HDassert(index_type); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) @@ -101,7 +99,7 @@ create_file(const char *filename, unsigned verbose, * With one unlimited dimension, we get the extensible array index * type, with two unlimited dimensions, we get a v-2 B-tree. */ - if(!strcmp(index_type, "b2")) + if(!HDstrcmp(index_type, "b2")) max_dims[0] = H5S_UNLIMITED; /* Create file creation property list */ @@ -110,7 +108,7 @@ create_file(const char *filename, unsigned verbose, /* Emit informational message */ if(verbose) - fprintf(stderr, "Creating file without SWMR access\n"); + HDfprintf(stderr, "Creating file without SWMR access\n"); /* Create the file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) @@ -144,10 +142,10 @@ create_file(const char *filename, unsigned verbose, * Function: create_datasets * * Purpose: Create datasets (and keep them opened) which will be used for testing - * H5Fstart_swmr_write(). + * H5Fstart_swmr_write(). * * Parameters: - * fid: file ID for the SWMR test file + * fid: file ID for the SWMR test file * comp_level: the compresssion level * verbose: whether verbose console output is desired. * @@ -187,7 +185,7 @@ create_datasets(hid_t fid, int comp_level, unsigned verbose) /* Emit informational message */ if(verbose) - fprintf(stderr, "Creating datasets\n"); + HDfprintf(stderr, "Creating datasets\n"); /* Create the datasets */ for(u = 0; u < NLEVELS; u++) @@ -207,10 +205,10 @@ create_datasets(hid_t fid, int comp_level, unsigned verbose) * Function: create_close_datasets * * Purpose: Create and close datasets which will be used for testing - * H5Fstart_swmr_write(). + * H5Fstart_swmr_write(). * * Parameters: - * fid: file ID for the SWMR test file + * fid: file ID for the SWMR test file * comp_level: the compresssion level * verbose: whether verbose console output is desired. * @@ -250,7 +248,7 @@ create_close_datasets(hid_t fid, int comp_level, unsigned verbose) /* Emit informational message */ if(verbose) - fprintf(stderr, "Creating datasets\n"); + HDfprintf(stderr, "Creating datasets\n"); /* Create the datasets */ for(u = 0; u < NLEVELS; u++) @@ -284,7 +282,7 @@ create_close_datasets(hid_t fid, int comp_level, unsigned verbose) * Purpose: Opens the HDF5 test file without SWMR access. * * Parameters: - * filename: The filename of the HDF5 file to open + * filename: The filename of the HDF5 file to open * verbose: whether or not to emit verbose console messages * * Return: Success: The file ID of the opened SWMR file @@ -298,7 +296,7 @@ open_file(const char *filename, unsigned verbose) hid_t fid; /* File ID for new HDF5 file */ hid_t fapl; /* File access property list */ - assert(filename); + HDassert(filename); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) @@ -310,7 +308,7 @@ open_file(const char *filename, unsigned verbose) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening the file without SWMR access: %s\n", filename); + HDfprintf(stderr, "Opening the file without SWMR access: %s\n", filename); /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) @@ -331,7 +329,7 @@ open_file(const char *filename, unsigned verbose) * Purpose: Opens the datasets. * * Parameters: -* filename: the filename of the SWMR HDF5 file to open + * filename: the filename of the SWMR HDF5 file to open * verbose: whether or not to emit verbose console messages * * Return: Success: 0 @@ -346,7 +344,7 @@ open_datasets(hid_t fid, unsigned verbose) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening datasets\n"); + HDfprintf(stderr, "Opening datasets\n"); /* Open the datasets */ for(u = 0; u < NLEVELS; u++) @@ -367,7 +365,7 @@ open_datasets(hid_t fid, unsigned verbose) * the SWMR test file. * * Parameters: -* fid: The file ID of the SWMR HDF5 file + * fid: The file ID of the SWMR HDF5 file * verbose: Whether or not to emit verbose console messages * nrecords: # of records to write to the datasets * flush_count: # of records to write before flushing the file to disk @@ -394,7 +392,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f /* Reset the record */ /* (record's 'info' field might need to change for each record written, also) */ - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); /* Create a dataspace for the record to add */ if((mem_sid = H5Screate(H5S_SCALAR)) < 0) @@ -409,7 +407,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f mdc_config_orig.version = H5AC__CURR_CACHE_CONFIG_VERSION; if(H5Fget_mdc_config(fid, &mdc_config_orig) < 0) return -1; - memcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); + HDmemcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); mdc_config_cork.evictions_enabled = FALSE; mdc_config_cork.incr_mode = H5C_incr__off; mdc_config_cork.flash_incr_mode = H5C_flash_incr__off; @@ -479,7 +477,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing datasets\n"); + HDfprintf(stderr, "Closing datasets\n"); /* Close the datasets */ for(u = 0; u < NLEVELS; u++) @@ -525,16 +523,16 @@ usage(void) */ int main(int argc, const char *argv[]) { - hid_t fid; /* File ID for file opened */ - long nrecords = 0; /* # of records to append */ - long flush_count = 10000; /* # of records to write between flushing file */ - unsigned verbose = 1; /* Whether to emit some informational messages */ - unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */ - unsigned random_seed = 0; /* Random # seed */ - int comp_level = -1; /* Compression level (-1 is no compression) */ - const char *index_type = "b1"; /* Chunk index type */ - unsigned u; /* Local index variable */ - int temp; /* Temporary variable */ + hid_t fid; /* File ID for file opened */ + long nrecords = 0; /* # of records to append */ + long flush_count = 10000; /* # of records to write between flushing file */ + unsigned verbose = 1; /* Whether to emit some informational messages */ + unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */ + unsigned random_seed = 0; /* Random # seed */ + int comp_level = -1; /* Compression level (-1 is no compression) */ + const char *index_type = "b1"; /* Chunk index type */ + unsigned u; /* Local index variable */ + int temp; /* Temporary variable */ /* Parse command line options */ if(argc < 2) @@ -544,9 +542,9 @@ int main(int argc, const char *argv[]) while(u < (unsigned)argc) { if(argv[u][0] == '-') { switch(argv[u][1]) { - /* Compress dataset chunks */ + /* Compress dataset chunks */ case 'c': - comp_level = atoi(argv[u + 1]); + comp_level = HDatoi(argv[u + 1]); if(comp_level < -1 || comp_level > 9) usage(); u += 2; @@ -555,15 +553,15 @@ int main(int argc, const char *argv[]) /* Chunk index type */ case 'i': index_type = argv[u + 1]; - if(strcmp(index_type, "ea") - && strcmp(index_type, "b2")) + if(HDstrcmp(index_type, "ea") + && HDstrcmp(index_type, "b2")) usage(); u += 2; break; /* # of records to write between flushing file */ case 'f': - flush_count = atol(argv[u + 1]); + flush_count = HDatol(argv[u + 1]); if(flush_count < 0) usage(); u += 2; @@ -578,7 +576,7 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = 1; - temp = atoi(argv[u + 1]); + temp = HDatoi(argv[u + 1]); if(temp < 0) usage(); else @@ -593,7 +591,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to append */ - nrecords = atol(argv[u]); + nrecords = HDatol(argv[u]); if(nrecords <= 0) usage(); @@ -609,32 +607,32 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\tindex type = %s\n", index_type); - fprintf(stderr, "\tcompression level = %d\n", comp_level); - fprintf(stderr, "\t# of records between flushes = %ld\n", flush_count); - fprintf(stderr, "\t# of records to write = %ld\n", nrecords); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\tindex type = %s\n", index_type); + HDfprintf(stderr, "\tcompression level = %d\n", comp_level); + HDfprintf(stderr, "\t# of records between flushes = %ld\n", flush_count); + HDfprintf(stderr, "\t# of records to write = %ld\n", nrecords); } /* end if */ /* Set the random seed */ if(0 == use_seed) { struct timeval t; - gettimeofday(&t, NULL); + HDgettimeofday(&t, NULL); random_seed = (unsigned)(t.tv_usec); } /* end if */ - srandom(random_seed); + HDsrandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ - fprintf(stderr, "Using writer random seed: %u\n", random_seed); + HDfprintf(stderr, "Using writer random seed: %u\n", random_seed); /* Create the test file */ if((fid = create_file(FILENAME, verbose, index_type, random_seed)) < 0) { - fprintf(stderr, "Error creating the file...\n"); - exit(1); + HDfprintf(stderr, "Error creating the file...\n"); + HDexit(1); } /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) @@ -642,43 +640,43 @@ int main(int argc, const char *argv[]) /* Create the datasets in the file */ if(create_datasets(fid, comp_level, verbose) < 0) { - fprintf(stderr, "Error creating datasets...\n"); - exit(1); + HDfprintf(stderr, "Error creating datasets...\n"); + HDexit(1); } /* Enable SWMR writing mode */ if(H5Fstart_swmr_write(fid) < 0) { - fprintf(stderr, "Error starting SWMR writing mode...\n"); - exit(1); + HDfprintf(stderr, "Error starting SWMR writing mode...\n"); + HDexit(1); } #ifdef OUT /* Emit informational message */ if(verbose) - fprintf(stderr, "Creating and closing datasets: %s\n", FILENAME); + HDfprintf(stderr, "Creating and closing datasets: %s\n", FILENAME); /* Create and close the datasets in the file */ if(create_close_datasets(fid, comp_level, verbose) < 0) { - fprintf(stderr, "Error creating datasets...\n"); - exit(1); + HDfprintf(stderr, "Error creating datasets...\n"); + HDexit(1); } /* Close the file */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Error closing file!\n"); - exit(1); + HDfprintf(stderr, "Error closing file!\n"); + HDexit(1); } /* end if */ /* Open the file */ if((fid = open_file(FILENAME, verbose)) < 0) { - fprintf(stderr, "Error opening the file...\n"); - exit(1); + HDfprintf(stderr, "Error opening the file...\n"); + HDexit(1); } /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) @@ -686,19 +684,19 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening datasets: %s\n", FILENAME); + HDfprintf(stderr, "Opening datasets: %s\n", FILENAME); /* Open the file's datasets */ if(open_datasets(fid, verbose) < 0) { - fprintf(stderr, "Error opening datasets...\n"); - exit(1); + HDfprintf(stderr, "Error opening datasets...\n"); + HDexit(1); } /* end if */ /* Enable SWMR writing mode */ if(H5Fstart_swmr_write(fid) < 0) { - fprintf(stderr, "Error starting SWMR writing mode...\n"); - exit(1); + HDfprintf(stderr, "Error starting SWMR writing mode...\n"); + HDexit(1); } #endif @@ -707,32 +705,32 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Adding records\n"); + HDfprintf(stderr, "Adding records\n"); /* Append records to datasets */ if(add_records(fid, verbose, (unsigned long)nrecords, (unsigned long)flush_count) < 0) { - fprintf(stderr, "Error appending records to datasets!\n"); - exit(1); + HDfprintf(stderr, "Error appending records to datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing the file\n"); + HDfprintf(stderr, "Closing the file\n"); /* Close objects opened */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Error closing file!\n"); - exit(1); + HDfprintf(stderr, "Error closing file!\n"); + HDexit(1); } /* end if */ return 0; diff --git a/test/swmr_writer.c b/test/swmr_writer.c index 4ab6287..330599a 100644 --- a/test/swmr_writer.c +++ b/test/swmr_writer.c @@ -30,9 +30,7 @@ /* Headers */ /***********/ -#include -#include - +#include "h5test.h" #include "swmr_common.h" /********************/ @@ -70,16 +68,16 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old) hid_t fapl; /* File access property list */ unsigned u, v; /* Local index variable */ - assert(filename); + HDassert(filename); /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) return -1; if(!old) { - /* Set to use the latest library format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; + /* Set to use the latest library format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + return -1; } #ifdef QAK @@ -89,8 +87,8 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old) mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; H5Pget_mdc_config(fapl, &mdc_config); - fprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - fprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); + HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); + HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); mdc_config.set_initial_size = 1; mdc_config.initial_size = 16 * 1024 * 1024; /* mdc_config.epoch_length = 5000; */ @@ -112,7 +110,7 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening datasets\n"); + HDfprintf(stderr, "Opening datasets\n"); /* Open the datasets */ for(u = 0; u < NLEVELS; u++) @@ -162,11 +160,11 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f unsigned long rec_to_flush; /* # of records left to write before flush */ unsigned long u, v; /* Local index variables */ - assert(fid >= 0); + HDassert(fid >= 0); /* Reset the record */ /* (record's 'info' field might need to change for each record written, also) */ - memset(&record, 0, sizeof(record)); + HDmemset(&record, 0, sizeof(record)); /* Create a dataspace for the record to add */ if((mem_sid = H5Screate(H5S_SCALAR)) < 0) @@ -181,7 +179,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f mdc_config_orig.version = H5AC__CURR_CACHE_CONFIG_VERSION; if(H5Fget_mdc_config(fid, &mdc_config_orig) < 0) return -1; - memcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); + HDmemcpy(&mdc_config_cork, &mdc_config_orig, sizeof(mdc_config_cork)); mdc_config_cork.evictions_enabled = FALSE; mdc_config_cork.incr_mode = H5C_incr__off; mdc_config_cork.flash_incr_mode = H5C_flash_incr__off; @@ -260,7 +258,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing datasets\n"); + HDfprintf(stderr, "Closing datasets\n"); /* Close the datasets */ for(u = 0; u < NLEVELS; u++) @@ -297,7 +295,7 @@ int main(int argc, const char *argv[]) long nrecords = 0; /* # of records to append */ long flush_count = 10000; /* # of records to write between flushing file */ unsigned verbose = 1; /* Whether to emit some informational messages */ - unsigned old = 0; /* Whether to use non-latest-format when opening file */ + unsigned old = 0; /* Whether to use non-latest-format when opening file */ unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */ unsigned random_seed = 0; /* Random # seed */ unsigned u; /* Local index variable */ @@ -313,7 +311,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* # of records to write between flushing file */ case 'f': - flush_count = atol(argv[u + 1]); + flush_count = HDatol(argv[u + 1]); if(flush_count < 0) usage(); u += 2; @@ -328,12 +326,12 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = 1; - temp = atoi(argv[u + 1]); + temp = HDatoi(argv[u + 1]); random_seed = (unsigned)temp; u += 2; break; - /* Use non-latest-format when opening file */ + /* Use non-latest-format when opening file */ case 'o': old = 1; u++; @@ -346,7 +344,7 @@ int main(int argc, const char *argv[]) } /* end if */ else { /* Get the number of records to append */ - nrecords = atol(argv[u]); + nrecords = HDatol(argv[u]); if(nrecords <= 0) usage(); @@ -361,24 +359,24 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { - fprintf(stderr, "Parameters:\n"); - fprintf(stderr, "\t# of records between flushes = %ld\n", flush_count); - fprintf(stderr, "\t# of records to write = %ld\n", nrecords); + HDfprintf(stderr, "Parameters:\n"); + HDfprintf(stderr, "\t# of records between flushes = %ld\n", flush_count); + HDfprintf(stderr, "\t# of records to write = %ld\n", nrecords); } /* end if */ /* Set the random seed */ if(0 == use_seed) { struct timeval t; - gettimeofday(&t, NULL); + HDgettimeofday(&t, NULL); random_seed = (unsigned)(t.tv_usec); } /* end if */ - srandom(random_seed); + HDsrandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ - fprintf(stderr, "Using writer random seed: %u\n", random_seed); + HDfprintf(stderr, "Using writer random seed: %u\n", random_seed); /* Emit informational message */ if(verbose) - fprintf(stderr, "Generating symbol names\n"); + HDfprintf(stderr, "Generating symbol names\n"); /* Generate dataset names */ if(generate_symbols() < 0) @@ -386,12 +384,12 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening skeleton file: %s\n", FILENAME); + HDfprintf(stderr, "Opening skeleton file: %s\n", FILENAME); /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose, old)) < 0) { - fprintf(stderr, "Error opening skeleton file!\n"); - exit(1); + HDfprintf(stderr, "Error opening skeleton file!\n"); + HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -399,32 +397,32 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - fprintf(stderr, "Adding records\n"); + HDfprintf(stderr, "Adding records\n"); /* Append records to datasets */ if(add_records(fid, verbose, (unsigned long)nrecords, (unsigned long)flush_count) < 0) { - fprintf(stderr, "Error appending records to datasets!\n"); - exit(1); + HDfprintf(stderr, "Error appending records to datasets!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Releasing symbols\n"); + HDfprintf(stderr, "Releasing symbols\n"); /* Clean up the symbols */ if(shutdown_symbols() < 0) { - fprintf(stderr, "Error releasing symbols!\n"); - exit(1); + HDfprintf(stderr, "Error releasing symbols!\n"); + HDexit(1); } /* end if */ /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing objects\n"); + HDfprintf(stderr, "Closing objects\n"); /* Close objects opened */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Error closing file!\n"); - exit(1); + HDfprintf(stderr, "Error closing file!\n"); + HDexit(1); } /* end if */ return 0; -- cgit v0.12 From 8ac8326061be02272aaebeaf0d6c118fd8a00cca Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 23 Feb 2016 16:22:30 -0500 Subject: [svn-r29193] Added POSIX wrappers for a few SWMR test functions that were missed. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial CMake serial (build only) --- test/swmr_addrem_writer.c | 2 +- test/swmr_common.c | 2 +- test/swmr_generator.c | 6 +++--- test/swmr_reader.c | 6 +++--- test/swmr_remove_reader.c | 4 ++-- test/swmr_remove_writer.c | 2 +- test/swmr_sparse_reader.c | 4 ++-- test/swmr_sparse_writer.c | 6 +++--- test/swmr_start_write.c | 4 ++-- test/swmr_writer.c | 2 +- test/vds_swmr_reader.c | 2 +- test/vds_swmr_writer.c | 6 +++--- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c index 3034da5..fb5cb8e 100644 --- a/test/swmr_addrem_writer.c +++ b/test/swmr_addrem_writer.c @@ -317,7 +317,7 @@ usage(void) printf("Defaults to verbose (no '-q' given), flushing every 1000 operations\n"); printf("('-f 1000'), and will generate a random seed (no -r given).\n"); printf("\n"); - exit(1); + HDexit(1); } int main(int argc, const char *argv[]) diff --git a/test/swmr_common.c b/test/swmr_common.c index 96e4b76..8bd98b6 100644 --- a/test/swmr_common.c +++ b/test/swmr_common.c @@ -202,7 +202,7 @@ generate_symbols(void) char name_buf[64]; generate_name(name_buf, u, v); - symbol_info[u][v].name = (char *)HDmalloc(strlen(name_buf) + 1); + symbol_info[u][v].name = (char *)HDmalloc(HDstrlen(name_buf) + 1); HDstrcpy(symbol_info[u][v].name, name_buf); symbol_info[u][v].dsid = -1; symbol_info[u][v].nrecords = 0; diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 23341c8..3b782da 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -253,7 +253,7 @@ usage(void) printf("compression ('-c -1'), v1 b-tree indexing (-i b1), and will generate a random\n"); printf("seed (no -r given).\n"); printf("\n"); - exit(1); + HDexit(1); } /* end usage() */ int main(int argc, const char *argv[]) @@ -284,8 +284,8 @@ int main(int argc, const char *argv[]) /* Chunk index type */ case 'i': index_type = argv[u + 1]; - if(strcmp(index_type, "ea") - && strcmp(index_type, "b2")) + if(HDstrcmp(index_type, "ea") + && HDstrcmp(index_type, "b2")) usage(); u += 2; break; diff --git a/test/swmr_reader.c b/test/swmr_reader.c index ea91f07..24b5366 100644 --- a/test/swmr_reader.c +++ b/test/swmr_reader.c @@ -205,7 +205,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Allocate space for 'common' datasets, if any */ if(ncommon > 0) { /* Allocate array to hold pointers to symbols for common datasets */ - if(NULL == (sym_com = (symbol_info_t **)malloc(sizeof(symbol_info_t *) * ncommon))) + if(NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon))) return -1; /* Open the common datasets */ @@ -313,7 +313,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, HDsleep(poll_time); /* Retrieve the current time */ - curr_time = time(NULL); + curr_time = HDtime(NULL); } /* end while */ /* Close the memory dataspace */ @@ -359,7 +359,7 @@ usage(void) printf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); printf("and will generate a random seed (no -r given).\n"); printf("\n"); - exit(1); + HDexit(1); } int main(int argc, const char *argv[]) diff --git a/test/swmr_remove_reader.c b/test/swmr_remove_reader.c index a241481..689b010 100644 --- a/test/swmr_remove_reader.c +++ b/test/swmr_remove_reader.c @@ -268,7 +268,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, HDfprintf(stderr, "Reading records\n"); /* Get the starting time */ - start_time = time(NULL); + start_time = HDtime(NULL); curr_time = start_time; /* Create file access property list */ @@ -372,7 +372,7 @@ usage(void) printf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); printf("and will generate a random seed (no -r given).\n"); printf("\n"); - exit(1); + HDexit(1); } int main(int argc, const char *argv[]) diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c index ce69877..8f111a2 100644 --- a/test/swmr_remove_writer.c +++ b/test/swmr_remove_writer.c @@ -238,7 +238,7 @@ usage(void) printf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); printf("flushing every 1000 shrinks ('-f 1000'), and will generate a random seed (no -r given).\n"); printf("\n"); - exit(1); + HDexit(1); } int main(int argc, const char *argv[]) diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c index 8053a8c..f755cd2 100644 --- a/test/swmr_sparse_reader.c +++ b/test/swmr_sparse_reader.c @@ -261,7 +261,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, } /* end if */ /* Check for timeout */ - if(time(NULL) >= (time_t)(start_time + (time_t)TIMEOUT)) { + if(HDtime(NULL) >= (time_t)(start_time + (time_t)TIMEOUT)) { HDfprintf(stderr, "Reader timed out\n"); return -1; } /* end if */ @@ -340,7 +340,7 @@ usage(void) printf("Note that the # of records *must* be the same as that supplied to\n"); printf("swmr_sparse_writer\n"); printf("\n"); - exit(1); + HDexit(1); } /* end usage() */ int main(int argc, const char *argv[]) diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c index dbc8926..66afb3b 100644 --- a/test/swmr_sparse_writer.c +++ b/test/swmr_sparse_writer.c @@ -180,7 +180,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f hsize_t dim[2] = {1,0}; /* Dataspace dimensions */ unsigned long u, v; /* Local index variables */ - assert(fid >= 0); + HDassert(fid >= 0); /* Reset the record */ /* (record's 'info' field might need to change for each record written, also) */ @@ -344,7 +344,7 @@ usage(void) printf("Defaults to verbose (no '-q' given) and flushing every 1000 records\n"); printf("('-f 1000')\n"); printf("\n"); - exit(1); + HDexit(1); } int main(int argc, const char *argv[]) @@ -365,7 +365,7 @@ int main(int argc, const char *argv[]) switch(argv[u][1]) { /* # of records to write between flushing file */ case 'f': - flush_count = atol(argv[u + 1]); + flush_count = HDatol(argv[u + 1]); if(flush_count < 0) usage(); u += 2; diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index ed3d6f3..fe8690f 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -388,7 +388,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f unsigned long rec_to_flush; /* # of records left to write before flush */ unsigned long u, v; /* Local index variables */ - assert(fid >= 0); + HDassert(fid >= 0); /* Reset the record */ /* (record's 'info' field might need to change for each record written, also) */ @@ -511,7 +511,7 @@ usage(void) printf("v1 b-tree indexing (-i b1), compression ('-c -1'),\n"); printf("will generate a random seed (no -r given), and verbose (no '-q' given)\n"); printf("\n"); - exit(1); + HDexit(1); } /* usage() */ /* diff --git a/test/swmr_writer.c b/test/swmr_writer.c index 330599a..afeab7ee1 100644 --- a/test/swmr_writer.c +++ b/test/swmr_writer.c @@ -286,7 +286,7 @@ usage(void) printf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); printf("flushing every 10000 records ('-f 10000'), and will generate a random seed (no -r given).\n"); printf("\n"); - exit(1); + HDexit(1); } int main(int argc, const char *argv[]) diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index 34cb3eb..7a08c62 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -134,7 +134,7 @@ error: if(fsid >= 0) (void)H5Sclose(fsid); if(buffer != NULL) - free(buffer); + HDfree(buffer); } H5E_END_TRY HDfprintf(stderr, "ERROR: SWMR reader exited with errors\n"); diff --git a/test/vds_swmr_writer.c b/test/vds_swmr_writer.c index fa1d1a0..1029192 100644 --- a/test/vds_swmr_writer.c +++ b/test/vds_swmr_writer.c @@ -52,7 +52,7 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } - file_number = atoi(argv[1]); + file_number = HDatoi(argv[1]); if(file_number < 0 || file_number >= N_SOURCES) TEST_ERROR @@ -110,8 +110,8 @@ main(int argc, char *argv[]) TEST_ERROR /* Wait one second between writing planes */ - delay = time(0) + 1; - while(time(0) < delay) + delay = HDtime(0) + 1; + while(HDtime(0) < delay) ; /* Flush */ -- cgit v0.12 From 79b36d3a6a14b8478c0a77fb8596cbc72121d3f5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 24 Feb 2016 20:01:52 -0500 Subject: [svn-r29205] Merge from trunk: r28635, 28902, 29030, 29034, 29035, 29119, 29132, 29158 Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial (debug w/ C++ & Fortran) --- MANIFEST | 3 - configure.ac | 2 + src/H5private.h | 4 +- test/external.c | 1216 ++++++++++++++++++++++++++-------------------------- test/gen_udlinks.c | 3 - test/h5test.c | 294 +++++++++++++ test/h5test.h | 17 + test/links.c | 2 +- 8 files changed, 914 insertions(+), 627 deletions(-) diff --git a/MANIFEST b/MANIFEST index 0cbdda3..e90b0cc 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2706,9 +2706,6 @@ # Files generated by autogen ./aclocal.m4 -./autom4te.cache/output.0 -./autom4te.cache/requests -./autom4te.cache/traces.0 ./bin/compile ./bin/config.guess ./bin/config.sub diff --git a/configure.ac b/configure.ac index 1224af7..49ca050 100644 --- a/configure.ac +++ b/configure.ac @@ -3168,6 +3168,8 @@ if test "X$withval" = "Xv16"; then elif test "X$withval" = "Xv18"; then AC_MSG_RESULT([v18]) DEFAULT_API_VERSION=v18 + AC_DEFINE([USE_18_API_DEFAULT], [1], + [Define using v1.8 public API symbols by default]) elif test "X$withval" = "Xv110"; then AC_MSG_RESULT([v110]) DEFAULT_API_VERSION=v110 diff --git a/src/H5private.h b/src/H5private.h index b4fbc26..11d2a05 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1255,7 +1255,9 @@ typedef off_t h5_stat_size_t; #ifndef HDsnprintf #define HDsnprintf snprintf /*varargs*/ #endif /* HDsnprintf */ -/* sprintf() variable arguments */ +#ifndef HDsprintf + #define HDsprintf sprintf /*varargs*/ +#endif /* HDsprintf */ #ifndef HDsqrt #define HDsqrt(X) sqrt(X) #endif /* HDsqrt */ diff --git a/test/external.c b/test/external.c index cbc9fc6..181f43b 100644 --- a/test/external.c +++ b/test/external.c @@ -17,977 +17,955 @@ * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Purpose: Tests datasets stored in external raw files. + * Purpose: Tests datasets stored in external raw files. */ #include "h5test.h" -#include "H5srcdir.h" - -/* File for external link test. Created with gen_udlinks.c */ -#define LINKED_FILE "be_extlink2.h5" const char *FILENAME[] = { "extern_1", "extern_2", "extern_3", - "extern_4", NULL }; /*------------------------------------------------------------------------- - * Function: same_contents - * - * Purpose: Determines whether two files are exactly the same. + * Function: files_have_same_contents * - * Return: Success: nonzero if same, zero if different. + * Purpose: Determines whether two files contain the same data. * - * Failure: zero + * Return: Success: nonzero if same, zero if different. + * Failure: zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ -static int -same_contents (const char *name1, const char *name2) +static hbool_t +files_have_same_contents(const char *name1, const char *name2) { - int fd1, fd2; - ssize_t n1, n2; - char buf1[1024], buf2[1024]; + int fd1 = 0, fd2 = 0; + ssize_t n1, n2; + char buf1[1024], buf2[1024]; + hbool_t ret = false; /* not equal until proven otherwise */ - fd1 = HDopen(name1, O_RDONLY, 0666); - fd2 = HDopen(name2, O_RDONLY, 0666); - assert(fd1 >= 0 && fd2 >= 0); + if((fd1 = HDopen(name1, O_RDONLY, 0666)) < 0) + goto out; + if((fd2 = HDopen(name2, O_RDONLY, 0666)) < 0) + goto out; + /* Loop until files are empty or we encounter a problem */ while(1) { - /* Asserts will catch negative return values */ + HDmemset(buf1, 0, sizeof(buf1)); + HDmemset(buf2, 0, sizeof(buf2)); + n1 = HDread(fd1, buf1, sizeof(buf1)); + if(n1 < 0 || (size_t)n1 > sizeof(buf1)) + break; n2 = HDread(fd2, buf2, sizeof(buf2)); - assert(n1 >= 0 && (size_t)n1 <= sizeof(buf1)); - assert(n2 >= 0 && (size_t)n2 <= sizeof(buf2)); - assert(n1 == n2); + if(n2 < 0 || (size_t)n2 > sizeof(buf2)) + break; + + if(n1 != n2) + break; - if(n1 == 0 && n2 == 0) + if(n1 == 0 && n2 == 0) { + ret = true; break; - if(HDmemcmp(buf1, buf2, (size_t)n1)) { - HDclose(fd1); - HDclose(fd2); - return 0; } - } - HDclose(fd1); - HDclose(fd2); - return 1; -} + + if(HDmemcmp(buf1, buf2, (size_t)n1)) + break; + + } /* end while */ + +out: + if(fd1) + HDclose(fd1); + if(fd2) + HDclose(fd2); + return ret; +} /* end files_have_same_contents() */ /*------------------------------------------------------------------------- - * Function: test_1a + * Function: test_non_extendible * - * Purpose: Tests a non-extendible dataset with a single external file. + * Purpose: Tests a non-extendible dataset with a single external file. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: 1 * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1a(hid_t file) +test_non_extendible(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*data space current size */ - hsize_t max_size[1]; /*data space maximum size */ - int n; /*number of external files */ - char name[256]; /*external file name */ - off_t file_offset; /*external file offset */ - hsize_t file_size; /*sizeof external file segment */ - haddr_t dset_addr; /*address of dataset */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ + haddr_t dset_addr; /* address of dataset */ TESTING("fixed-size data space, exact storage"); /* Create the dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int))) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) + FAIL_STACK_ERROR + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR /* Read dataset creation information */ - if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* Test dataset address. Should be undefined. */ H5E_BEGIN_TRY { dset_addr = H5Dget_offset(dset); } H5E_END_TRY; - if(dset_addr != HADDR_UNDEF) goto error; - - if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; - if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if(dset_addr != HADDR_UNDEF) + FAIL_STACK_ERROR + + /* Check external count */ + if((dcpl = H5Dget_create_plist(dset)) < 0) + FAIL_STACK_ERROR + if((n = H5Pget_external_count(dcpl)) < 0) + FAIL_STACK_ERROR if(1 != n) { - H5_FAILED(); - puts(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); - goto error; - } + H5_FAILED(); + HDputs(" Returned external count is wrong."); + printf(" got: %d\n ans: 1\n", n); + goto error; + } /* end if */ + HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, - &file_size) < 0) goto error; + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + FAIL_STACK_ERROR + + /* Check file offset */ if(file_offset != 0) { - H5_FAILED(); - puts(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); - goto error; - } + H5_FAILED(); + HDputs(" Wrong file offset."); + printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + goto error; + } /* end if */ + + /* Check file size */ if(file_size != (max_size[0] * sizeof(int))) { - H5_FAILED(); - puts(" Wrong file size."); - printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, - (unsigned long)max_size[0]*sizeof(int)); - goto error; - } - if (H5Pclose (dcpl) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; + H5_FAILED(); + HDputs(" Wrong file size."); + printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); + goto error; + } /* end if */ + + /* Done (dataspace was previously closed) */ + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR PASSED(); return 0; + error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); } H5E_END_TRY; return 1; -} +} /* end test_non_extendible() */ /*------------------------------------------------------------------------- - * Function: test_1b + * Function: test_too_small * - * Purpose: Test a single external file which is too small to represent - * all the data. + * Purpose: Test a single external file which is too small to represent + * all the data. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: 1 * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1b(hid_t file) +test_too_small(hid_t file) { - hid_t dcpl = -1; /*dataset creation properties */ - hid_t space = -1; /*data space */ - hid_t dset = -1; /*dataset */ - hsize_t cur_size[1]; /*current data space size */ - hsize_t max_size[1]; /*maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("external storage is too small"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; - if(dset >= 0) { - H5_FAILED(); - puts(" Small external file succeeded instead of failing."); - goto error; - } - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + if(dset >= 0) + FAIL_PUTS_ERROR(" Small external file succeeded instead of failing."); + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Sclose(space); - H5Pclose(dcpl); - H5Dclose(dset); + H5Sclose(space); + H5Pclose(dcpl); + H5Dclose(dset); } H5E_END_TRY; return 1; -} +} /* end test_too_small() */ /*------------------------------------------------------------------------- - * Function: test_1c + * Function: test_large_enough_current_eventual * - * Purpose: Test a single external file which is large enough to - * represent the current data and large enough to represent the - * eventual size of the data. + * Purpose: Test a single external file which is large enough to + * represent the current data and large enough to represent the + * eventual size of the data. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: 1 * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1c(hid_t file) +test_large_enough_current_eventual(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*current data space size */ - hsize_t max_size[1]; /*maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, exact external size"); - if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int))) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_large_enough_current_eventual() */ /*------------------------------------------------------------------------- - * Function: test_1d - * - * Purpose: Test a single external file which is large enough for the - * current data size but not large enough for the eventual size. + * Function: test_large_enough_current_not_eventual * - * Return: Success: 0 + * Purpose: Test a single external file which is large enough for the + * current data size but not large enough for the eventual size. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1d(hid_t file) +test_large_enough_current_not_eventual(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*current data space size */ - hsize_t max_size[1]; /*maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, external storage is too small"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; - if(dset >= 0) { - H5_FAILED(); - puts(" Small external file succeeded instead of failing."); - goto error; - } - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + if(dset >= 0) + FAIL_PUTS_ERROR(" Small external file succeeded instead of failing."); + + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_large_enough_current_not_eventual() */ /*------------------------------------------------------------------------- - * Function: test_1e - * - * Purpose: Test a single external file of unlimited size and an - * unlimited data space. + * Function: test_1e * - * Return: Success: 0 + * Purpose: Test a single external file of unlimited size and an + * unlimited data space. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1e(hid_t file) +test_unlimited(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*data space current size */ - hsize_t max_size[1]; /*data space maximum size */ - int n; /*number of external files */ - char name[256]; /*external file name */ - off_t file_offset; /*external file offset */ - hsize_t file_size; /*sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) + FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = H5S_UNLIMITED; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR /* Read dataset creation information */ - if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) goto error; - if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; - if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((dcpl = H5Dget_create_plist(dset)) < 0) + FAIL_STACK_ERROR + if((n = H5Pget_external_count(dcpl)) < 0) + FAIL_STACK_ERROR if(1 != n) { - H5_FAILED(); - puts(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); - goto error; - } + H5_FAILED(); + HDputs(" Returned external count is wrong."); + printf(" got: %d\n ans: 1\n", n); + goto error; + } /* end if */ + HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, - &file_size) < 0) goto error; + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + FAIL_STACK_ERROR if(file_offset != 0) { - H5_FAILED(); - puts(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); - goto error; - } + H5_FAILED(); + HDputs(" Wrong file offset."); + printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + goto error; + } /* end if */ + if(H5F_UNLIMITED != file_size) { - H5_FAILED(); - puts(" Wrong file size."); - printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); - goto error; - } - if(H5Pclose(dcpl) < 0) goto error; - if(H5Dclose(dset) < 0) goto error; + H5_FAILED(); + HDputs(" Wrong file size."); + printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); + goto error; + } /* end if */ + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_unlimited() */ /*------------------------------------------------------------------------- - * Function: test_1f - * - * Purpose: Test multiple external files for a dataset. + * Function: test_multiple_files * - * Return: Success: 0 + * Purpose: Test multiple external files for a dataset. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1f(hid_t file) +test_multiple_files(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*data space current size */ - hsize_t max_size[1]; /*data space maximum size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* dataspace */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ TESTING("multiple external files"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if(H5Pset_external(dcpl, "ext2.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if(H5Pset_external(dcpl, "ext3.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if(H5Pset_external(dcpl, "ext4.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_multiple_files() */ /*------------------------------------------------------------------------- - * Function: test_1g - * - * Purpose: It should be impossible to define an unlimited external file - * and then follow it with another external file. + * Function: test_add_to_unlimited * - * Return: Success: 0 + * Purpose: It should be impossible to define an unlimited external file + * and then follow it with another external file. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1g(void) +test_add_to_unlimited(void) { - hid_t dcpl=-1; /*dataset creation properties */ - herr_t status; /*function return status */ - int n; /*number of external files */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* function return status */ + int n; /* number of external files */ TESTING("external file following unlimited file"); - if ((dcpl=H5Pcreate (H5P_DATASET_CREATE)) < 0) goto error; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; + + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; - if (status>=0) { - H5_FAILED(); - puts (" H5Pset_external() succeeded when it should have failed."); - goto error; - } - if ((n = H5Pget_external_count(dcpl)) < 0) goto error; - if (1!=n) { - H5_FAILED(); - puts(" Wrong external file count returned."); - goto error; - } - if (H5Pclose(dcpl) < 0) goto error; + if(status >= 0) + FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); + + if((n = H5Pget_external_count(dcpl)) < 0) + FAIL_STACK_ERROR + if(1 != n) + FAIL_PUTS_ERROR(" Wrong external file count returned."); + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY; return 1; -} +} /* end test_add_to_unlimited() */ /*------------------------------------------------------------------------- - * Function: test_1h + * Function: test_overflow * - * Purpose: It should be impossible to create a set of external files - * whose total size overflows a size_t integer. + * Purpose: It should be impossible to create a set of external files + * whose total size overflows a size_t integer. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: 1 * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1h(void) +test_overflow(void) { - hid_t dcpl=-1; /*dataset creation properties */ - herr_t status; /*return status */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* return status */ TESTING("address overflow in external files"); - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) goto error; + + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; - if (status>=0) { - H5_FAILED(); - puts(" H5Pset_external() succeeded when it should have failed."); - goto error; - } - if (H5Pclose(dcpl) < 0) goto error; + if(status >= 0) + FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY; return 1; -} +} /* end test_overflow() */ /*------------------------------------------------------------------------- - * Function: test_2 + * Function: test_read_file_set * - * Purpose: Tests reading from an external file set. + * Purpose: Tests reading from an external file set. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: 1 * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_2 (hid_t fapl) +test_read_file_set(hid_t fapl) { - hid_t file=-1; /*file to write to */ - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hid_t grp=-1; /*group to emit diagnostics */ - int fd; /*external file descriptors */ - size_t i, j; /*miscellaneous counters */ - hssize_t n; /*bytes of I/O */ - char filename[1024]; /*file names */ - int part[25], whole[100]; /*raw data buffers */ - hsize_t cur_size; /*current data space size */ - hid_t hs_space; /*hyperslab data space */ - hsize_t hs_start = 30; /*hyperslab starting offset */ - hsize_t hs_count = 25; /*hyperslab size */ - int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hid_t grp = -1; /* group to emit diagnostics */ + int fd = -1; /* external file descriptors */ + size_t i, j; /* miscellaneous counters */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file names */ + int part[25], whole[100]; /* raw data buffers */ + hsize_t cur_size; /* current data space size */ + hid_t hs_space; /* hyperslab data space */ + hsize_t hs_start = 30; /* hyperslab starting offset */ + hsize_t hs_count = 25; /* hyperslab size */ + int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("read external dataset"); /* Write the data to external files directly */ - for (i=0; i<4; i++) { - for (j=0; j<25; j++) { - part[j] = (int)(i*25+j); - } - sprintf (filename, "extern_%lua.raw", (unsigned long)i+1); - fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666); - assert (fd>=0); -/* n = lseek (fd, (off_t)(i*10), SEEK_SET); -*/ - n = HDwrite(fd,temparray,(size_t)i*10); - assert (n>=0 && (size_t)n==i*10); - n = HDwrite(fd, part, sizeof(part)); - assert (n==sizeof(part)); - HDclose(fd); - } + for(i=0; i<4; i++) { + for(j=0; j<25; j++) { + part[j] = (int)(i*25+j); + } /* end for */ + HDsprintf(filename, "extern_%lua.raw", (unsigned long)i+1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + TEST_ERROR + n = HDwrite(fd, temparray, (size_t)i*10); + if(n < 0 || (size_t)n != i*10) + TEST_ERROR + n = HDwrite(fd, part, sizeof(part)); + if(n != sizeof(part)) + TEST_ERROR + HDclose(fd); + } /* end for */ /* * Create the file and an initial group. This causes messages about * debugging to be emitted before we start playing games with what the * output looks like. */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR if(H5Gclose(grp) < 0) FAIL_STACK_ERROR /* Create the dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR if(H5Pset_external(dcpl, "extern_1a.raw", (off_t)0, (hsize_t)sizeof part) < 0 || H5Pset_external(dcpl, "extern_2a.raw", (off_t)10, (hsize_t)sizeof part) < 0 || H5Pset_external(dcpl, "extern_3a.raw", (off_t)20, (hsize_t)sizeof part) < 0 || H5Pset_external(dcpl, "extern_4a.raw", (off_t)30, (hsize_t)sizeof part) < 0) - goto error; + FAIL_STACK_ERROR cur_size = 100; - if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) goto error; - if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) + FAIL_STACK_ERROR + if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* * Read the entire dataset and compare with the original */ - memset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) goto error; - for(i = 0; i < 100; i++) - if(whole[i] != (signed)i) { - H5_FAILED(); - puts(" Incorrect value(s) read."); - goto error; - } /* end if */ - - /* - * Read the middle of the dataset - */ - if((hs_space = H5Scopy(space)) < 0) goto error; - if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, - &hs_count, NULL) < 0) goto error; HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, - whole) < 0) goto error; - if(H5Sclose(hs_space) < 0) goto error; - for(i = hs_start; i 0) goto error; - return 0; + /* Close the new ff fapl. h5_cleanup will take care of the old ff fapl */ + if(H5Pclose(fapl_id_new) < 0) FAIL_STACK_ERROR - error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Gclose(xid); - H5Gclose(xid2); - H5Fclose(fid); - } H5E_END_TRY; - return 1; -} - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Runs external dataset tests. - * - * Return: Success: exit(0) - * - * Failure: exit(non-zero) - * - * Programmer: Robb Matzke - * Tuesday, March 3, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -int -main (void) -{ - hid_t fapl=-1; /*file access properties */ - hid_t file=-1; /*file for test_1* functions */ - char filename[1024]; /*file name for test_1* funcs */ - hid_t grp=-1; /*group to emit diagnostics */ - int nerrors=0; /*number of errors */ + HDputs("All external storage tests passed."); - h5_reset(); - fapl = h5_fileaccess(); - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(grp) < 0) goto error; - - nerrors += test_1a(file); - nerrors += test_1b(file); - nerrors += test_1c(file); - nerrors += test_1d(file); - nerrors += test_1e(file); - nerrors += test_1f(file); - nerrors += test_1g(); - nerrors += test_1h(); - nerrors += test_2(fapl); - nerrors += test_3(fapl); - nerrors += test_4(fapl); - - /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); - - if (nerrors>0) goto error; - - if (H5Fclose(file) < 0) goto error; - puts("All external storage tests passed."); - if (h5_cleanup(FILENAME, fapl)) { - remove("extern_1a.raw"); - remove("extern_1b.raw"); - remove("extern_2a.raw"); - remove("extern_2b.raw"); - remove("extern_3a.raw"); - remove("extern_3b.raw"); - remove("extern_4a.raw"); - remove("extern_4b.raw"); - } + /* Clean up files used by file set tests */ + if(h5_cleanup(FILENAME, fapl_id_old)) { + HDremove("extern_1a.raw"); + HDremove("extern_1b.raw"); + HDremove("extern_2a.raw"); + HDremove("extern_2b.raw"); + HDremove("extern_3a.raw"); + HDremove("extern_3b.raw"); + HDremove("extern_4a.raw"); + HDremove("extern_4b.raw"); + } /* end if */ - return 0; + return EXIT_SUCCESS; error: H5E_BEGIN_TRY { - H5Fclose(file); - H5Pclose(fapl); + H5Fclose(fid); + H5Pclose(fapl_id_old); + H5Pclose(fapl_id_new); + H5Gclose(gid); } H5E_END_TRY; nerrors = MAX(1, nerrors); printf ("%d TEST%s FAILED.\n", nerrors, 1==nerrors?"":"s"); - return 1; -} + return EXIT_FAILURE; +} /* end main() */ diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index fc044da..55abab0 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -22,9 +22,6 @@ * They will be named according to the platform and should * be placed in the hdf5/test directory so that the links test can use them. * - * Note: The be_extlink2.h5 is also used by external.c to test opening - * external link twice. -SLU 2007/11/7 - * */ #include "hdf5.h" diff --git a/test/h5test.c b/test/h5test.c index cbe067f..723ecdc 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -193,6 +193,107 @@ h5_clean_files(const char *base_name[], hid_t fapl) /*------------------------------------------------------------------------- + * Function: h5_delete_test_file + * + * Purpose Clean up temporary test files. + * + * When a test calls h5_fixname() get a VFD-dependent + * test file name, this function can be used to clean it up. + * + * Return: void + * + * Since this is a cleanup file, we don't care if it fails. + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_delete_test_file(const char *base_name, hid_t fapl) +{ + char filename[1024]; /* VFD-dependent filename to delete */ + char sub_filename[2048]; /* sub-files in multi & family VFDs */ + hid_t driver = -1; /* VFD ID */ + + /* Get the VFD-dependent filename */ + if(NULL == h5_fixname(base_name, fapl, filename, sizeof(filename))) + return; + + driver = H5Pget_driver(fapl); + + if(driver == H5FD_FAMILY) { + int j; + for(j = 0; /*void*/; j++) { + HDsnprintf(sub_filename, sizeof(sub_filename), filename, j); + + /* If we can't access the file, it probably doesn't exist + * and we are done deleting the sub-files. + */ + if(HDaccess(sub_filename, F_OK) < 0) + break; + + HDremove(sub_filename); + } /* end for */ + } else if(driver == H5FD_CORE) { + hbool_t backing; /* Whether the core file has backing store */ + + H5Pget_fapl_core(fapl, NULL, &backing); + + /* If the file was stored to disk with bacing store, remove it */ + if(backing) + HDremove(filename); + } else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; + + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); + HDremove(sub_filename); + } /* end for */ + } else { + HDremove(filename); + } /* end if */ + + return; +} /* end h5_delete_test_file() */ + + +/*------------------------------------------------------------------------- + * Function: h5_delete_all_test_files + * + * Purpose Clean up temporary test files. + * + * When a test calls h5_fixname() get a VFD-dependent + * test file name, this function can be used to clean it up. + * + * This function takes an array of filenames that ends with + * a NULL string and cleans them all. + * + * Return: void + * + * Since this is a cleanup file, we don't care if it fails. + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_delete_all_test_files(const char *base_name[], hid_t fapl) +{ + int i; /* iterator */ + + for(i = 0; base_name[i]; i++) { + h5_delete_test_file(base_name[i], fapl); + } /* end for */ + + return; +} /* end h5_delete_all_test_files() */ + + +/*------------------------------------------------------------------------- * Function: h5_cleanup * * Purpose: Cleanup temporary test files. @@ -226,6 +327,35 @@ h5_cleanup(const char *base_name[], hid_t fapl) /*------------------------------------------------------------------------- + * Function: h5_test_shutdown + * + * Purpose: Performs any special test cleanup required before the test + * ends. + * + * NOTE: This function should normally only be called once + * in a given test, usually just before leaving main(). It + * is intended for use in the single-file unit tests, not + * testhdf5. + * + * Return: void + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_test_shutdown(void) +{ + + /* Restore the original error reporting routine */ + h5_restore_err(); + + return; +} /* end h5_test_shutdown() */ + + +/*------------------------------------------------------------------------- * Function: h5_restore_err * * Purpose: Restore the default error handler. @@ -303,6 +433,39 @@ h5_reset(void) /*------------------------------------------------------------------------- + * Function: h5_test_init + * + * Purpose: Performs any special actions before the test begins. + * + * NOTE: This function should normally only be called once + * in a given test, usually at the beginning of main(). It + * is intended for use in the single-file unit tests, not + * testhdf5. + * + * Return: void + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_test_init(void) +{ + HDfflush(stdout); + HDfflush(stderr); + H5close(); + + /* Save current error stack reporting routine and redirect to our local one */ + HDassert(err_func == NULL); + H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); + H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); + + return; +} /* end h5_test_init() */ + + +/*------------------------------------------------------------------------- * Function: h5_fixname * * Purpose: Create a file name from a file base name like `test' and @@ -744,6 +907,137 @@ h5_fileaccess(void) /*------------------------------------------------------------------------- + * Function: h5_get_vfd_fapl + * + * Purpose: Returns a file access property list which is the default + * fapl but with a file driver set according to the constant or + * environment variable HDF5_DRIVER. + * + * Return: Success: A file access property list ID + * Failure: -1 + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +hid_t +h5_get_vfd_fapl(void) +{ + const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *tok = NULL; /* strtok pointer */ + char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ + hid_t fapl = -1; /* fapl to be returned */ + + /* Get the environment variable, if it exists */ + env = HDgetenv("HDF5_DRIVER"); + + /* Create a default fapl */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return -1; + + /* If the environment variable was not set, just return + * the default fapl. + */ + if(!env || !*env) + return fapl; + + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) + * just return the default fapl. + */ + HDstrncpy(buf, env, sizeof(buf)); + HDmemset(buf, 0, sizeof(buf)); + if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + return fapl; + + if(!HDstrcmp(tok, "sec2")) { + /* POSIX (section 2) read() and write() system calls */ + if(H5Pset_fapl_sec2(fapl) < 0) + return -1; + } else if(!HDstrcmp(tok, "stdio")) { + /* Standard C fread() and fwrite() system calls */ + if(H5Pset_fapl_stdio(fapl) < 0) + return -1; + } else if(!HDstrcmp(tok, "core")) { + /* In-memory driver settings (backing store on, 1 MB increment) */ + if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + return -1; + } else if(!HDstrcmp(tok, "core_paged")) { + /* In-memory driver with write tracking and paging on */ + if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + return -1; + if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) + return -1; + } else if(!HDstrcmp(tok, "split")) { + /* Split meta data and raw data each using default driver */ + if(H5Pset_fapl_split(fapl, + "-m.h5", H5P_DEFAULT, + "-r.h5", H5P_DEFAULT) < 0) + return -1; + } else if(!HDstrcmp(tok, "multi")) { + /* Multi-file driver, general case of the split driver */ + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][1024]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_mem_t mt; + + HDmemset(memb_map, 0, sizeof(memb_map)); + HDmemset(memb_fapl, 0, sizeof(memb_fapl)); + HDmemset(memb_name, 0, sizeof(memb_name)); + HDmemset(memb_addr, 0, sizeof(memb_addr)); + + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + memb_fapl[mt] = H5P_DEFAULT; + HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + memb_name[mt] = sv[mt]; + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); + } /* end for */ + + if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, + memb_addr, FALSE) < 0) { + return -1; + } /* end if */ + } else if(!HDstrcmp(tok, "family")) { + /* Family of files, each 1MB and using the default driver */ + hsize_t fam_size = 100*1024*1024; /*100 MB*/ + + /* Was a family size specified in the environment variable? */ + if((tok = HDstrtok(NULL, " \t\n\r"))) + fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024*1024); + if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) + return -1; + } else if(!HDstrcmp(tok, "log")) { + /* Log file access */ + unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; + + /* Were special log file flags specified in the environment variable? */ + if((tok = HDstrtok(NULL, " \t\n\r"))) + log_flags = (unsigned)HDstrtol(tok, NULL, 0); + + if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) + return -1; +#ifdef H5_HAVE_DIRECT + } else if(!HDstrcmp(tok, "direct")) { + /* Linux direct read() and write() system calls. Set memory boundary, + * file block size, and copy buffer size to the default values. + */ + if(H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) + return -1; +#endif + } else { + /* Unknown driver */ + return -1; + } /* end if */ + + return fapl; +} /* end h5_get_vfd_fapl() */ + + +/*------------------------------------------------------------------------- * Function: h5_no_hwconv * * Purpose: Turn off hardware data type conversions. diff --git a/test/h5test.h b/test/h5test.h index a91da5d..450099a 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -142,6 +142,23 @@ H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); +/* Functions that will replace VFD-dependent functions that violate + * the single responsibility principle. Unlike their predecessors, + * these new functions do not have hidden side effects. + */ +/* h5_fileaccess() replacement */ +H5TEST_DLL hid_t h5_get_vfd_fapl(void); + +/* h5_clean_files() replacements */ +H5TEST_DLL void h5_delete_test_file(const char *base_name, hid_t fapl); +H5TEST_DLL void h5_delete_all_test_files(const char *base_name[], hid_t fapl); + +/* h5_reset() replacement */ +H5TEST_DLL void h5_test_init(void); + +/* h5_cleanup() replacement */ +H5TEST_DLL void h5_test_shutdown(void); + /* Routines for operating on the list of tests (for the "all in one" tests) */ H5TEST_DLL void TestUsage(void); H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void), diff --git a/test/links.c b/test/links.c index db43cf3..a791c89 100644 --- a/test/links.c +++ b/test/links.c @@ -7399,7 +7399,7 @@ error: } H5E_END_TRY return -1; -} /* end efc_open_twice */ +} /* end external_open_twice() */ /*------------------------------------------------------------------------- -- cgit v0.12 From 1180666bf8600c7520e4e21d864eed36e6aa4418 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 24 Feb 2016 20:42:06 -0500 Subject: [svn-r29206] Merge h5dump VDS support from trunk: r29186, r29190, r29198 Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial cmakehdf5 (CMake 3.2.2) chkmanifest --- MANIFEST | 13 + config/cmake/vfdTest.cmake | 4 +- config/cmake_ext_mod/prunTest.cmake | 4 +- config/cmake_ext_mod/runTest.cmake | 12 +- tools/h5dump/CMakeTestsVDS.cmake | 28 ++ tools/h5dump/h5dump.c | 16 +- tools/h5dump/h5dump.h | 2 + tools/h5dump/h5dump_ddl.c | 306 ++++++++------- tools/h5dump/h5dump_extern.h | 2 + tools/h5dump/testh5dumpvds.sh.in | 18 + tools/h5repack/CMakeLists.txt | 6 +- tools/lib/CMakeLists.txt | 2 +- tools/testfiles/h5dump-help.txt | 2 + .../pbits/tnofilename-with-packed-bits.ddl | 2 + tools/testfiles/pbits/tpbitsIncomplete.ddl | 2 + tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsLengthPositive.ddl | 2 + tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 2 + tools/testfiles/vds/a.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/b.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/c.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/d.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/f-0.h5 | Bin 0 -> 4144 bytes tools/testfiles/vds/f-3.h5 | Bin 0 -> 4144 bytes tools/testfiles/vds/vds-eiger.h5 | Bin 0 -> 5496 bytes tools/testfiles/vds/vds-first.ddl | 210 ++++++++++ tools/testfiles/vds/vds-gap1.ddl | 58 +++ tools/testfiles/vds/vds-gap2.ddl | 210 ++++++++++ tools/testfiles/vds/vds-percival-unlim-maxmin.h5 | Bin 0 -> 5496 bytes tools/testfiles/vds/vds_layout-eiger.ddl | 87 +++++ tools/testfiles/vds/vds_layout-maxmin.ddl | 422 +++++++++++++++++++++ 33 files changed, 1267 insertions(+), 149 deletions(-) create mode 100644 tools/testfiles/vds/a.h5 create mode 100644 tools/testfiles/vds/b.h5 create mode 100644 tools/testfiles/vds/c.h5 create mode 100644 tools/testfiles/vds/d.h5 create mode 100644 tools/testfiles/vds/f-0.h5 create mode 100644 tools/testfiles/vds/f-3.h5 create mode 100644 tools/testfiles/vds/vds-eiger.h5 create mode 100644 tools/testfiles/vds/vds-first.ddl create mode 100644 tools/testfiles/vds/vds-gap1.ddl create mode 100644 tools/testfiles/vds/vds-gap2.ddl create mode 100644 tools/testfiles/vds/vds-percival-unlim-maxmin.h5 create mode 100644 tools/testfiles/vds/vds_layout-eiger.ddl create mode 100644 tools/testfiles/vds/vds_layout-maxmin.ddl diff --git a/MANIFEST b/MANIFEST index e90b0cc..f9fb60d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1843,6 +1843,11 @@ ./tools/testfiles/vds/tvds_layout-3_2.ddl ./tools/testfiles/vds/tvds_layout-4.ddl ./tools/testfiles/vds/tvds_layout-5.ddl +./tools/testfiles/vds/vds-first.ddl +./tools/testfiles/vds/vds-gap1.ddl +./tools/testfiles/vds/vds-gap2.ddl +./tools/testfiles/vds/vds_layout-eiger.ddl +./tools/testfiles/vds/vds_layout-maxmin.ddl ./tools/testfiles/vds/1_a.h5 ./tools/testfiles/vds/1_b.h5 ./tools/testfiles/vds/1_c.h5 @@ -1866,6 +1871,14 @@ ./tools/testfiles/vds/5_b.h5 ./tools/testfiles/vds/5_c.h5 ./tools/testfiles/vds/5_vds.h5 +./tools/testfiles/vds/a.h5 +./tools/testfiles/vds/b.h5 +./tools/testfiles/vds/c.h5 +./tools/testfiles/vds/d.h5 +./tools/testfiles/vds/vds-percival-unlim-maxmin.h5 +./tools/testfiles/vds/f-0.h5 +./tools/testfiles/vds/f-3.h5 +./tools/testfiles/vds/vds-eiger.h5 # h5dump h5import validation ./tools/testfiles/out3.h5import diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 4685d88..10f0a7b 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -35,10 +35,10 @@ EXECUTE_PROCESS ( message (STATUS "COMMAND Result: ${TEST_RESULT}") -if (ERROR_APPEND) +if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") -endif (ERROR_APPEND) +endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) diff --git a/config/cmake_ext_mod/prunTest.cmake b/config/cmake_ext_mod/prunTest.cmake index 089c203..38ecb7e 100644 --- a/config/cmake_ext_mod/prunTest.cmake +++ b/config/cmake_ext_mod/prunTest.cmake @@ -49,10 +49,10 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") -if (ERROR_APPEND) +if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND) +endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) if (TEST_APPEND) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_ERROR}\n") diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index c2b7527..3b7d949 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -62,10 +62,10 @@ endif (NOT TEST_INPUT) message (STATUS "COMMAND Result: ${TEST_RESULT}") -if (ERROR_APPEND) +if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND) +endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) if (TEST_APPEND) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") @@ -93,9 +93,9 @@ endif (TEST_MASK_MOD) if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - else (NOT TEST_ERRREF) + else () file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - endif (NOT TEST_ERRREF) + endif () string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") @@ -105,9 +105,9 @@ if (TEST_MASK_ERROR) string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") if (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else (NOT TEST_ERRREF) + else () file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif (NOT TEST_ERRREF) + endif () endif (TEST_MASK_ERROR) if (TEST_FILTER) diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake index 58287fa..cc68896 100644 --- a/tools/h5dump/CMakeTestsVDS.cmake +++ b/tools/h5dump/CMakeTestsVDS.cmake @@ -22,6 +22,11 @@ tvds_layout-3_2.ddl tvds_layout-4.ddl tvds_layout-5.ddl + vds-first.ddl + vds-gap1.ddl + vds-gap2.ddl + vds_layout-eiger.ddl + vds_layout-maxmin.ddl ) set (HDF5_REFERENCE_TEST_VDS 1_a.h5 @@ -47,6 +52,14 @@ 5_b.h5 5_c.h5 5_vds.h5 + a.h5 + b.h5 + c.h5 + d.h5 + vds-percival-unlim-maxmin.h5 + f-0.h5 + f-3.h5 + vds-eiger.h5 ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -184,6 +197,12 @@ tvds-4.out.err tvds-5.out tvds-5.out.err + vds-first.out + vds-first.out.err + vds-gap1.out + vds-gap1.out.err + vds-gap2.out + vds-gap2.out.err tvds_layout-1.out tvds_layout-1.out.err tvds_layout-2.out @@ -196,6 +215,10 @@ tvds_layout-4.out.err tvds_layout-5.out tvds_layout-5.out.err + vds_layout-eiger.out + vds_layout-eiger.out.err + vds_layout-maxmin.out + vds_layout-maxmin.out.err ) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT "${last_vds_test}" STREQUAL "") @@ -225,6 +248,9 @@ ADD_H5_VDS_TEST (tvds-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) + ADD_H5_VDS_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) endif (USE_FILTER_DEFLATE) # Layout read @@ -235,4 +261,6 @@ ADD_H5_VDS_LAYOUT (tvds_layout-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5) endif (USE_FILTER_DEFLATE) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ffba581..7c24fa4 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -71,7 +71,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -190,6 +190,8 @@ static struct long_options l_opts[] = { { "no-compact-subset", no_arg, 'C' }, { "ddl", optional_arg, 'O' }, { "any_path", require_arg, 'N' }, + { "vds-view-first-missing", no_arg, 'v' }, + { "vds-gap-size", require_arg, 'G' }, { NULL, 0, '\0' } }; @@ -256,6 +258,8 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n"); PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); @@ -1121,6 +1125,16 @@ parse_start: } display_packed_bits = TRUE; break; + case 'v': + display_vds_first = TRUE; + break; + case 'G': + vds_gap_size = HDatoi(opt_arg); + if (vds_gap_size < 0) { + usage(h5tools_getprogname()); + goto error; + } + break; /** begin XML parameters **/ case 'x': diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 2b1fb04..7cf4efd 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -78,6 +78,8 @@ int enable_error_stack= FALSE; /* re-enable error stack */ int disable_compact_subset= FALSE; /* disable compact form of subset notation */ int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ int include_attrs = TRUE; /* Display attributes */ +int display_vds_first = FALSE; /* vds display to all by default*/ +int vds_gap_size = 0; /* vds skip missing files default is none */ /* sort parameters */ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index fd50710..09751ab 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 */ + 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 */ + char *path; /* Path of object being searched */ + char *op_name; /* Object name wanted */ } trav_attr_udata_t; /* callback function used by H5Literate() */ @@ -90,7 +90,7 @@ dump_dataspace(hid_t space) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); } @@ -117,19 +117,19 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_context_t ctx; /* print context */ h5tool_format_t *outputformat = &h5tools_dataformat; h5tool_format_t string_dataformat; - + hid_t attr_id; herr_t ret = SUCCEED; HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); oid_output = display_oid; data_output = display_data; attr_data_output = display_attr_data; - + string_dataformat = *outputformat; if (fp_format) { @@ -155,7 +155,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } - + return ret; } @@ -185,6 +185,7 @@ static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ herr_t ret = SUCCEED; char *obj_path = NULL; /* Full path of object */ h5tools_str_t buffer; /* string into which to render */ @@ -199,7 +200,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -222,8 +223,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR if(!obj_path) { ret = FAIL; goto done; - } - + } + HDstrcpy(obj_path, prefix); HDstrcat(obj_path, "/"); HDstrcat(obj_path, name); @@ -269,7 +270,20 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR break; case H5O_TYPE_DATASET: - if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((obj = H5Dopen2(group, name, dapl_id)) >= 0) { if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ @@ -308,9 +322,11 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_setstatus(EXIT_FAILURE); ret = FAIL; + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else if(found_obj->displayed) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -347,18 +363,24 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else { found_obj->displayed = TRUE; } } /* end if */ dump_function_table->dump_dataset_function(obj, name, NULL); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); - } + } else { + if (dapl_id) + H5Pclose(dapl_id && dapl_id != H5P_DEFAULT); error_msg("unable to dump dataset \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -370,7 +392,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to dump datatype \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { dump_function_table->dump_named_datatype_function(obj, name); H5Tclose(obj); @@ -408,7 +430,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to get link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { /* print the value of a soft link */ /* Standard DDL: no modification */ @@ -558,7 +580,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR done: h5tools_str_close(&buffer); - + if(obj_path) HDfree(obj_path); return ret; @@ -650,7 +672,7 @@ dump_named_datatype(hid_t tid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -685,7 +707,7 @@ dump_named_datatype(hid_t tid, const char *name) } ctx.need_prefix = TRUE; - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -718,7 +740,7 @@ dump_named_datatype(hid_t tid, const char *name) else found_obj->displayed = TRUE; } /* end if */ - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE); @@ -726,7 +748,7 @@ dump_named_datatype(hid_t tid, const char *name) if(H5Tget_class(tid) != H5T_COMPOUND) { h5tools_str_append(&buffer, ";"); } - + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print attributes */ @@ -813,7 +835,7 @@ dump_group(hid_t gid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -839,7 +861,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); 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; @@ -948,7 +970,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -982,7 +1004,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) 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, "%s \"%s\" %s", @@ -994,7 +1016,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent += COL; ctx.indent_level++; - + type = H5Dget_type(did); h5dump_type_table = type_table; h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); @@ -1018,6 +1040,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if(display_data) { int data_loop = 1; int i; + if(display_packed_bits) data_loop = packed_bits_num; for(i=0; iline_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level--; break; @@ -1079,7 +1102,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { @@ -1189,7 +1212,7 @@ dump_fcpl(hid_t fid) fdriver=H5Pget_driver(fapl); H5Pclose(fapl); #endif - + /*------------------------------------------------------------------------- * SUPER_BLOCK *------------------------------------------------------------------------- @@ -1308,54 +1331,54 @@ 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; + 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; + trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; char *buf = attr_data->path; - char *op_name = attr_data->op_name; + 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]!='\\'))) - break; - j--; + if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) + break; + j--; } obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/"); if(obj_op_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; } else { - if(HDstrcmp(attr_name, obj_op_name)==0) { - /* 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); - if(obj_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - HDmemset(obj_name, '\0', (size_t)k); - if(op_name[0] != '/') { - HDstrncat(obj_name, buf, (size_t)i + 1); - if(buf[i-1] != '/') - HDstrncat(obj_name, "/", (size_t)2); - } - HDstrncat(obj_name, op_name, (size_t)j + 1); - - handle_attributes(oid, obj_name, NULL, 0, NULL); - HDfree(obj_name); - } - } - HDfree(obj_op_name); + if(HDstrcmp(attr_name, obj_op_name)==0) { + /* 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); + if(obj_name == NULL) { + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + HDmemset(obj_name, '\0', (size_t)k); + if(op_name[0] != '/') { + HDstrncat(obj_name, buf, (size_t)i + 1); + if(buf[i-1] != '/') + HDstrncat(obj_name, "/", (size_t)2); + } + HDstrncat(obj_name, op_name, (size_t)j + 1); + + handle_attributes(oid, obj_name, NULL, 0, NULL); + HDfree(obj_name); + } + } + HDfree(obj_op_name); } return ret; } /* end attr_search() */ @@ -1363,7 +1386,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a 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; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; trav_attr_udata_t attr_data; @@ -1372,22 +1395,22 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al 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) { - 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); - } /* end switch */ + 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); + } /* end switch */ } return 0; @@ -1397,48 +1420,48 @@ static herr_t lnk_search(const char *path, const H5L_info_t *li, void *_op_data) { int search_len; - int k; + int k; char *search_name; - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; search_len = HDstrlen(op_name); if(search_len > 0 && op_name[0] != '/') { - k = 2; + k = 2; } else k = 1; - search_name = (char *)HDmalloc((size_t)(search_len + k)); + search_name = (char *)HDmalloc((size_t)(search_len + k)); if(search_name == NULL) { - error_msg("creating temporary link\n"); - h5tools_setstatus(EXIT_FAILURE); + error_msg("creating temporary link\n"); + h5tools_setstatus(EXIT_FAILURE); } else { - if (k == 2) { - HDstrcpy(search_name, "/"); - HDstrncat(search_name, op_name, (size_t)search_len + 1); - } - else - HDstrncpy(search_name, op_name, (size_t)search_len + 1); - search_name[search_len + k - 1] = '\0'; - - if(HDstrcmp(path, search_name) == 0) { - switch(li->type) { - case H5L_TYPE_SOFT: - case H5L_TYPE_EXTERNAL: - handle_links(handle_data->fid, op_name, NULL, 0, NULL); - break; - - case H5L_TYPE_HARD: - case H5L_TYPE_MAX: - case H5L_TYPE_ERROR: - default: - error_msg("unknown link type value\n"); - h5tools_setstatus(EXIT_FAILURE); - break; - } /* end switch() */ - } - HDfree(search_name); + if (k == 2) { + HDstrcpy(search_name, "/"); + HDstrncat(search_name, op_name, (size_t)search_len + 1); + } + else + HDstrncpy(search_name, op_name, (size_t)search_len + 1); + search_name[search_len + k - 1] = '\0'; + + if(HDstrcmp(path, search_name) == 0) { + switch(li->type) { + case H5L_TYPE_SOFT: + case H5L_TYPE_EXTERNAL: + handle_links(handle_data->fid, op_name, NULL, 0, NULL); + break; + + case H5L_TYPE_HARD: + case H5L_TYPE_MAX: + case H5L_TYPE_ERROR: + default: + error_msg("unknown link type value\n"); + h5tools_setstatus(EXIT_FAILURE); + break; + } /* end switch() */ + } + HDfree(search_name); } return 0; } /* end lnk_search() */ @@ -1465,7 +1488,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H hid_t gcpl_id; unsigned crt_order_flags; unsigned attr_crt_order_flags; - trav_handle_udata_t handle_udata; /* User data for traversal */ + trav_handle_udata_t handle_udata; /* User data for traversal */ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { error_msg("error in getting group creation property list ID\n"); @@ -1489,12 +1512,12 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H h5tools_setstatus(EXIT_FAILURE); } - handle_udata.fid = fid; - handle_udata.op_name = (char*)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); - } + handle_udata.fid = fid; + handle_udata.op_name = (char*)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); + } } } @@ -1536,7 +1559,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H /* find the last / */ while(j >= 0) { - if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) + if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) break; j--; } @@ -1571,7 +1594,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); /* handle error case: cannot open the object with the attribute */ if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { @@ -1627,7 +1650,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H } /* end if */ HDfree(obj_name); - HDfree(attr_name); + HDfree(attr_name); dump_indent -= COL; return; @@ -1635,9 +1658,9 @@ error: h5tools_setstatus(EXIT_FAILURE); if(obj_name) HDfree(obj_name); - - if (attr_name) - HDfree(attr_name); + + if (attr_name) + HDfree(attr_name); H5E_BEGIN_TRY { H5Oclose(oid); @@ -1672,10 +1695,24 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis { H5O_info_t oinfo; hid_t dsetid; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ struct subset_t *sset = (struct subset_t *)data; const char *real_name = display_name ? display_name : dset; - if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) { if (pe) { handle_links(fid, dset, data, pe, display_name); } @@ -1752,7 +1789,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis h5tools_setstatus(EXIT_FAILURE); return; } - + /*------------------------------------------------------------------------- * check for block overlap *------------------------------------------------------------------------- @@ -1785,7 +1822,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); - } + } else { found_obj->displayed = TRUE; dump_indent += COL; @@ -1801,7 +1838,8 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis dump_dataset(dsetid, real_name, sset); dump_indent -= COL; } - + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); if(H5Dclose(dsetid) < 0) h5tools_setstatus(EXIT_FAILURE); } @@ -1884,11 +1922,11 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { error_msg("unable to get link info from \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else if(linfo.type == H5L_TYPE_HARD) { error_msg("\"%s\" is a hard link\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else { char *buf = (char *)HDmalloc(linfo.u.val_size); PRINTVALSTREAM(rawoutstream, "\n"); @@ -1925,12 +1963,12 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); - } + } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } - } + } else { error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 08f9e36..62477d0 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -77,6 +77,8 @@ extern int enable_error_stack; /* re-enable error stack */ extern int disable_compact_subset; /* disable compact form of subset notation */ extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ extern int include_attrs; /* Display attributes */ +extern int display_vds_first; /* vds display to first missing */ +extern int vds_gap_size; /* vds skip missing files */ /* sort parameters */ extern H5_index_t sort_by; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/testh5dumpvds.sh.in b/tools/h5dump/testh5dumpvds.sh.in index b15606f..850c03a 100644 --- a/tools/h5dump/testh5dumpvds.sh.in +++ b/tools/h5dump/testh5dumpvds.sh.in @@ -98,6 +98,14 @@ $SRC_H5DUMP_TESTFILES/vds/5_a.h5 $SRC_H5DUMP_TESTFILES/vds/5_b.h5 $SRC_H5DUMP_TESTFILES/vds/5_c.h5 $SRC_H5DUMP_TESTFILES/vds/5_vds.h5 +$SRC_H5DUMP_TESTFILES/vds/a.h5 +$SRC_H5DUMP_TESTFILES/vds/b.h5 +$SRC_H5DUMP_TESTFILES/vds/c.h5 +$SRC_H5DUMP_TESTFILES/vds/d.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-percival-unlim-maxmin.h5 +$SRC_H5DUMP_TESTFILES/vds/f-0.h5 +$SRC_H5DUMP_TESTFILES/vds/f-3.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-eiger.h5 " LIST_OTHER_TEST_FILES=" @@ -113,6 +121,11 @@ $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_1.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_2.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-4.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-5.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-first.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap1.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap2.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-eiger.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-maxmin.ddl " LIST_ERROR_TEST_FILES=" @@ -480,6 +493,9 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 TOOLTEST tvds-4.ddl --enable-error-stack 4_vds.h5 TOOLTEST tvds-5.ddl --enable-error-stack 5_vds.h5 + TOOLTEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 + TOOLTEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 + TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 fi # Layout read @@ -490,6 +506,8 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 TOOLTEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 TOOLTEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 + TOOLTEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 + TOOLTEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5 fi # Clean up temporary files/directories diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 7631ae8..9b1fbcf 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -58,7 +58,7 @@ if (BUILD_TESTING) target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} - SHARED + SHARED ${HDF5_PACKAGE_SOVERSION} HDF5_TOOL_PLUGIN_LIB_NAME_RELEASE HDF5_TOOL_PLUGIN_LIB_NAME_DEBUG ) @@ -72,13 +72,13 @@ if (BUILD_TESTING) TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$" "${CMAKE_BINARY_DIR}/plugins/$" ) include (CMakeTests.cmake) - + endif (BUILD_TESTING) ############################################################################## diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 38c84a2..0b39a2b 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -61,7 +61,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIBSH_TARGET}") H5_SET_LIB_OPTIONS ( ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} - SHARED + SHARED ${HDF5_TOOLS_PACKAGE_SOVERSION} HDF5_TOOLS_LIB_NAME_RELEASE HDF5_TOOLS_LIB_NAME_DEBUG ) diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 444dd97..7ebefc6 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 64a2880..1a1b7e8 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index cdb1f91..2a2778a 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 6d2492a..5e00073 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index 4f56619..f2574d4 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 3432433..15c0abc 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index e51a09e..c62e290 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index ba6e46d..5621a60 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/vds/a.h5 b/tools/testfiles/vds/a.h5 new file mode 100644 index 0000000..fa19535 Binary files /dev/null and b/tools/testfiles/vds/a.h5 differ diff --git a/tools/testfiles/vds/b.h5 b/tools/testfiles/vds/b.h5 new file mode 100644 index 0000000..08449ca Binary files /dev/null and b/tools/testfiles/vds/b.h5 differ diff --git a/tools/testfiles/vds/c.h5 b/tools/testfiles/vds/c.h5 new file mode 100644 index 0000000..ba9af30 Binary files /dev/null and b/tools/testfiles/vds/c.h5 differ diff --git a/tools/testfiles/vds/d.h5 b/tools/testfiles/vds/d.h5 new file mode 100644 index 0000000..8eceb4a Binary files /dev/null and b/tools/testfiles/vds/d.h5 differ diff --git a/tools/testfiles/vds/f-0.h5 b/tools/testfiles/vds/f-0.h5 new file mode 100644 index 0000000..242df07 Binary files /dev/null and b/tools/testfiles/vds/f-0.h5 differ diff --git a/tools/testfiles/vds/f-3.h5 b/tools/testfiles/vds/f-3.h5 new file mode 100644 index 0000000..539c1c9 Binary files /dev/null and b/tools/testfiles/vds/f-3.h5 differ diff --git a/tools/testfiles/vds/vds-eiger.h5 b/tools/testfiles/vds/vds-eiger.h5 new file mode 100644 index 0000000..23d1fd3 Binary files /dev/null and b/tools/testfiles/vds/vds-eiger.h5 differ diff --git a/tools/testfiles/vds/vds-first.ddl b/tools/testfiles/vds/vds-first.ddl new file mode 100644 index 0000000..97b1ecf --- /dev/null +++ b/tools/testfiles/vds/vds-first.ddl @@ -0,0 +1,210 @@ +HDF5 "vds-percival-unlim-maxmin.h5" { +GROUP "/" { + DATASET "VDS-Percival-unlim-maxmin" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + DATA { + (0,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (1,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (2,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (3,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (4,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (5,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (6,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (7,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (8,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (9,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (10,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (11,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (12,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (13,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (14,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (16,0,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,1,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,2,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,3,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,4,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,5,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,6,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,7,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,8,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,9,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (17,0,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,1,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,2,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,3,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,4,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,5,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,6,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,7,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,8,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,9,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (18,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (19,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 + } + } +} +} diff --git a/tools/testfiles/vds/vds-gap1.ddl b/tools/testfiles/vds/vds-gap1.ddl new file mode 100644 index 0000000..cace781 --- /dev/null +++ b/tools/testfiles/vds/vds-gap1.ddl @@ -0,0 +1,58 @@ +HDF5 "vds-eiger.h5" { +DATASET "/VDS-Eiger" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 5, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + DATA { + (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } +} +} diff --git a/tools/testfiles/vds/vds-gap2.ddl b/tools/testfiles/vds/vds-gap2.ddl new file mode 100644 index 0000000..24da48f --- /dev/null +++ b/tools/testfiles/vds/vds-gap2.ddl @@ -0,0 +1,210 @@ +HDF5 "vds-eiger.h5" { +GROUP "/" { + DATASET "VDS-Eiger" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + DATA { + (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (15,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + } + } +} +} diff --git a/tools/testfiles/vds/vds-percival-unlim-maxmin.h5 b/tools/testfiles/vds/vds-percival-unlim-maxmin.h5 new file mode 100644 index 0000000..b7f8827 Binary files /dev/null and b/tools/testfiles/vds/vds-percival-unlim-maxmin.h5 differ diff --git a/tools/testfiles/vds/vds_layout-eiger.ddl b/tools/testfiles/vds/vds_layout-eiger.ddl new file mode 100644 index 0000000..0ea4994 --- /dev/null +++ b/tools/testfiles/vds/vds_layout-eiger.ddl @@ -0,0 +1,87 @@ +HDF5 "vds-eiger.h5" { +GROUP "/" { + DATASET "VDS-Eiger" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 5, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + STORAGE_LAYOUT { + MAPPING 0 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (5,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (5,10,10) + } + } + SOURCE { + FILE "f-%b.h5" + DATASET "A" + SELECTION ALL + } + } + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + } +} +} diff --git a/tools/testfiles/vds/vds_layout-maxmin.ddl b/tools/testfiles/vds/vds_layout-maxmin.ddl new file mode 100644 index 0000000..0b5b583 --- /dev/null +++ b/tools/testfiles/vds/vds_layout-maxmin.ddl @@ -0,0 +1,422 @@ +HDF5 "vds-percival-unlim-maxmin.h5" { +GROUP "/" { + DATASET "VDS-Percival-unlim-maxmin" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 32, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + STORAGE_LAYOUT { + MAPPING 0 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "a.h5" + DATASET "A" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + MAPPING 1 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (1,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "b.h5" + DATASET "B" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + MAPPING 2 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (2,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "c.h5" + DATASET "C" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + MAPPING 3 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (3,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "d.h5" + DATASET "D" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (1,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (2,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (3,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (4,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (5,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (6,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (7,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (8,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (9,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (10,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (11,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (12,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (13,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (14,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (16,0,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,1,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,2,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,3,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,4,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,5,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,6,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,7,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,8,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,9,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (17,0,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,1,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,2,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,3,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,4,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,5,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,6,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,7,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,8,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,9,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (18,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (19,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (20,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (21,0,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,1,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,2,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,3,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,4,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,5,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,6,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,7,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,8,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,9,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (22,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (23,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (24,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (26,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (27,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (28,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (31,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 + } + } +} +} -- cgit v0.12 From 9dff3541bb856810b0048844e80a3008faa16e50 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 24 Feb 2016 22:46:17 -0500 Subject: [svn-r29208] Merge of r29032 from trunk Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ Fortran & C++ autotools parallel (MPICH 3.1.4) w/ Fortran --- src/H5C.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/H5C.c b/src/H5C.c index f5503ef..fe14bd1 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7893,6 +7893,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ hbool_t was_dirty; haddr_t new_addr = HADDR_UNDEF; haddr_t old_addr = HADDR_UNDEF; + haddr_t entry_addr = HADDR_UNDEF; size_t new_len = 0; size_t new_compressed_len = 0; herr_t ret_value = SUCCEED; /* Return value */ @@ -8426,6 +8427,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ /* reset the flush_in progress flag */ entry_ptr->flush_in_progress = FALSE; + /* capture the cache entry address for the log_flush call at the + end before the entry_ptr gets freed */ + entry_addr = entry_ptr->addr; + /* Internal cache data structures should now be up to date, and * consistant with the status of the entry. * @@ -8537,7 +8542,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ } /* if (destroy) */ if(cache_ptr->log_flush) - if((cache_ptr->log_flush)(cache_ptr, entry_ptr->addr, was_dirty, flags) < 0) + if((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed.") done: -- cgit v0.12 From 0c7eab89e3c92f979e75bca760c6f45600c800b1 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 25 Feb 2016 02:20:54 -0500 Subject: [svn-r29210] Merge of r28950 and 28957 from trunk Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ Fortran & C++ autotools parallel (MPICH 3.1.4) w/ Fortran --- src/H5A.c | 81 ++++++------ src/H5AC.c | 64 ++------- src/H5ACprivate.h | 9 -- src/H5Adeprec.c | 8 +- src/H5Aint.c | 4 +- src/H5Atest.c | 2 +- src/H5C.c | 58 +-------- src/H5Cmpio.c | 5 +- src/H5Cprivate.h | 8 +- src/H5D.c | 12 +- src/H5Dcontig.c | 2 +- src/H5Ddbg.c | 2 +- src/H5Ddeprec.c | 2 +- src/H5Dfill.c | 2 +- src/H5Dint.c | 8 +- src/H5F.c | 18 +-- src/H5FDmpio.c | 6 - src/H5FDprivate.h | 8 ++ src/H5Fdeprec.c | 4 +- src/H5Fint.c | 22 +++- src/H5Fmpi.c | 69 ++++++++++ src/H5Fpkg.h | 3 +- src/H5Fprivate.h | 2 +- src/H5Fsuper_cache.c | 3 - src/H5Ftest.c | 2 +- src/H5G.c | 18 +-- src/H5Gdeprec.c | 22 ++-- src/H5Gint.c | 12 +- src/H5Gtest.c | 16 +-- src/H5I.c | 2 +- src/H5Itest.c | 2 +- src/H5L.c | 52 ++++---- src/H5Lexternal.c | 6 +- src/H5O.c | 42 +++--- src/H5Ocache.c | 6 +- src/H5Ocopy.c | 4 +- src/H5Ofill.c | 4 +- src/H5Olayout.c | 2 +- src/H5Oproxy.c | 6 +- src/H5Otest.c | 50 +++---- src/H5Pdcpl.c | 6 +- src/H5Pint.c | 27 +++- src/H5Pprivate.h | 3 +- src/H5R.c | 8 +- src/H5Rdeprec.c | 4 +- src/H5T.c | 362 +++++++++++++++++++++++++-------------------------- src/H5Tcommit.c | 10 +- src/H5Tdeprec.c | 2 +- src/H5Zscaleoffset.c | 2 +- src/H5private.h | 1 + test/cache_common.c | 4 +- test/cache_tagging.c | 14 +- 52 files changed, 547 insertions(+), 544 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index e478610..0a2f983 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -273,7 +273,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go do the real work for attaching the attribute to the object */ @@ -365,8 +365,8 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_ind_dxpl_id; - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Find the object's location */ @@ -374,11 +374,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") @@ -421,7 +416,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -436,7 +431,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Read in attribute from object header */ @@ -488,7 +483,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -510,7 +505,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -561,7 +556,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -586,7 +581,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute in the object header */ @@ -628,6 +623,8 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ + hid_t aapl_id = H5P_DEFAULT; /* temp access plist */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -641,6 +638,10 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, attr_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go write the actual data to the attribute */ if((ret_value = H5A__write(attr, mem_type, buf, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") @@ -671,6 +672,8 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ + hid_t aapl_id = H5P_DEFAULT; /* temp access plist */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -684,8 +687,12 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, attr_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go write the actual data to the attribute */ - if((ret_value = H5A__read(attr, mem_type, buf, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5A__read(attr, mem_type, buf, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -898,7 +905,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -918,7 +925,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -1036,7 +1043,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1055,7 +1062,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -1095,7 +1102,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1117,7 +1124,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -1216,7 +1223,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ @@ -1303,7 +1310,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /* Call attribute iteration routine */ last_attr = start_idx = (idx ? *idx : 0); - if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(loc_id, H5AC_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ @@ -1372,7 +1379,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5A_attr_iter_op_t attr_op; /* Attribute operator */ hsize_t start_idx; /* Index of attribute to start iterating at */ hsize_t last_attr; /* Index of last attribute examined */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1392,7 +1399,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -1517,8 +1524,8 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_ind_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -1531,11 +1538,6 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Delete the attribute from the location */ if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1601,8 +1603,8 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_ind_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -1615,11 +1617,6 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Delete the attribute from the location */ if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1701,7 +1698,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ - if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1727,7 +1724,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1744,7 +1741,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) diff --git a/src/H5AC.c b/src/H5AC.c index 1a27c40..3bc849b 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -80,22 +80,13 @@ static herr_t H5AC__verify_tag(hid_t dxpl_id, const H5AC_class_t * type); /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; - /*****************************/ /* Library Private Variables */ /*****************************/ /* Default dataset transfer property list for metadata I/O calls */ -/* (Collective set, "block before metadata write" set and "library internal" set) */ -/* (Global variable definition, declaration is in H5ACprivate.h also) */ hid_t H5AC_dxpl_id = (-1); - -/* Dataset transfer property list for independent metadata I/O calls */ -/* (just "library internal" set - i.e. independent transfer mode) */ -/* (Global variable definition, declaration is in H5ACprivate.h also) */ -H5P_genplist_t *H5AC_ind_dxpl_g = NULL; -hid_t H5AC_ind_dxpl_id = (-1); - +hbool_t H5_coll_api_sanity_check_g = false; /*******************/ /* Local Variables */ @@ -177,55 +168,27 @@ done: herr_t H5AC__init_package(void) { -#ifdef H5_HAVE_PARALLEL - H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ - unsigned coll_meta_write; /* "collective metadata write" property value */ -#endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE #ifdef H5_HAVE_PARALLEL - /* Sanity check */ - HDassert(H5P_CLS_DATASET_XFER_g != NULL); - - /* Get an ID for the collective H5AC dxpl */ + /* Get an ID for the metadata (H5AC) dxpl */ if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") - /* Get the property list object */ - if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - - /* Insert 'collective metadata write' property */ - coll_meta_write = 1; - if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + /* check whether to enable strict collective function calling + sanity checks using MPI barriers */ + { + const char *s; /* String for environment variables */ - /* Get an ID for the independent H5AC dxpl */ - if((H5AC_ind_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") - - /* Get the property list object */ - if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - - /* Insert 'collective metadata write' property */ - coll_meta_write = 0; - if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + s = HDgetenv("H5_COLL_API_SANITY_CHECK"); + if(s && HDisdigit(*s)) { + H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0); + } + } #else /* H5_HAVE_PARALLEL */ - /* Sanity check */ - HDassert(H5P_LST_DATASET_XFER_ID_g!=(-1)); - H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; - H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT; - - /* Get the property list objects for the IDs */ - if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get property list object") #endif /* H5_HAVE_PARALLEL */ done: @@ -256,19 +219,18 @@ H5AC_term_package(void) if(H5_PKG_INIT_VAR) { #ifdef H5_HAVE_PARALLEL - if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) { + if(H5AC_dxpl_id > 0) { /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ - if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0) + if(H5I_dec_ref(H5AC_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Reset static IDs */ H5AC_dxpl_id = (-1); - H5AC_ind_dxpl_id = (-1); /* Reset interface initialization flag */ if(0 == n) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index c628a5d..79bee9b 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -207,17 +207,8 @@ typedef H5C_t H5AC_t; #define H5AC_RING_NAME "H5AC_ring_type" /* Dataset transfer property list for flush calls */ -/* (Collective set, "block before metadata write" set and "library internal" set) */ -/* (Global variable declaration, definition is in H5AC.c) */ H5_DLLVAR hid_t H5AC_dxpl_id; -/* Dataset transfer property list for independent metadata I/O calls */ -/* (just "library internal" set - i.e. independent transfer mode) */ -/* (Global variable declaration, definition is in H5AC.c) */ -H5_DLLVAR H5P_genplist_t *H5AC_ind_dxpl_g; -H5_DLLVAR hid_t H5AC_ind_dxpl_id; - - /* Default cache configuration. */ #define H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index ae0f041..58f0da8 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -191,7 +191,7 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, ".", name, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, ".", name, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name) /* Register the attribute and get an ID for it */ @@ -247,7 +247,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Open the attribute in the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -333,7 +333,7 @@ H5Aget_num_attrs(hid_t loc_id) } /*lint !e788 All appropriate cases are covered */ /* Look up the # of attributes for the object */ - if((ret_value = H5O_attr_count(loc, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_attr_count(loc, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") done: @@ -399,7 +399,7 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) /* Call attribute iteration routine */ last_attr = start_idx = (hsize_t)(attr_num ? *attr_num : 0); - if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_dxpl_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(loc_id, H5AC_dxpl_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ diff --git a/src/H5Aint.c b/src/H5Aint.c index 80761b6..6355556 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -161,7 +161,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((exists = H5O_attr_exists(loc->oloc, name, H5AC_ind_dxpl_id)) < 0) + if((exists = H5O_attr_exists(loc->oloc, name, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") @@ -2396,7 +2396,7 @@ H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_nam H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; diff --git a/src/H5Atest.c b/src/H5Atest.c index d57bbe1..74ed6c4 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -140,7 +140,7 @@ H5A_get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr)); /* Retrieve ref count for shared or shareable attribute */ - if(H5SM_get_refcount(attr->oloc.file, H5AC_ind_dxpl_id, H5O_ATTR_ID, + if(H5SM_get_refcount(attr->oloc.file, H5AC_dxpl_id, H5O_ATTR_ID, &attr->sh_loc, ref_count) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") diff --git a/src/H5C.c b/src/H5C.c index fe14bd1..622e34a 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -2198,9 +2198,6 @@ H5C_insert_entry(H5F_t * f, H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t insert_pinned; hbool_t flush_last; -#ifdef H5_HAVE_PARALLEL - hbool_t flush_collectively; -#endif /* H5_HAVE_PARALLEL */ hbool_t set_flush_marker; hbool_t write_permitted = TRUE; size_t empty_space; @@ -2237,9 +2234,6 @@ H5C_insert_entry(H5F_t * f, set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 ); insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); -#ifdef H5_HAVE_PARALLEL - flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); -#endif /* H5_HAVE_PARALLEL */ /* Get the dataset transfer property list */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) @@ -2288,9 +2282,6 @@ H5C_insert_entry(H5F_t * f, entry_ptr->pinned_from_client = insert_pinned; entry_ptr->pinned_from_cache = FALSE; entry_ptr->flush_me_last = flush_last; -#ifdef H5_HAVE_PARALLEL - entry_ptr->flush_me_collectively = flush_collectively; -#endif /* newly inserted entries are assumed to be dirty */ entry_ptr->is_dirty = TRUE; @@ -3038,10 +3029,10 @@ done: * This allows H5C_protect to accept flags other than * H5C__READ_ONLY_FLAG. * - * Added support for the H5C__FLUSH_LAST_FLAG and - * H5C__FLUSH_COLLECTIVELY_FLAG flags. At present, these - * flags are only applied if the entry is not in cache, and - * is loaded into the cache as a result of this call. + * Added support for the H5C__FLUSH_LAST_FLAG. + * At present, this flag is only applied if the entry is + * not in cache, and is loaded into the cache as a result of + * this call. * *------------------------------------------------------------------------- */ @@ -3059,9 +3050,6 @@ H5C_protect(H5F_t * f, hbool_t have_write_permitted = FALSE; hbool_t read_only = FALSE; hbool_t flush_last; -#ifdef H5_HAVE_PARALLEL - hbool_t flush_collectively; -#endif /* H5_HAVE_PARALLEL */ hbool_t write_permitted; size_t empty_space; void * thing; @@ -3094,9 +3082,6 @@ H5C_protect(H5F_t * f, read_only = ( (flags & H5C__READ_ONLY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); -#ifdef H5_HAVE_PARALLEL - flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); -#endif /* H5_HAVE_PARALLEL */ /* Get the dataset transfer property list */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) @@ -3263,20 +3248,16 @@ H5C_protect(H5F_t * f, * * ******************************************* * - * Set the flush_last (and possibly flush_collectively) fields + * Set the flush_last field * of the newly loaded entry before inserting it into the * index. Must do this, as the index tracked the number of * entries with the flush_last field set, but assumes that * the field will not change after insertion into the index. * - * Note that this means that the H5C__FLUSH_LAST_FLAG and - * H5C__FLUSH_COLLECTIVELY_FLAG flags are ignored if the - * entry is already in cache. + * Note that this means that the H5C__FLUSH_LAST_FLAG flag + * is ignored if the entry is already in cache. */ entry_ptr->flush_me_last = flush_last; -#ifdef H5_HAVE_PARALLEL - entry_ptr->flush_me_collectively = flush_collectively; -#endif H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, NULL) @@ -7974,31 +7955,6 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ entry_ptr->flush_in_progress = TRUE; entry_ptr->flush_marker = FALSE; -#ifdef H5_HAVE_PARALLEL -#ifndef NDEBUG - /* If MPI based VFD is used, do special parallel I/O sanity checks. - * Note that we only do these sanity checks when the clear_only flag - * is not set, and the entry to be flushed is dirty. Don't bother - * otherwise as no file I/O can result. - */ - if(!clear_only && entry_ptr->is_dirty && H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { - H5P_genplist_t *dxpl; /* Dataset transfer property list */ - unsigned coll_meta; /* Collective metadata write flag */ - - /* Get the dataset transfer property list */ - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list") - - /* Get the collective metadata write property */ - if(H5P_get(dxpl, H5AC_COLLECTIVE_META_WRITE_NAME, &coll_meta) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve xfer mode") - - /* Sanity check collective metadata write flag */ - HDassert(coll_meta); - } /* end if */ -#endif /* NDEBUG */ -#endif /* H5_HAVE_PARALLEL */ - /* serialize the entry if necessary, and then write it to disk. */ if(write_entry) { unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 6b63ad5..6e8d94c 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -386,7 +386,7 @@ H5C_apply_candidate_list(H5F_t * f, * Now scan the LRU and PEL lists, flushing or clearing entries as * needed. * - * The flush_me_last and flush_me_collectively flags may dictate how or + * The flush_me_last flag may dictate how or * when some entries can be flushed, and should be addressed here. * However, in their initial implementation, these flags only apply to the * superblock, so there's only a relatively small change to this function @@ -607,11 +607,10 @@ H5C_apply_candidate_list(H5F_t * f, it is the simple case of a single pinned entry needing flushed last and collectively is just a minor addition to this routine, but signficantly buffing up the usage of - flush_me_last or flush_me_collectively will require a more + flush_me_last will require a more intense rework of this function and potentially the function of candidate lists as a whole. */ - HDassert(entry_ptr->flush_me_collectively); entries_to_flush_or_clear_last++; entries_to_flush_collectively++; HDassert(entries_to_flush_or_clear_last == 1); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 467c5d1..f4df00f 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1487,13 +1487,10 @@ typedef int H5C_ring_t; * flushed from the cache until all other entries without * the flush_me_last flag set have been flushed. * - * flush_me_collectively: Boolean flag indicating that this entry needs - * to be flushed collectively when in a parallel situation. - * * Note: * - * At this time, the flush_me_last and flush_me_collectively - * flags will only be applied to one entry, the superblock, + * At this time, the flush_me_last + * flag will only be applied to one entry, the superblock, * and the code utilizing these flags is protected with HDasserts * to enforce this. This restraint can certainly be relaxed in * the future if the the need for multiple entries getting flushed @@ -1711,7 +1708,6 @@ typedef struct H5C_cache_entry_t { hbool_t flush_marker; hbool_t flush_me_last; #ifdef H5_HAVE_PARALLEL - hbool_t flush_me_collectively; hbool_t clear_on_unprotect; hbool_t flush_immediately; #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5D.c b/src/H5D.c index 82aac6e..ee8bb48 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -139,7 +139,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ @@ -219,7 +219,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ @@ -275,7 +275,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -288,7 +288,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the dataset */ @@ -410,7 +410,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* Read dataspace address and return */ - if(H5D__get_space_status(dset, allocation, H5AC_ind_dxpl_id) < 0) + if(H5D__get_space_status(dset, allocation, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") done: @@ -579,7 +579,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset") /* Set return value */ - if(H5D__get_storage_size(dset, H5AC_ind_dxpl_id, &ret_value) < 0) + if(H5D__get_storage_size(dset, H5AC_dxpl_id, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage") done: diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index dfa18fb..c8c8f8c 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -241,7 +241,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) using_mpi = TRUE; /* Use the internal "independent" DXPL */ - my_dxpl_id = H5AC_ind_dxpl_id; + my_dxpl_id = H5AC_dxpl_id; } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 34e0ae9..559dd69 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -90,7 +90,7 @@ H5Ddebug(hid_t dset_id) /* Print B-tree information */ if(H5D_CHUNKED == dset->shared->layout.type) - (void)H5D__chunk_dump_index(dset, H5AC_ind_dxpl_id, stdout); + (void)H5D__chunk_dump_index(dset, H5AC_dxpl_id, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 5a2b355..a4eb67f 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -180,7 +180,7 @@ H5Dopen1(hid_t loc_id, const char *name) H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; FUNC_ENTER_API(FAIL) diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 947a177..59925d8 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -134,7 +134,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* Fill the selection in the memory buffer */ - if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_ind_dxpl_id) < 0) + if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") done: diff --git a/src/H5Dint.c b/src/H5Dint.c index ea3b749..ba7cdbc 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3249,7 +3249,7 @@ H5D_get_create_plist(H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&dset->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + if(H5O_get_create_plist(&dset->oloc, H5AC_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info") /* Get the layout property */ @@ -3311,7 +3311,7 @@ H5D_get_create_plist(H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value") /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") /* Convert disk form of fill value into memory form */ @@ -3339,7 +3339,7 @@ H5D_get_create_plist(H5D_t *dset) } /* end if */ /* Convert fill value */ - if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { + if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_dxpl_id) < 0) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); if(bkg_buf) @@ -3481,7 +3481,7 @@ H5D_get_space(H5D_t *dset) /* If the layout is virtual, update the extent */ if(dset->shared->layout.type == H5D_VIRTUAL) - if(H5D__virtual_set_extent_unlim(dset, H5AC_ind_dxpl_id) < 0) + if(H5D__virtual_set_extent_unlim(dset, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update virtual dataset extent") /* Read the data space message and return a data space object */ diff --git a/src/H5F.c b/src/H5F.c index 2cb81e0..19a9c1d 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -406,7 +406,7 @@ H5Fis_hdf5(const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") /* call the private is_HDF5 function */ - if((ret_value = H5F_is_hdf5(name)) < 0) + if((ret_value = H5F_is_hdf5(name, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file") done: @@ -472,7 +472,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* @@ -571,7 +571,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "SWMR read access on a file open for read-write access is not allowed") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ @@ -917,7 +917,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(file, H5AC_ind_dxpl_id, &tot_space, NULL) < 0) + if(H5MF_get_freespace(file, H5AC_dxpl_id, &tot_space, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") ret_value = (hssize_t)tot_space; @@ -1031,7 +1031,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* call private get_file_image function */ - if((ret_value = H5F_get_file_image(file, buf_ptr, buf_len)) < 0) + if((ret_value = H5F_get_file_image(file, buf_ptr, buf_len, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image") done: @@ -1364,16 +1364,16 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock and any superblock extensions */ - if(H5F__super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) + if(H5F__super_size(f, H5AC_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") /* Get the size of any persistent free space */ - if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0) + if(H5MF_get_freespace(f, H5AC_dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve free space information") /* Check for SOHM info */ if(H5F_addr_defined(f->shared->sohm_addr)) - if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) + if(H5SM_ih_size(f, H5AC_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info") /* Set version # fields */ @@ -1511,7 +1511,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") /* Go get the free-space section information in the file */ - if((ret_value = H5MF_get_free_sections(file, H5AC_ind_dxpl_id, type, nsects, sect_info)) < 0) + if((ret_value = H5MF_get_free_sections(file, H5AC_dxpl_id, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") done: diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index d0e2171..bbd3eca 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -96,12 +96,6 @@ static int H5FD_mpio_mpi_rank(const H5FD_t *_file); static int H5FD_mpio_mpi_size(const H5FD_t *_file); static MPI_Comm H5FD_mpio_communicator(const H5FD_t *_file); -/* MPIO-specific file access properties */ -typedef struct H5FD_mpio_fapl_t { - MPI_Comm comm; /*communicator */ - MPI_Info info; /*file information */ -} H5FD_mpio_fapl_t; - /* The MPIO file driver information */ static const H5FD_class_mpi_t H5FD_mpio_g = { { /* Start of superclass information */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 2c18659..852e7af 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -96,6 +96,14 @@ typedef struct { const void *driver_info; /* Driver info, for open callbacks */ } H5FD_driver_prop_t; +#ifdef H5_HAVE_PARALLEL +/* MPIO-specific file access properties */ +typedef struct H5FD_mpio_fapl_t { + MPI_Comm comm; /*communicator */ + MPI_Info info; /*file information */ +} H5FD_mpio_fapl_t; +#endif /* H5_HAVE_PARALLEL */ + /*****************************/ /* Library Private Variables */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index d16e2d4..c995d5d 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -133,12 +133,12 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock extension */ - if(H5F__super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) + if(H5F__super_size(f, H5AC_dxpl_id, NULL, &finfo->super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size") /* Check for SOHM info */ if(H5F_addr_defined(f->shared->sohm_addr)) - if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) + if(H5SM_ih_size(f, H5AC_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index b6cc1f1..7f723e0 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -509,10 +509,11 @@ done: *------------------------------------------------------------------------- */ htri_t -H5F_is_hdf5(const char *name) +H5F_is_hdf5(const char *name, hid_t dxpl_id) { H5FD_t *file = NULL; /* Low-level file struct */ haddr_t sig_addr; /* Addess of hdf5 file signature */ + H5P_genplist_t *xfer_plist= NULL; /* Dataset transfer property list object */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -521,8 +522,12 @@ H5F_is_hdf5(const char *name) if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") + /* Get the property list object */ + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* The file is an hdf5 file if the hdf5 file signature can be found */ - if(H5FD_locate_signature(file, H5AC_ind_dxpl_g, &sig_addr) < 0) + if(H5FD_locate_signature(file, xfer_plist, &sig_addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") ret_value = (HADDR_UNDEF != sig_addr); @@ -2131,7 +2136,7 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) *------------------------------------------------------------------------- */ ssize_t -H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) +H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t dxpl_id) { H5FD_t *fd_ptr; /* file driver */ haddr_t eoa; /* End of file address */ @@ -2199,8 +2204,9 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* test to see if a buffer was provided -- if not, we are done */ if(buf_ptr != NULL) { size_t space_needed; /* size of file image */ - hsize_t tmp; + hsize_t tmp; size_t tmp_size; + H5P_genplist_t *xfer_plist= NULL; /* Dataset transfer property list object */ /* Check for buffer too small */ if((haddr_t)buf_len < eoa) @@ -2208,12 +2214,16 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) space_needed = (size_t)eoa; + /* Get the property list object */ + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* read in the file image */ /* (Note compensation for base address addition in internal routine) */ - if(H5FD_read(fd_ptr, H5AC_ind_dxpl_g, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0) + if(H5FD_read(fd_ptr, xfer_plist, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed") - /* Offset to "status_flags" in the superblock */ + /* Offset to "status_flags" in the superblock */ tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers); /* Size of "status_flags" depends on the superblock version */ tmp_size = H5F_SUPER_STATUS_FLAGS_SIZE(file->shared->sblock->super_vers); diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index fe2a774..9783947 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -258,5 +258,74 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) done: FUNC_LEAVE_API(ret_value) } + + +/*------------------------------------------------------------------------- + * Function: H5F_mpi_retrieve_comm + * + * Purpose: Retrieves an MPI communicator from the file the location ID + * is in. If the loc_id is invalid, the fapl_id is used to + * retrieve the communicator. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(mpi_comm); + *mpi_comm = MPI_COMM_NULL; + + /* if the loc_id is valid, then get the comm from the file + attached to the loc_id */ + if(H5I_INVALID_HID != loc_id) { + H5G_loc_t loc; + H5F_t *f = NULL; + + /* retrieve the file structure */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + f = loc.oloc->file; + HDassert(f); + + /* check if MPIO driver is used */ + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + /* retrieve the file communicator */ + if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + } + } + /* otherwise, this if from H5Fopen or H5Fcreate and has to be collective */ + else { + H5P_genplist_t *plist; /* Property list pointer */ + + HDassert(H5P_isa_class(acspl_id, H5P_FILE_ACCESS)); + + if(NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") + + if(H5FD_MPIO == H5P_peek_driver(plist)) { + const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ + + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + + *mpi_comm = fa->comm; + } + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_mpi_retrieve_comm */ + #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index f9cd89f..627dec7 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -378,8 +378,9 @@ H5F_t *H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); herr_t H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush); H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing); -H5_DLL htri_t H5F_is_hdf5(const char *name); +H5_DLL htri_t H5F_is_hdf5(const char *name, hid_t dxpl_id); H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); +H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, hid_t dxpl_id); H5_DLL herr_t H5F_close(H5F_t *f); /* File mount related routines */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ecacfaf..fdcffdf 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -648,7 +648,6 @@ H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f); H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f); H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f); H5_DLL hid_t H5F_get_file_id(const H5F_t *f); -H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL H5F_t *H5F_get_parent(const H5F_t *f); H5_DLL unsigned H5F_get_nmounts(const H5F_t *f); H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f); @@ -747,6 +746,7 @@ H5_DLL herr_t H5F_super_dirty(H5F_t *f); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); H5_DLL int H5F_mpi_get_size(const H5F_t *f); +H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); #endif /* H5_HAVE_PARALLEL */ /* External file cache routines */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 6f37ff6..e0b5df5 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -727,9 +727,6 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU /* (We'll rely on the cache to make sure it actually *is* flushed last (and collectively in parallel), but this check doesn't hurt) */ HDassert(sblock->cache_info.flush_me_last); -#ifdef H5_HAVE_PARALLEL - HDassert(sblock->cache_info.flush_me_collectively); -#endif /* Encode the common portion of the file superblock for all versions */ HDmemcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN); diff --git a/src/H5Ftest.c b/src/H5Ftest.c index b741e0d..e8cd8f4 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -109,7 +109,7 @@ H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve count for message type */ - if(H5SM_get_mesg_count_test(file, H5AC_ind_dxpl_id, type_id, mesg_count) < 0) + if(H5SM_get_mesg_count_test(file, H5AC_dxpl_id, type_id, mesg_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve shared message count") done: diff --git a/src/H5G.c b/src/H5G.c index 44e8602..c27d3b1 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -317,7 +317,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ @@ -394,7 +394,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ @@ -453,7 +453,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -466,7 +466,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ @@ -559,7 +559,7 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the group's information */ - if(H5G__obj_info(loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(loc.oloc, grp_info/*out*/, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -589,7 +589,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -604,7 +604,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -652,7 +652,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -672,7 +672,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index e0bc78e..919389f 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -274,7 +274,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Open the group */ - if((grp = H5G__open_name(&loc, name, H5P_DEFAULT, H5AC_ind_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, H5P_DEFAULT, H5AC_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an atom for the group */ @@ -602,7 +602,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Call the new link routine which provides this capability */ - if(H5L_get_val(&loc, name, buf, size, H5P_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5L_get_val(&loc, name, buf, size, H5P_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") done: @@ -688,7 +688,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if(bufsize > 0 && !buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") - if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get comment value") done: @@ -752,7 +752,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_func.op_old = op; /* Call private function. */ - if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ @@ -794,7 +794,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") @@ -802,7 +802,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") /* Retrieve information about the group */ - if(H5G__obj_info(loc.oloc, &grp_info, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(loc.oloc, &grp_info, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") /* Set the number of objects [sic: links] in the group */ @@ -847,7 +847,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Get info */ - if(H5G_get_objinfo(&loc, name, follow_link, statbuf, H5AC_ind_dxpl_id) < 0) + if(H5G_get_objinfo(&loc, name, follow_link, statbuf, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "cannot stat object") done: @@ -1040,13 +1040,13 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a group") /* Call internal function */ - if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") done: @@ -1082,13 +1082,13 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group") /* Call internal function*/ - if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_ind_dxpl_id)) == H5G_UNKNOWN) + if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_dxpl_id)) == H5G_UNKNOWN) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") done: diff --git a/src/H5Gint.c b/src/H5Gint.c index f7f4afe..cd2a4fc 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -1209,17 +1209,17 @@ H5G_get_create_plist(H5G_t *grp) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&grp->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + if(H5O_get_create_plist(&grp->oloc, H5AC_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object creation info") /* Check for the group having a group info message */ - if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_dxpl_id)) < 0) + if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(ginfo_exists) { H5O_ginfo_t ginfo; /* Group info message */ /* Read the group info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") /* Set the group info for the property list */ @@ -1228,7 +1228,7 @@ H5G_get_create_plist(H5G_t *grp) } /* end if */ /* Check for the group having a link info message */ - if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists) { /* Set the link info for the property list */ @@ -1237,13 +1237,13 @@ H5G_get_create_plist(H5G_t *grp) } /* end if */ /* Check for the group having a pipeline message */ - if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_dxpl_id)) < 0) + if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") if(pline_exists) { H5O_pline_t pline; /* Pipeline message */ /* Read the pipeline */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline") /* Set the pipeline for the property list */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index a8796fb..6b20ade 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -97,7 +97,7 @@ H5G__is_empty_test(hid_t gid) H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = FALSE; /* Indicate that a header message is present */ htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -209,7 +209,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -268,7 +268,7 @@ H5G__has_stab_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -319,7 +319,7 @@ H5G__is_new_dense_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -390,7 +390,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_linfo_t linfo; /* Link info message */ H5G_t *grp = NULL; /* Pointer to group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -471,7 +471,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) { H5G_t *grp = NULL; /* Pointer to group */ H5O_stab_t stab; /* Symbol table message */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -613,7 +613,7 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { H5O_stab_t stab; /* Symbol table */ H5HL_t *heap = NULL; /* Pointer to local heap */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) @@ -770,7 +770,7 @@ H5G__verify_cached_stabs_test(hid_t gid) H5O_stab_t stab; /* Symbol table message */ H5G_bt_common_t udata = {NULL, NULL}; /* Dummy udata so H5B_iterate doesn't freak out */ haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5I.c b/src/H5I.c index e952388..90182e7 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2118,7 +2118,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: diff --git a/src/H5Itest.c b/src/H5Itest.c index 9d451c6..43966e7 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -89,7 +89,7 @@ H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: diff --git a/src/H5L.c b/src/H5L.c index 23eb395..efe16aa 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -358,7 +358,9 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, + ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), + TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up src & dst location pointers */ @@ -421,7 +423,9 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, + ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), + TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up src & dst location pointers */ @@ -482,7 +486,7 @@ H5Lcreate_soft(const char *link_target, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the link */ @@ -538,7 +542,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, cur_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up current & new location pointers */ @@ -606,7 +610,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create external link */ @@ -652,7 +656,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Unlink */ @@ -706,7 +710,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ @@ -749,7 +753,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -762,7 +766,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ @@ -799,7 +803,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Group location for location to query */ H5L_trav_gvbi_t udata; /* User data for callback */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -817,7 +821,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ @@ -856,7 +860,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ htri_t ret_value; FUNC_ENTER_API(FAIL) @@ -869,7 +873,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ @@ -900,7 +904,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -913,7 +917,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ @@ -946,7 +950,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group location for group to query */ H5L_trav_gibi_t udata; /* User data for callback */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -964,7 +968,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ @@ -1135,7 +1139,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Location of group */ H5L_trav_gnbi_t udata; /* User data for callback */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1153,7 +1157,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ @@ -1233,7 +1237,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1275,7 +1279,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1293,7 +1297,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ @@ -1368,7 +1372,7 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1426,7 +1430,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 877de41..0d70b34 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -282,7 +282,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, parent_file_name = H5F_OPEN_NAME(loc.oloc->file); /* Query length of parent group name */ - if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name") /* Account for null terminator */ @@ -297,7 +297,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, parent_group_name = local_group_name; /* Get parent group name */ - if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name") /* Make callback */ @@ -599,7 +599,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create an external link */ diff --git a/src/H5O.c b/src/H5O.c index f8f17b6..ba2f352 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -282,7 +282,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = FAIL; @@ -300,7 +300,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -390,7 +390,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */ /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -450,7 +450,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, obj_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Link to the object */ @@ -561,7 +561,7 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -574,7 +574,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ @@ -615,7 +615,7 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, ".", TRUE, oinfo/*out*/, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_info(&loc, ".", TRUE, oinfo/*out*/, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -640,7 +640,7 @@ herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -655,7 +655,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ @@ -690,7 +690,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -710,7 +710,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -724,7 +724,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_found = TRUE; /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, H5AC_ind_dxpl_id, TRUE, oinfo) < 0) + if(H5O_get_info(obj_loc.oloc, H5AC_dxpl_id, TRUE, oinfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: @@ -767,7 +767,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -810,7 +810,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ @@ -852,7 +852,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -881,7 +881,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -894,7 +894,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ @@ -956,7 +956,7 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal object visitation routine */ - if((ret_value = H5O_visit(obj_id, ".", idx_type, order, op, op_data, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_visit(obj_id, ".", idx_type, order, op, op_data, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -1000,7 +1000,7 @@ herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1018,7 +1018,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ @@ -1471,7 +1471,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 28de0eb..c6aab44 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1095,7 +1095,7 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) if(chk_proxy->cont_chunkno == 0) parent = chk_proxy->oh; else { - if(NULL == (cont_chk_proxy = H5O_chunk_protect(chk_proxy->f, H5AC_ind_dxpl_id, chk_proxy->oh, chk_proxy->cont_chunkno))) + if(NULL == (cont_chk_proxy = H5O_chunk_protect(chk_proxy->f, H5AC_dxpl_id, chk_proxy->oh, chk_proxy->cont_chunkno))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") parent = cont_chk_proxy; } /* end else */ @@ -1122,7 +1122,7 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) /* Add flush dependency on object header proxy, if proxy exists */ if(chk_proxy->oh->proxy_present) - if(H5O__proxy_depend(chk_proxy->f, H5AC_ind_dxpl_id, chk_proxy->oh, chk_proxy) < 0) + if(H5O__proxy_depend(chk_proxy->f, H5AC_dxpl_id, chk_proxy->oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "can't create flush dependency on object header proxy") case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -1151,7 +1151,7 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) done: if(cont_chk_proxy) - if(H5O_chunk_unprotect(chk_proxy->f, H5AC_ind_dxpl_id, cont_chk_proxy, FALSE) < 0) + if(H5O_chunk_unprotect(chk_proxy->f, H5AC_dxpl_id, cont_chk_proxy, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index a8ee440..9298c04 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -233,7 +233,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") /* check if destination name already exists */ - if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") if(TRUE == dst_exists) HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") @@ -244,7 +244,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_reset(&src_loc); /* Find the source object to copy */ - if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found") loc_found = TRUE; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index ebcb5d3..f291305 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -527,7 +527,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5T_path_t *tpath; /* Conversion information */ /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to convert between src and dst data types") /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ @@ -555,7 +555,7 @@ H5O_fill_copy(const void *_src, void *_dst) } /* end if */ /* Convert fill value */ - if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { + if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_dxpl_id) < 0) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); if(bkg_buf) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 5963094..98647be 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -771,7 +771,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, UINT32ENCODE(heap_block_p, chksum) /* Insert block into global heap */ - if(H5HG_insert(f, H5AC_ind_dxpl_id, block_size, heap_block, &((H5O_layout_t *)mesg)->storage.u.virt.serial_list_hobjid) < 0) /* Casting away const OK --NAF */ + if(H5HG_insert(f, H5AC_dxpl_id, block_size, heap_block, &((H5O_layout_t *)mesg)->storage.u.virt.serial_list_hobjid) < 0) /* Casting away const OK --NAF */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block") } /* end if */ diff --git a/src/H5Oproxy.c b/src/H5Oproxy.c index 67388fb..f9c5d68 100644 --- a/src/H5Oproxy.c +++ b/src/H5Oproxy.c @@ -324,12 +324,12 @@ H5O__proxy_notify(H5AC_notify_action_t action, void *_thing) /* Create flush dependencies on all other object header chunks */ for(u = 1; u < proxy->oh->nchunks; u++) { - if(NULL == (chk_proxy = H5O_chunk_protect(proxy->f, H5AC_ind_dxpl_id, proxy->oh, u))) + if(NULL == (chk_proxy = H5O_chunk_protect(proxy->f, H5AC_dxpl_id, proxy->oh, u))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") /* same as before, but looks backward...need to check into that..(proxy, chk_proxy) */ if(H5O__proxy_depend_core(chk_proxy, proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - if(H5O_chunk_unprotect(proxy->f, H5AC_ind_dxpl_id, chk_proxy, FALSE) < 0) + if(H5O_chunk_unprotect(proxy->f, H5AC_dxpl_id, chk_proxy, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") chk_proxy = NULL; } /* end for */ @@ -372,7 +372,7 @@ H5O__proxy_notify(H5AC_notify_action_t action, void *_thing) done: if(chk_proxy) { HDassert(ret_value < 0); - if(H5O_chunk_unprotect(proxy->f, H5AC_ind_dxpl_id, chk_proxy, FALSE) < 0) + if(H5O_chunk_unprotect(proxy->f, H5AC_dxpl_id, chk_proxy, FALSE) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") } /* end if */ diff --git a/src/H5Otest.c b/src/H5Otest.c index 1c149e3..b9ed5be 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -108,14 +108,14 @@ H5O_is_attr_dense_test(hid_t oid) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -130,7 +130,7 @@ H5O_is_attr_dense_test(hid_t oid) ret_value = FALSE; done: - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -173,13 +173,13 @@ H5O_is_attr_empty_test(hid_t oid) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0) + if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -195,10 +195,10 @@ H5O_is_attr_empty_test(hid_t oid) HDassert(nattrs == 0); /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + H5_BEGIN_TAG(H5AC_dxpl_id, loc->addr, FAIL); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ @@ -221,9 +221,9 @@ H5O_is_attr_empty_test(hid_t oid) done: /* Release resources */ - if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) + if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -266,14 +266,14 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -288,10 +288,10 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) HDassert(obj_nattrs == 0); /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + H5_BEGIN_TAG(H5AC_dxpl_id, loc->addr, FAIL); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ @@ -311,9 +311,9 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) done: /* Release resources */ - if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) + if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -358,17 +358,17 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + H5_BEGIN_TAG(H5AC_dxpl_id, loc->addr, FAIL); /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR_TAG(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -379,7 +379,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_DONE_TAG(FAIL, FAIL) /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -389,7 +389,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Check if there is a creation order index */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL))) + if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ @@ -404,11 +404,11 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) done: /* Release resources */ - if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) + if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0) + if(bt2_corder && H5B2_close(bt2_corder, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -452,7 +452,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate "unknown" message */ @@ -471,7 +471,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found") done: - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 5836bf0..280a949 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -3233,7 +3233,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) HDmemcpy(fill.buf, value, (size_t)fill.size); /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(type, type, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(type, type, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ @@ -3245,7 +3245,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Convert the fill value */ - if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { + if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_dxpl_id) < 0) { if(bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") @@ -3400,7 +3400,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the fill value */ - if(H5P_get_fill_value(plist, type, value, H5AC_ind_dxpl_id) < 0) + if(H5P_get_fill_value(plist, type, value, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") done: diff --git a/src/H5Pint.c b/src/H5Pint.c index d80e66d..b3d1976 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -30,6 +30,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -273,13 +274,10 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{ /* Library property list classes defined in other code modules */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCRT[1]; /* Object creation */ H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */ H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */ @@ -5452,7 +5450,8 @@ H5P_get_class(const H5P_genplist_t *plist) *------------------------------------------------------------------------- */ herr_t -H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id) +H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, + hid_t *dxpl_id, hid_t loc_id, hbool_t is_collective) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5472,7 +5471,25 @@ H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t * HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") } /* end else */ +#ifdef H5_HAVE_PARALLEL + /* If parallel is enabled and the file driver used in the MPI-IO + VFD, issue an MPI barrier for easier debugging if the API function + calling this is supposed to be called collectively. Note that this + happens only when the environment variable H5_COLL_BARRIER is set + to non 0. */ + if(is_collective && H5_coll_api_sanity_check_g) { + MPI_Comm mpi_comm; /* file communicator */ + + /* retrieve the MPI communicator from the loc_id or the fapl_id */ + if(H5F_mpi_retrieve_comm(loc_id, *acspl_id, &mpi_comm) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") + + /* issue the barrier */ + if(mpi_comm != MPI_COMM_NULL) + MPI_Barrier(mpi_comm); + } +#endif /* H5_HAVE_PARALLEL */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_verify_apl_and_dxpl() */ - diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 7e76a4f..d93e199 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -181,7 +181,8 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); -H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id); +H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, + hid_t *dxpl_id, hid_t loc_id, hbool_t is_collective); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); diff --git a/src/H5R.c b/src/H5R.c index 61b45e1..04d61cd 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -621,7 +621,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, oapl_id, H5AC_ind_dxpl_id, ref_type, _ref, TRUE)) < 0) + if((ret_value = H5R_dereference(file, oapl_id, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") done: @@ -740,7 +740,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the dataspace with the correct region selected */ - if((space = H5R_get_region(loc.oloc->file, H5AC_ind_dxpl_id, ref)) == NULL) + if((space = H5R_get_region(loc.oloc->file, H5AC_dxpl_id, ref)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace") /* Atomize */ @@ -880,7 +880,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, obj_type) < 0) + if(H5R_get_obj_type(loc.oloc->file, H5AC_dxpl_id, ref_type, ref, obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type") done: @@ -1044,7 +1044,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, file = loc.oloc->file; /* Get name */ - if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_ind_dxpl_id, id, ref_type, _ref, name, size)) < 0) + if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_dxpl_id, id, ref_type, _ref, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index b8133b2..4f2f37a 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -125,7 +125,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, &obj_type) < 0) + if(H5R_get_obj_type(loc.oloc->file, H5AC_dxpl_id, ref_type, ref, &obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ @@ -180,7 +180,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_dxpl_id, ref_type, _ref, TRUE)) < 0) + if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object") done: diff --git a/src/H5T.c b/src/H5T.c index 6514a35..703b6f4 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -993,24 +993,24 @@ H5T__init_package(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") status = 0; - status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); /* * Native conversions should be listed last since we can use hardware to @@ -1021,221 +1021,221 @@ H5T__init_package(void) */ /* floating point */ - status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_dxpl_id, FALSE); #if H5_SIZEOF_LONG_DOUBLE != 0 - status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_dxpl_id, FALSE); #endif /* H5_SIZEOF_LONG_DOUBLE != 0 */ /* from long long */ - status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_dxpl_id, FALSE); /* From long */ - status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_dxpl_id, FALSE); /* From short */ - status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_dxpl_id, FALSE); /* From int */ - status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_dxpl_id, FALSE); /* From char */ - status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_dxpl_id, FALSE); /* From char to floats */ - status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned char to floats */ - status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_dxpl_id, FALSE); /* From short to floats */ - status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned short to floats */ - status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_dxpl_id, FALSE); /* From int to floats */ - status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned int to floats */ - status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_dxpl_id, FALSE); /* From long to floats */ - status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_dxpl_id, FALSE); /* From long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE - status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /* From unsigned long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE - status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */ /* From floats to char */ - status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_dxpl_id, FALSE); /* From floats to unsigned char */ - status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_dxpl_id, FALSE); /* From floats to short */ - status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_dxpl_id, FALSE); /* From floats to unsigned short */ - status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_dxpl_id, FALSE); /* From floats to int */ - status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_dxpl_id, FALSE); /* From floats to unsigned int */ - status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_dxpl_id, FALSE); /* From floats to long */ - status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_dxpl_id, FALSE); /* From floats to unsigned long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_dxpl_id, FALSE); /* From floats to long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG - status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */ /* From floats to unsigned long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_dxpl_id, FALSE); #if H5T_CONV_INTERNAL_LDOUBLE_ULLONG - status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */ /* @@ -1243,7 +1243,7 @@ H5T__init_package(void) * data types we use are not important as long as the source and * destination are equal. */ - status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_dxpl_id, FALSE); /* Initialize the +/- Infinity values for floating-point types */ status |= H5T__init_inf(); @@ -1365,7 +1365,7 @@ H5T_top_term_package(void) H5T__print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, - (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) { + (size_t)0, (size_t)0, NULL, NULL,H5AC_dxpl_id) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function " @@ -2460,7 +2460,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified") /* Go register the function */ - if(H5T_register(pers, name, src, dst, func, H5AC_ind_dxpl_id, TRUE) < 0) + if(H5T_register(pers, name, src, dst, func, H5AC_dxpl_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function") done: @@ -2599,7 +2599,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, if(dst_id > 0 && (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type") - if(H5T_unregister(pers, name, src, dst, func, H5AC_ind_dxpl_id) < 0) + if(H5T_unregister(pers, name, src, dst, func, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed") done: @@ -2643,7 +2643,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer") /* Find it */ - if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found") if(pcdata) @@ -2939,7 +2939,7 @@ H5T_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") /* Decode the serialized datatype message */ - if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_ind_dxpl_id, NULL, H5O_DTYPE_ID, buf))) + if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") /* Mark datatype as being in memory now */ @@ -4772,7 +4772,7 @@ H5T_compiler_conv(H5T_t *src, H5T_t *dst) FUNC_ENTER_NOAPI_NOINIT /* Find it */ - if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") ret_value = (htri_t)path->is_hard; diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 39b0a2a..feb61e4 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -128,7 +128,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ @@ -266,7 +266,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ @@ -529,7 +529,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) H5O_type_t obj_type; /* Type of object at location */ H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */ hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -542,7 +542,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ @@ -637,7 +637,7 @@ H5Tget_create_plist(hid_t dtype_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&type->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + if(H5O_get_create_plist(&type->oloc, H5AC_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") } /* end if */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index cd4de1d..89746bf 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -152,7 +152,7 @@ H5Topen1(hid_t loc_id, const char *name) H5O_type_t obj_type; /* Type of object at location */ H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */ hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 14ca9db..ae3d2a1 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -1003,7 +1003,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast") /* Get dataset fill value and store in cd_values[] */ - if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_ind_dxpl_id) < 0) + if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value") } /* end else */ diff --git a/src/H5private.h b/src/H5private.h index 11d2a05..74763a5 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1673,6 +1673,7 @@ typedef struct H5_debug_t { H5_debug_open_stream_t *open_stream; /* Stack of open output streams */ } H5_debug_t; +extern hbool_t H5_coll_api_sanity_check_g; extern H5_debug_t H5_debug_g; #define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) /* Do not use const else AIX strings does not show it. */ diff --git a/test/cache_common.c b/test/cache_common.c index 0433f1c..7cbe561 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3600,7 +3600,7 @@ insert_entry(H5F_t * file_ptr, { H5C_t * cache_ptr; herr_t result; - hid_t xfer = H5AC_ind_dxpl_id; + hid_t xfer = H5AC_dxpl_id; hbool_t insert_pinned; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -3887,7 +3887,7 @@ protect_entry(H5F_t * file_ptr, test_entry_t * base_addr; test_entry_t * entry_ptr; haddr_t baddrs; - hid_t xfer = H5AC_ind_dxpl_id; + hid_t xfer = H5AC_dxpl_id; H5C_cache_entry_t * cache_entry_ptr; if ( pass ) { diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 470f7a1..4a1e7ae 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3866,26 +3866,26 @@ check_invalid_tag_application(void) /* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */ /* Ensure this returns FAILURE, as a tag has not been set up. */ - if ( H5HL_create(f, H5AC_ind_dxpl_id, (size_t)1024, &addr) >= 0) TEST_ERROR; + if ( H5HL_create(f, H5AC_dxpl_id, (size_t)1024, &addr) >= 0) TEST_ERROR; /* Now set up a tag in the dxpl */ - if ( H5AC_tag(H5AC_ind_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; + if ( H5AC_tag(H5AC_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; /* Verify the same call to H5HL_create now works as intended, with a tag set up. */ - if ( H5HL_create(f, H5AC_ind_dxpl_id, (size_t)1024, &addr) < 0) TEST_ERROR; + if ( H5HL_create(f, H5AC_dxpl_id, (size_t)1024, &addr) < 0) TEST_ERROR; /* Reset dxpl to use invalid tag. */ - if ( H5AC_tag(H5AC_ind_dxpl_id, H5AC__INVALID_TAG, NULL) < 0) TEST_ERROR; + if ( H5AC_tag(H5AC_dxpl_id, H5AC__INVALID_TAG, NULL) < 0) TEST_ERROR; /* Call H5HL_protect to protect the local heap created above. */ /* This should fail as no tag is set up during the protect call */ - if (( lheap = H5HL_protect(f, H5AC_ind_dxpl_id, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR; + if (( lheap = H5HL_protect(f, H5AC_dxpl_id, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR; /* Again, set up a valid tag in the DXPL */ - if ( H5AC_tag(H5AC_ind_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; + if ( H5AC_tag(H5AC_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; /* Call H5HL_protect again to protect the local heap. This should succeed. */ - if (( lheap = H5HL_protect(f, H5AC_ind_dxpl_id, addr, H5AC__NO_FLAGS_SET)) == NULL ) TEST_ERROR; + if (( lheap = H5HL_protect(f, H5AC_dxpl_id, addr, H5AC__NO_FLAGS_SET)) == NULL ) TEST_ERROR; /* Now unprotect the heap, as we're done with the test. */ if ( H5HL_unprotect(lheap) < 0 ) TEST_ERROR; -- cgit v0.12 From 8cd0b0aff8551345c84f75ea3c504a97cd87778b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 26 Feb 2016 20:01:52 -0500 Subject: [svn-r29219] Merge of r29062, 29074, 29092 Fortran VDS wrappers and bugfixes. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial w/ Fortran autotools parallel w/ Fortran --- MANIFEST | 1 + fortran/src/CMakeLists.txt | 1 + fortran/src/H5Dff.F90 | 2 +- fortran/src/H5Eff.F90 | 2 +- fortran/src/H5Fff.F90 | 2 +- fortran/src/H5Gff.F90 | 2 +- fortran/src/H5Off.F90 | 2 +- fortran/src/H5Pff.F90 | 517 ++++++++++++++++++++++++++++++++++- fortran/src/H5Rff.F90 | 2 +- fortran/src/H5Sff.F90 | 118 +++++++- fortran/src/H5_buildiface.F90 | 2 +- fortran/src/H5_f.c | 4 + fortran/src/H5f90.h | 2 +- fortran/src/H5f90global.F90 | 23 +- fortran/src/H5fortkit.F90 | 58 ++++ fortran/src/HDF5.F90 | 2 +- fortran/src/Makefile.am | 6 +- fortran/src/hdf5_fortrandll.def.in | 12 + fortran/test/fortranlib_test_F03.F90 | 8 + fortran/test/tH5P_F03.F90 | 472 ++++++++++++++++++++++++++++++++ 20 files changed, 1219 insertions(+), 19 deletions(-) create mode 100644 fortran/src/H5fortkit.F90 diff --git a/MANIFEST b/MANIFEST index f9fb60d..a5f3dac 100644 --- a/MANIFEST +++ b/MANIFEST @@ -216,6 +216,7 @@ ./fortran/src/H5f90global.F90 ./fortran/src/H5f90i.h ./fortran/src/H5f90kit.c +./fortran/src/H5fortkit.F90 ./fortran/src/H5f90proto.h ./fortran/src/H5match_types.c ./fortran/src/HDF5.F90 diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index dc884d5..5854f75 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -161,6 +161,7 @@ set (f90_F_BASE_SRCS # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/H5f90global.F90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5fortkit.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5_ff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index e44d90e..b372dc1 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -4,7 +4,7 @@ ! MODULE H5D ! ! FILE -! fortran/src/H5Dff.f90 +! fortran/src/H5Dff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5D functions. diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index a2efe61..7a0b15b 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -4,7 +4,7 @@ ! MODULE H5E ! ! FILE -! fortran/src/H5Eff.f90 +! fortran/src/H5Eff.F90 ! ! PURPOSE ! This Module contains Fortran interfaces for H5E functions. diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index c69ad82..165fba0 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -4,7 +4,7 @@ ! MODULE H5F ! ! FILE -! H5Fff.f90 +! H5Fff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5F functions. diff --git a/fortran/src/H5Gff.F90 b/fortran/src/H5Gff.F90 index 2e002b5..30076a4 100644 --- a/fortran/src/H5Gff.F90 +++ b/fortran/src/H5Gff.F90 @@ -4,7 +4,7 @@ ! MODULE H5G ! ! FILE -! fortran/src/H5Gff.f90 +! fortran/src/H5Gff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5G functions. diff --git a/fortran/src/H5Off.F90 b/fortran/src/H5Off.F90 index da940df..8d4fb16 100644 --- a/fortran/src/H5Off.F90 +++ b/fortran/src/H5Off.F90 @@ -4,7 +4,7 @@ ! MODULE H5O ! ! FILE -! fortran/src/H5Off.f90 +! fortran/src/H5Off.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5O functions. diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 97f907b..6c6abe4 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -42,7 +42,8 @@ MODULE H5P USE, INTRINSIC :: ISO_C_BINDING USE H5GLOBAL - + USE H5fortkit + INTERFACE h5pset_fapl_multi_f MODULE PROCEDURE h5pset_fapl_multi_l MODULE PROCEDURE h5pset_fapl_multi_s @@ -7321,6 +7322,520 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_mpio_actual_io_mode_f #endif +! +! V I R T U A L D A T S E T S +! + +!****s* +! NAME +! h5pset_virtual_view_f +! +! PURPOSE +! Sets the view of the virtual dataset (VDS) to include or exclude missing mapped elements. +! +! INPUTS +! dapl_id - Identifier of the virtual dataset access property list. +! view - Flag specifying the extent of the data to be included in the view. +! Valid values are: +! H5D_VDS_FIRST_MISSING_F +! H5D_VDS_LAST_AVAILABLE_F +! +! OUTPUTS +! +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! +! SOURCE + SUBROUTINE h5pset_virtual_view_f(dapl_id, view, hdferr) + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER , INTENT(IN) :: view + INTEGER , INTENT(OUT) :: hdferr + +!***** + INTERFACE + INTEGER FUNCTION h5pset_virtual_view(dapl_id, view) BIND(C,NAME='H5Pset_virtual_view') + IMPORT :: HID_T, ENUM_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(ENUM_T), INTENT(IN), VALUE :: view + END FUNCTION h5pset_virtual_view + END INTERFACE + + hdferr = INT( h5pset_virtual_view(dapl_id, INT(view,ENUM_T)) ) + + END SUBROUTINE h5pset_virtual_view_f + +!****s* +! NAME +! h5pget_virtual_view_f +! +! PURPOSE +! Retrieves the view of a virtual dataset accessed with dapl_id. +! +! INPUTS +! dapl_id - Dataset access property list identifier for the virtual dataset +! +! OUTPUTS +! view - The flag specifying the view of the virtual dataset. +! Valid values are: +! H5D_VDS_FIRST_MISSING_F +! H5D_VDS_LAST_AVAILABLE_F +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! SOURCE + SUBROUTINE h5pget_virtual_view_f(dapl_id, view, hdferr) + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER , INTENT(INOUT) :: view + INTEGER , INTENT(OUT) :: hdferr +!***** + INTEGER(ENUM_T) :: view_enum + INTERFACE + INTEGER FUNCTION h5pget_virtual_view(dapl_id, view) BIND(C,NAME='H5Pget_virtual_view') + IMPORT :: HID_T, ENUM_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(ENUM_T), INTENT(OUT) :: view + END FUNCTION h5pget_virtual_view + END INTERFACE + + hdferr = INT( h5pget_virtual_view(dapl_id, view_enum) ) + view = INT(view_enum) + + END SUBROUTINE h5pget_virtual_view_f + +!****s* +! NAME +! h5pset_virtual_printf_gap_f +! +! PURPOSE +! Sets the maximum number of missing source files and/or datasets with the printf-style names +! when getting the extent of an unlimited virtual dataset. +! +! INPUTS +! dapl_id - Dataset access property list identifier for the virtual dataset. +! gap_size - Maximum number of files and/or datasets allowed to be missing for determining +! the extent of an unlimited virtual dataset with printf-style mappings. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_virtual_printf_gap_f(dapl_id, gap_size, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dapl_id + INTEGER(HSIZE_T), INTENT(IN) :: gap_size + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5pset_virtual_printf_gap(dapl_id, gap_size) BIND(C,NAME='H5Pset_virtual_printf_gap') + IMPORT :: HID_T, HSIZE_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(HSIZE_T), INTENT(IN), VALUE :: gap_size + END FUNCTION h5pset_virtual_printf_gap + END INTERFACE + + hdferr = INT( h5pset_virtual_printf_gap(dapl_id, gap_size) ) + + END SUBROUTINE h5pset_virtual_printf_gap_f + +!****s* +! NAME +! h5pget_virtual_printf_gap_f +! +! PURPOSE +! Returns the maximum number of missing source files and/or datasets with the +! printf-style names when getting the extent for an unlimited virtual dataset. +! +! INPUTS +! dapl_id - Dataset access property list identifier for the virtual dataset +! +! OUTPUTS +! gap_size - Maximum number of the files and/or datasets allowed to be missing for +! determining the extent of an unlimited virtual dataset with printf-style mappings. +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_virtual_printf_gap_f(dapl_id, gap_size, hdferr) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: dapl_id + INTEGER(HSIZE_T), INTENT(OUT) :: gap_size + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5pget_virtual_printf_gap(dapl_id, gap_size) BIND(C,NAME='H5Pget_virtual_printf_gap') + IMPORT :: HID_T, HSIZE_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(HSIZE_T), INTENT(OUT) :: gap_size + END FUNCTION h5pget_virtual_printf_gap + END INTERFACE + + hdferr = INT( h5pget_virtual_printf_gap(dapl_id, gap_size) ) + + END SUBROUTINE h5pget_virtual_printf_gap_f + +!****s* +! NAME +! h5pset_virtual_f +! +! PURPOSE +! Sets the mapping between virtual and source datasets. +! +! INPUTS +! dcpl_id - The identifier of the dataset creation property list that will be +! used when creating the virtual dataset. +! vspace_id - The dataspace identifier with the selection within the virtual +! dataset applied, possibly an unlimited selection. +! src_file_name - The name of the HDF5 file where the source dataset is located. +! src_dset_name - The path to the HDF5 dataset in the file specified by src_file_name. +! src_space_id - The source dataset’s dataspace identifier with a selection applied, possibly an unlimited selection +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails + +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_virtual_f(dcpl_id, vspace_id, src_file_name, src_dset_name, src_space_id, hdferr) + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dcpl_id + INTEGER(HID_T), INTENT(IN) :: vspace_id + CHARACTER(LEN=*), INTENT(IN) :: src_file_name + CHARACTER(LEN=*), INTENT(IN) :: src_dset_name + INTEGER(HID_T), INTENT(IN) :: src_space_id + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(src_file_name)+1,KIND=C_CHAR) :: c_src_file_name + CHARACTER(LEN=LEN_TRIM(src_dset_name)+1,KIND=C_CHAR) :: c_src_dset_name + + INTERFACE + INTEGER FUNCTION h5pset_virtual(dcpl_id, vspace_id, c_src_file_name, c_src_dset_name, src_space_id) & + BIND(C,NAME='H5Pset_virtual') + IMPORT :: C_CHAR + IMPORT :: HID_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id + INTEGER(HID_T), INTENT(IN), VALUE :: vspace_id + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: c_src_file_name + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: c_src_dset_name + INTEGER(HID_T), INTENT(IN), VALUE :: src_space_id + END FUNCTION h5pset_virtual + END INTERFACE + + c_src_file_name = TRIM(src_file_name)//C_NULL_CHAR + c_src_dset_name = TRIM(src_dset_name)//C_NULL_CHAR + + hdferr = h5pset_virtual(dcpl_id, vspace_id, c_src_file_name, c_src_dset_name, src_space_id) + + END SUBROUTINE h5pset_virtual_f + +!****s* +! NAME +! h5pget_virtual_count_f +! +! PURPOSE +! Gets the number of mappings for the virtual dataset. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! +! OUTPUTS +! count - The number of mappings. +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_virtual_count_f(dcpl_id, count, hdferr) + + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dcpl_id + INTEGER(SIZE_T), INTENT(OUT) :: count + INTEGER, INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER(HID_T) FUNCTION h5pget_virtual_count(dcpl_id, count) BIND(C,NAME='H5Pget_virtual_count') + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(OUT) :: count + END FUNCTION h5pget_virtual_count + END INTERFACE + + hdferr = INT( h5pget_virtual_count(dcpl_id, count)) + + END SUBROUTINE h5pget_virtual_count_f + +!****s* +! NAME +! h5pget_virtual_vspace_f +! +! PURPOSE +! Gets a dataspace identifier for the selection within the virtual dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_virtual_vspace_f(dcpl_id, index, ds_id, hdferr) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T), INTENT(IN) :: index + INTEGER(HID_T) , INTENT(OUT) :: ds_id + INTEGER, INTENT(OUT) :: hdferr + +!***** + INTERFACE + INTEGER(HID_T) FUNCTION h5pget_virtual_vspace(dcpl_id, index) BIND(C,NAME='H5Pget_virtual_vspace') + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + END FUNCTION h5pget_virtual_vspace + END INTERFACE + + ds_id = h5pget_virtual_vspace(dcpl_id, index) + + hdferr = 0 + IF(ds_id.LT.0) hdferr = -1 + +END SUBROUTINE h5pget_virtual_vspace_f + +!****s* +! NAME +! h5pget_virtual_srcspace_f +! +! PURPOSE +! Gets a dataspace identifier for the selection within the source dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! +! OUTPUTS +! ds_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE +SUBROUTINE h5pget_virtual_srcspace_f(dcpl_id, index, ds_id, hdferr) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T), INTENT(IN) :: index + INTEGER(HID_T) , INTENT(OUT) :: ds_id + INTEGER, INTENT(OUT) :: hdferr + +!***** + INTERFACE + INTEGER(HID_T) FUNCTION h5pget_virtual_srcspace(dcpl_id, index) BIND(C,NAME='H5Pget_virtual_srcspace') + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + END FUNCTION h5pget_virtual_srcspace + END INTERFACE + + ds_id = h5pget_virtual_srcspace(dcpl_id, index) + + hdferr = 0 + IF(ds_id.LT.0) hdferr = -1 + +END SUBROUTINE h5pget_virtual_srcspace_f + +!****s* +! NAME +! h5pget_virtual_filename_f +! +! PURPOSE +! Gets the filename of a source dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! OUTPUTS +! name - A buffer containing the name of the file containing the source dataset. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! name_len - The size of name needed to hold the filename. (OUT) +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE +SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T) , INTENT(IN) :: index + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL :: name_len +!***** + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + TYPE(C_PTR) :: f_ptr + + INTERFACE + INTEGER(SIZE_T) FUNCTION h5pget_virtual_filename(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_filename') + IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + TYPE(C_PTR), VALUE :: name + INTEGER(SIZE_T), INTENT(IN), VALUE :: size + END FUNCTION h5pget_virtual_filename + END INTERFACE + + hdferr = 0 + IF(PRESENT(name_len))THEN + name_len = INT(h5pget_virtual_filename(dcpl_id, index, C_NULL_PTR, 0_SIZE_T), SIZE_T) + IF(name_len.LT.0) hdferr = -1 + ELSE + f_ptr = C_LOC(c_name(1)(1:1)) + + IF(INT(h5pget_virtual_filename(dcpl_id, index, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN + hdferr = -1 + ELSE + CALL HD5c2fstring(name,c_name,LEN(name)) + ENDIF + + ENDIF + + +END SUBROUTINE h5pget_virtual_filename_f + +!****s* +! NAME +! h5pget_virtual_dsetname_f +! +! PURPOSE +! Gets the name of a source dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! OUTPUTS +! name - A buffer containing the name of the source dataset. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! name_len - The size of name needed to hold the source dataset name. (OUT) +! +! AUTHOR +! M. Scot Breitenfeld +! January 28, 2016 +! +! HISTORY +! +! SOURCE +SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T) , INTENT(IN) :: index + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL :: name_len +!***** + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + TYPE(C_PTR) :: f_ptr + + INTERFACE + INTEGER(SIZE_T) FUNCTION h5pget_virtual_dsetname(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_dsetname') + IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + TYPE(C_PTR), VALUE :: name + INTEGER(SIZE_T), INTENT(IN), VALUE :: size + END FUNCTION h5pget_virtual_dsetname + END INTERFACE + + hdferr = 0 + IF(PRESENT(name_len))THEN + name_len = INT(h5pget_virtual_dsetname(dcpl_id, index, C_NULL_PTR, 0_SIZE_T), SIZE_T) + IF(name_len.LT.0) hdferr = -1 + ELSE + f_ptr = C_LOC(c_name(1)(1:1)) + + IF(INT(h5pget_virtual_dsetname(dcpl_id, index, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN + hdferr = -1 + ELSE + CALL HD5c2fstring(name,c_name,LEN(name)) + ENDIF + + ENDIF + +END SUBROUTINE h5pget_virtual_dsetname_f + END MODULE H5P diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90 index a90bd9a..7ba91c4 100644 --- a/fortran/src/H5Rff.F90 +++ b/fortran/src/H5Rff.F90 @@ -4,7 +4,7 @@ ! MODULE H5R ! ! FILE -! fortran/src/H5Rff.f90 +! fortran/src/H5Rff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5R functions. diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index fd4226c..cb1388e 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -4,7 +4,7 @@ ! MODULE H5S ! ! FILE -! fortran/src/H5Sff.f90 +! fortran/src/H5Sff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5S functions. @@ -41,7 +41,7 @@ !***** MODULE H5S - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_INT USE H5GLOBAL CONTAINS @@ -1751,4 +1751,118 @@ CONTAINS END SUBROUTINE h5sextent_equal_f +! +!****s* H5S/h5sget_regular_hyperslab_f +! +! NAME +! h5sget_regular_hyperslab_f +! +! PURPOSE +! Retrieves a regular hyperslab selection. +! +! INPUTS +! space_id - The identifier of the dataspace. +! OUTPUTS +! start - Offset of the start of the regular hyperslab. +! stride - Stride of the regular hyperslab. +! count - Number of blocks in the regular hyperslab. +! block - Size of a block in the regular hyperslab. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! January, 28 2016 +! SOURCE + SUBROUTINE h5sget_regular_hyperslab_f(space_id, start, stride, count, block, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: start + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: stride + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: count + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: block + INTEGER, INTENT(OUT) :: hdferr +!***** + TYPE(C_PTR) :: start_c, stride_c, count_c, block_c + INTEGER :: n + + INTERFACE + INTEGER FUNCTION h5sget_regular_hyperslab(space_id, start, stride, count, block) BIND(C,NAME='H5Sget_regular_hyperslab') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: space_id + TYPE(C_PTR), VALUE :: start, stride, count, block + END FUNCTION h5sget_regular_hyperslab + END INTERFACE + + hdferr = 0 + + start_c = C_LOC(start(1)) + stride_c = C_LOC(stride(1)) + count_c = C_LOC(count(1)) + block_c = C_LOC(block(1)) + + IF(INT(h5sget_regular_hyperslab(space_id, start_c, stride_c, count_c, block_c)).LT.0) hdferr = -1 + + ! Reverse the C arrays description values of the hyperslab because + ! the hyperslab was for a C stored hyperslab + + CALL H5Sget_simple_extent_ndims_f(space_id,n,hdferr) + IF(hdferr.LT.0.OR.n.EQ.0)THEN + hdferr=-1 + ELSE + start(1:n) = start(n:1:-1) + stride(1:n) = stride(n:1:-1) + count(1:n) = count(n:1:-1) + block(1:n) = block(n:1:-1) + ENDIF + + END SUBROUTINE h5sget_regular_hyperslab_f + +!****s* H5S/h5sis_regular_hyperslab_f +! +! NAME +! h5sis_regular_hyperslab_f +! +! PURPOSE +! Retrieves a regular hyperslab selection. +! +! INPUTS +! space_id - The identifier of the dataspace. +! OUTPUTS +! IsRegular - TRUE or FALSE for hyperslab selection if successful. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! January, 28 2016 +! SOURCE + SUBROUTINE h5sis_regular_hyperslab_f(space_id, IsRegular, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id + LOGICAL :: IsRegular + INTEGER, INTENT(OUT) :: hdferr +!***** + INTEGER(C_INT) :: status + + INTERFACE + INTEGER(C_INT) FUNCTION H5Sis_regular_hyperslab(space_id) BIND(C,NAME='H5Sis_regular_hyperslab') + IMPORT :: HID_T, C_INT + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: space_id + END FUNCTION H5Sis_regular_hyperslab + END INTERFACE + + status = H5Sis_regular_hyperslab(space_id) + + hdferr = 0 + IsRegular = .FALSE. + IF(status.GT.0)THEN + IsRegular = .TRUE. + ELSE IF(status.LT.0)THEN + hdferr = -1 + ENDIF + + END SUBROUTINE H5Sis_regular_hyperslab_f + END MODULE H5S diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index 9a42cbf..471052f 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -4,7 +4,7 @@ ! Executable: H5_buildiface ! ! FILE -! fortran/src/H5_buildiface.f90 +! fortran/src/H5_buildiface.F90 ! ! PURPOSE ! This stand alone program is used at build time to generate the module diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index f3bc42f..d7b952d 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -476,6 +476,10 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5d_flags[22] = (int_f)H5D_MPIO_CHUNK_COLLECTIVE; h5d_flags[23] = (int_f)H5D_MPIO_CHUNK_MIXED; h5d_flags[24] = (int_f)H5D_MPIO_CONTIGUOUS_COLLECTIVE; + h5d_flags[25] = (int_f)H5D_VDS_ERROR; + h5d_flags[26] = (int_f)H5D_VDS_FIRST_MISSING; + h5d_flags[27] = (int_f)H5D_VDS_LAST_AVAILABLE; + h5d_flags[28] = (int_f)H5D_VIRTUAL; /* * H5E flags diff --git a/fortran/src/H5f90.h b/fortran/src/H5f90.h index c45cfcb..7082d1d 100644 --- a/fortran/src/H5f90.h +++ b/fortran/src/H5f90.h @@ -22,7 +22,7 @@ #include "H5f90i.h" #include "H5f90proto.h" -/* Constants used in H5Rff.f90 and H5Rf.c files */ +/* Constants used in H5Rff.F90 and H5Rf.c files */ #define REF_REG_BUF_LEN_F 3 /* Constants used in H5Gf.c files */ diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 947eff4..ac59251 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -4,7 +4,7 @@ ! MODULE H5GLOBAL ! ! FILE -! src/fortran/H5f90global.f90 +! src/fortran/H5f90global.F90 ! ! PURPOSE ! This module is used to pass C stubs for H5 Fortran APIs. The C stubs are @@ -46,12 +46,19 @@ MODULE H5GLOBAL IMPLICIT NONE + ! Enumerate data type that is interoperable with C. + ENUM, BIND(C) + ENUMERATOR :: enum_dtype + END ENUM + INTEGER, PARAMETER :: ENUM_T = KIND(enum_dtype) + + ! Definitions for reference datatypes. ! If you change the value of these parameters, do not forget to change corresponding ! values in the H5f90.h file. INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 - ! Parameters used in the function 'h5kind_to_type' located in H5_ff.f90. + ! Parameters used in the function 'h5kind_to_type' located in H5_ff.F90. ! The flag is used to tell the function whether the kind input variable ! is for a REAL or INTEGER data type. @@ -366,11 +373,11 @@ MODULE H5GLOBAL EQUIVALENCE(H5G_flags(10), H5G_STORAGE_TYPE_SYMBOL_TABLE_F) EQUIVALENCE(H5G_flags(11), H5G_STORAGE_TYPE_COMPACT_F) EQUIVALENCE(H5G_flags(12), H5G_STORAGE_TYPE_DENSE_F) + ! ! H5D flags declaration ! - - INTEGER, PARAMETER :: H5D_FLAGS_LEN = 25 + INTEGER, PARAMETER :: H5D_FLAGS_LEN = 29 INTEGER :: H5D_flags(H5D_FLAGS_LEN) INTEGER, PARAMETER :: H5D_SIZE_FLAGS_LEN = 2 INTEGER(SIZE_T) :: H5D_size_flags(H5D_SIZE_FLAGS_LEN) @@ -418,6 +425,10 @@ MODULE H5GLOBAL INTEGER :: H5D_MPIO_CHUNK_COLLECTIVE_F INTEGER :: H5D_MPIO_CHUNK_MIXED_F INTEGER :: H5D_MPIO_CONTIG_COLLECTIVE_F + INTEGER :: H5D_VDS_ERROR_F + INTEGER :: H5D_VDS_FIRST_MISSING_F + INTEGER :: H5D_VDS_LAST_AVAILABLE_F + INTEGER :: H5D_VIRTUAL_F EQUIVALENCE(H5D_flags(1), H5D_COMPACT_F) EQUIVALENCE(H5D_flags(2), H5D_CONTIGUOUS_F) @@ -449,6 +460,10 @@ MODULE H5GLOBAL EQUIVALENCE(H5D_flags(23), H5D_MPIO_CHUNK_COLLECTIVE_F) EQUIVALENCE(H5D_flags(24), H5D_MPIO_CHUNK_MIXED_F) EQUIVALENCE(H5D_flags(25), H5D_MPIO_CONTIG_COLLECTIVE_F) + EQUIVALENCE(H5D_flags(26), H5D_VDS_ERROR_F) + EQUIVALENCE(H5D_flags(27), H5D_VDS_FIRST_MISSING_F) + EQUIVALENCE(H5D_flags(28), H5D_VDS_LAST_AVAILABLE_F) + EQUIVALENCE(H5D_flags(29), H5D_VIRTUAL_F) EQUIVALENCE(H5D_size_flags(1), H5D_CHUNK_CACHE_NSLOTS_DFLT_F) EQUIVALENCE(H5D_size_flags(2), H5D_CHUNK_CACHE_NBYTES_DFLT_F) diff --git a/fortran/src/H5fortkit.F90 b/fortran/src/H5fortkit.F90 new file mode 100644 index 0000000..9afd890 --- /dev/null +++ b/fortran/src/H5fortkit.F90 @@ -0,0 +1,58 @@ +!****h* H5fortkit/H5fortkit +! PURPOSE +! Routines to deal with C-FORTRAN issues. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +MODULE H5fortkit + +CONTAINS + +!****if* H5fortkit/HD5c2fstring +! NAME +! HD5c2fstring +! INPUTS +! cstring - C string stored as a string array of size 'len' of string size LEN=1 +! len - length of Fortran string +! OUTPUT +! fstring - Fortran string array of LEN=1 +! PURPOSE +! Copies a Fortran array of strings having a length of one to a fortran string and removes the C Null +! terminator. The Null terminator is returned from C when calling the C APIs directly. +! +! The fortran standard does not allow C_LOC to be used on a character string of +! length greater than one, which is why we use the array of characters instead. +! +! SOURCE + SUBROUTINE HD5c2fstring(fstring,cstring,len) +!***** + IMPLICIT NONE + + INTEGER :: i + INTEGER :: len + CHARACTER(LEN=len) :: fstring + CHARACTER(LEN=1), DIMENSION(1:len) :: cstring + + fstring = '' + DO i = 1, len + IF (cstring(i)(1:1)==CHAR(0)) EXIT + fstring(i:i) = cstring(i)(1:1) + END DO + + END SUBROUTINE HD5c2fstring + +END MODULE H5fortkit diff --git a/fortran/src/HDF5.F90 b/fortran/src/HDF5.F90 index 64f5be6..cbe4c83 100644 --- a/fortran/src/HDF5.F90 +++ b/fortran/src/HDF5.F90 @@ -4,7 +4,7 @@ ! MODULE HDF5 ! ! FILE -! src/fortran/src/HDF5.f90 +! src/fortran/src/HDF5.F90 ! ! PURPOSE ! This is the main module used for linking to the Fortran HDF library. diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index eb45f60..f4d192b 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -46,9 +46,9 @@ endif libhdf5_fortran_la_SOURCES=H5f90global.F90 \ H5fortran_types.F90 H5_ff.F90 H5Aff.F90 H5Dff.F90 H5Eff.F90 \ H5Fff.F90 H5Gff.F90 H5Iff.F90 H5Lff.F90 H5Off.F90 H5Pff.F90 H5Rff.F90 H5Sff.F90 \ - H5Tff.F90 H5Zff.F90 H5_gen.f90 \ + H5Tff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ - H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.f90 + H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.F90 # HDF5 Fortran library depends on HDF5 Library. libhdf5_fortran_la_LIBADD=$(LIBHDF5) @@ -153,7 +153,7 @@ H5Gff.lo: $(srcdir)/H5Gff.F90 H5f90global.lo H5Iff.lo: $(srcdir)/H5Iff.F90 H5f90global.lo H5Lff.lo: $(srcdir)/H5Lff.F90 H5f90global.lo H5Off.lo: $(srcdir)/H5Off.F90 H5f90global.lo -H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo +H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 1333262..42b5642 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -318,6 +318,16 @@ H5P_mp_H5PREGISTER_PTR H5P_mp_H5PINSERT_PTR H5P_mp_H5PGET_FILE_IMAGE_F H5P_mp_H5PSET_FILE_IMAGE_F +H5P_mp_H5PSET_VIRTUAL_VIEW_F +H5P_mp_H5PGET_VIRTUAL_VIEW_F +H5P_mp_H5PSET_VIRTUAL_PRINTF_GAP_F +H5P_mp_H5PGET_VIRTUAL_PRINTF_GAP_F +H5P_mp_H5PSET_VIRTUAL_F +H5P_mp_H5PGET_VIRTUAL_COUNT_F +H5P_mp_H5PGET_VIRTUAL_VSPACE_F +H5P_mp_H5PGET_VIRTUAL_SRCSPACE_F +H5P_mp_H5PGET_VIRTUAL_FILENAME_F +H5P_mp_H5PGET_VIRTUAL_DSETNAME_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F @@ -367,6 +377,8 @@ H5S_mp_H5SGET_SELECT_TYPE_F H5S_mp_H5SDECODE_F H5S_mp_H5SENCODE_F H5S_mp_H5SEXTENT_EQUAL_F +H5S_mp_H5SGET_REGULAR_HYPERSLAB_F +H5S_mp_H5SIS_REGULAR_HYPERSLAB_F ; H5T H5T_mp_H5TOPEN_F H5T_mp_H5TCOMMIT_F diff --git a/fortran/test/fortranlib_test_F03.F90 b/fortran/test/fortranlib_test_F03.F90 index 5b386b9..070cd73 100644 --- a/fortran/test/fortranlib_test_F03.F90 +++ b/fortran/test/fortranlib_test_F03.F90 @@ -174,6 +174,14 @@ PROGRAM fortranlibtest_F03 CALL test_get_file_image(ret_total_error) CALL write_test_status(ret_total_error, ' Testing get file image ', total_error) +! write(*,*) +! write(*,*) '=========================================' +! write(*,*) 'Testing VDS ' +! write(*,*) '=========================================' + + ret_total_error = 0 + CALL test_vds(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing vds ', total_error) WRITE(*,*) diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index 8982fc2..15bd86f 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -617,4 +617,476 @@ SUBROUTINE external_test_offset(cleanup,total_error) CALL check("h5_cleanup_f", error, total_error) END SUBROUTINE external_test_offset + +!****h* root/fortran/test/tH5P_F03.f90 +! +! NAME +! test_vds +! +! FUNCTION +! Tests VDS API wrappers +! +! RETURNS: +! Success: 0 +! Failure: number of errors +! +! FORTRAN Programmer: M. Scot Breitenfeld +! February 1, 2016 +! +!------------------------------------------------------------------------- +! +SUBROUTINE test_vds(total_error) + + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors + INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(18) !should map to INTEGER*8 on most modern processors + + CHARACTER(LEN=6), PARAMETER :: VFILENAME="vds.h5" + CHARACTER(LEN=3), PARAMETER :: DATASET="VDS" + INTEGER :: VDSDIM0 + INTEGER, PARAMETER :: VDSDIM1 = 10 + INTEGER, PARAMETER :: VDSDIM2 = 15 + + INTEGER :: DIM0 + INTEGER, PARAMETER :: DIM0_1= 4 ! Initial size of the source datasets + INTEGER, PARAMETER :: DIM1 = 10 + INTEGER, PARAMETER :: DIM2 = 15 + INTEGER, PARAMETER :: RANK = 3 + INTEGER(hsize_t), PARAMETER :: PLANE_STRIDE = 4 + + CHARACTER(LEN=4), DIMENSION(1:PLANE_STRIDE) :: SRC_FILE = (/"a.h5","b.h5","c.h5","d.h5"/) + CHARACTER(LEN=3), DIMENSION(1:PLANE_STRIDE) :: SRC_DATASET = (/"AAA","BBB","CCC","DDD"/) + + + INTEGER(hid_t) :: vfile, file, src_space, mem_space, vspace, vdset, dset !Handles + INTEGER(hid_t) :: dcpl, dapl + INTEGER :: error + INTEGER(hsize_t), DIMENSION(1:3) :: vdsdims = (/4*DIM0_1, VDSDIM1, VDSDIM2/), & + vdsdims_max, & + dims = (/DIM0_1, DIM1, DIM2/), & + memdims = (/DIM0_1, DIM1, DIM2/), & + extdims = (/0, DIM1, DIM2/), & ! Dimensions of the extended source datasets + chunk_dims = (/DIM0_1, DIM1, DIM2/), & + dims_max, & + vdsdims_out, vdsdims_max_out, & + start, & ! Hyperslab parameters + stride, & + count, & + src_count, block + INTEGER(hsize_t), DIMENSION(1:2,1:3) :: vdsdims_out_correct + + INTEGER(hsize_t), DIMENSION(1:3) :: start_out, & !Hyperslab PARAMETER out + stride_out, count_out, count_correct, block_out + INTEGER(hsize_t), DIMENSION(1:3,1:PLANE_STRIDE) :: start_correct + + INTEGER :: i, j + INTEGER :: layout ! Storage layout + INTEGER(size_t) :: num_map ! Number of mappings + INTEGER(size_t) :: len ! Length of the string also a RETURN value + CHARACTER(LEN=180) :: filename + ! Different sized character buffers + CHARACTER(len=LEN(SRC_FILE(1))-3) :: SRC_FILE_LEN_TINY + CHARACTER(len=LEN(SRC_FILE(1))-1) :: SRC_FILE_LEN_SMALL + CHARACTER(len=LEN(SRC_FILE(1))) :: SRC_FILE_LEN_EXACT + CHARACTER(len=LEN(SRC_FILE(1))+1) :: SRC_FILE_LEN_LARGE + CHARACTER(len=LEN(SRC_FILE(1))+10) :: SRC_FILE_LEN_HUGE + CHARACTER(len=LEN(SRC_DATASET(1))) :: SRC_DATASET_LEN_EXACT + + INTEGER(HID_T) :: space_out + + INTEGER :: s_type, virtual_view + INTEGER :: type1, type2 + + CHARACTER(LEN=180) :: dsetname + INTEGER, DIMENSION(DIM0_1*DIM1*DIM2), TARGET :: wdata + TYPE(C_PTR) :: f_ptr + INTEGER(SIZE_T) :: nsize + LOGICAL :: IsRegular + INTEGER(HSIZE_T) :: gap_size + + ! For testing against + vdsdims_out_correct(1,1) = DIM0_1*5 + vdsdims_out_correct(2,1) = DIM0_1*8 + vdsdims_out_correct(1:2,2) = VDSDIM1 + vdsdims_out_correct(1:2,3) = VDSDIM2 + + VDSDIM0 = H5S_UNLIMITED_F + DIM0 = H5S_UNLIMITED_F + vdsdims_max = (/VDSDIM0, VDSDIM1, VDSDIM2/) + dims_max = (/DIM0, DIM1, DIM2/) + + ! + ! Create source files and datasets. + ! + DO i = 1, PLANE_STRIDE + ! + ! Initialize data for i-th source dataset. + DO j = 1, DIM0_1*DIM1*DIM2 + wdata(j) = i + ENDDO + ! + ! Create the source files and datasets. Write data to each dataset and + ! close all resources. + CALL h5fcreate_f(SRC_FILE(i), H5F_ACC_TRUNC_F, file, error) + CALL check("h5fcreate_f", error, total_error) + + CALL h5screate_simple_f(RANK, dims, src_space, error, dims_max) + CALL check("h5screate_simple_f", error, total_error) + CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_chunk_f(dcpl, RANK, chunk_dims, error) + CALL check("h5pset_chunk_f",error, total_error) + + CALL h5dcreate_f(file, SRC_DATASET(i), H5T_NATIVE_INTEGER, src_space, dset, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F) + CALL check("h5dcreate_f",error, total_error) + f_ptr = C_LOC(wdata(1)) + CALL H5Dwrite_f(dset, H5T_NATIVE_INTEGER, f_ptr, error) + CALL check("H5Dwrite_f",error, total_error) + CALL H5Sclose_f(src_space, error) + CALL check("H5Sclose_f",error, total_error) + CALL H5Pclose_f(dcpl, error) + CALL check("H5Pclose_f",error, total_error) + CALL H5Dclose_f(dset, error) + CALL check("H5Dclose_f",error, total_error) + CALL H5Fclose_f(file, error) + CALL check("H5Fclose_f",error, total_error) + ENDDO + + CALL h5fcreate_f(VFILENAME, H5F_ACC_TRUNC_F, vfile, error) + CALL check("h5fcreate_f", error, total_error) + + ! Create VDS dataspace. + CALL H5Screate_simple_f(RANK, vdsdims, vspace, error, vdsdims_max) + CALL check("H5Screate_simple_f", error, total_error) + + ! Create dataspaces for the source dataset. + CALL H5Screate_simple_f(RANK, dims, src_space, error, dims_max) + CALL check("H5Screate_simple_f", error, total_error) + + ! Create VDS creation property + CALL H5Pcreate_f (H5P_DATASET_CREATE_F, dcpl, error) + CALL check("H5Pcreate_f", error, total_error) + + ! Initialize hyperslab values + start(1:3) = 0 + stride(1:3) = (/PLANE_STRIDE,1_hsize_t,1_hsize_t/) ! we will select every fifth plane in VDS + count(1:3) = (/H5S_UNLIMITED_F,1_hsize_t,1_hsize_t/) + src_count(1:3) = (/H5S_UNLIMITED_F,1_hsize_t,1_hsize_t/) + block(1:3) = (/1, DIM1, DIM2/) + + ! + ! Build the mappings + ! + start_correct = 0 + CALL H5Sselect_hyperslab_f(src_space, H5S_SELECT_SET_F, start, src_count, error, block=block) + CALL check("H5Sselect_hyperslab_f", error, total_error) + DO i = 1, PLANE_STRIDE + start_correct(1,i) = start(1) + CALL H5Sselect_hyperslab_f(vspace, H5S_SELECT_SET_F, start, count, error, stride=stride, block=block) + CALL check("H5Sselect_hyperslab_f", error, total_error) + + IF(i.eq.1)THEN ! check src_file and src_dataset with trailing blanks + CALL H5Pset_virtual_f (dcpl, vspace, SRC_FILE(i)//" ", SRC_DATASET(i)//" ", src_space, error) + ELSE + CALL H5Pset_virtual_f (dcpl, vspace, SRC_FILE(i), SRC_DATASET(i), src_space, error) + ENDIF + CALL check("H5Pset_virtual_f", error, total_error) + start(1) = start(1) + 1 + ENDDO + + CALL H5Sselect_none_f(vspace, error) + CALL check("H5Sselect_none_f", error, total_error) + + ! Create a virtual dataset + CALL H5Dcreate_f(vfile, DATASET, H5T_NATIVE_INTEGER, vspace, vdset, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F) + CALL check("H5Dcreate_f", error, total_error) + CALL H5Sclose_f(vspace, error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Sclose_f(src_space, error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Pclose_f(dcpl, error) + CALL check("H5Pclose_f", error, total_error) + + ! Let's add data to the source datasets and check new dimensions for VDS + ! We will add only one plane to the first source dataset, two planes to the + ! second one, three to the third, and four to the forth. + + DO i = 1, PLANE_STRIDE + ! + ! Initialize data for i-th source dataset. + DO j = 1, i*DIM1*DIM2 + wdata(j) = 10*i + ENDDO + + ! + ! Open the source files and datasets. Append data to each dataset and + ! close all resources. + CALL H5Fopen_f (SRC_FILE(i), H5F_ACC_RDWR_F, file, error) + CALL check("H5Fopen_f", error, total_error) + CALL H5Dopen_f (file, SRC_DATASET(i), dset, error) + CALL check("H5Dopen_f", error, total_error) + extdims(1) = DIM0_1+i + CALL H5Dset_extent_f(dset, extdims, error) + CALL check("H5Dset_extent_f", error, total_error) + CALL H5Dget_space_f(dset, src_space, error) + CALL check("H5Dget_space_f", error, total_error) + + start(1:3) = (/DIM0_1,0,0/) + count(1:3) = 1 + block(1:3) = (/i, DIM1, DIM2/) + + memdims(1) = i + + CALL H5Screate_simple_f(RANK, memdims, mem_space, error) + CALL check("H5Screate_simple_f", error, total_error) + + CALL H5Sselect_hyperslab_f(src_space, H5S_SELECT_SET_F, start,count, error,block=block) + CALL check("H5Sselect_hyperslab_f", error, total_error) + f_ptr = C_LOC(wdata(1)) + CALL H5Dwrite_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space, src_space, H5P_DEFAULT_F) + CALL check("H5Dwrite_f", error, total_error) + CALL H5Sclose_f(src_space, error) + CALL check("H5Sclose_f", error, total_error) + call H5Dclose_f(dset, error) + CALL check("H5Dclose_f", error, total_error) + call H5Fclose_f(file, error) + CALL check("H5Fclose_f", error, total_error) + ENDDO + + call H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + call H5Fclose_f(vfile, error) + CALL check("H5Fclose_f", error, total_error) + + ! + ! begin the read section + ! + ! Open file and dataset using the default properties. + CALL H5Fopen_f(VFILENAME, H5F_ACC_RDONLY_F, vfile, error) + CALL check("H5Fopen_f", error, total_error) + + ! + ! Open VDS using different access properties to use max or + ! min extents depending on the sizes of the underlying datasets + CALL H5Pcreate_f(H5P_DATASET_ACCESS_F, dapl, error) + CALL check("H5Pcreate_f", error, total_error) + + DO i = 1, 2 + + IF(i.NE.1)THEN + CALL H5Pset_virtual_view_f(dapl, H5D_VDS_LAST_AVAILABLE_F, error) + CALL check("H5Pset_virtual_view_f", error, total_error) + ELSE + CALL H5Pset_virtual_view_f(dapl, H5D_VDS_FIRST_MISSING_F, error) + CALL check("H5Pset_virtual_view_f", error, total_error) + ENDIF + + CALL H5Dopen_f(vfile, DATASET, vdset, error, dapl) + CALL check("H5Dopen_f", error, total_error) + + ! Let's get space of the VDS and its dimension we should get 32(or 20)x10x10 + CALL H5Dget_space_f(vdset, vspace, error) + CALL check("H5Dget_space_f", error, total_error) + CALL H5Sget_simple_extent_dims_f(vspace, vdsdims_out, vdsdims_max_out, error) + CALL check("H5Sget_simple_extent_dims_f", error, total_error) + + ! check VDS dimensions + DO j = 1, RANK + IF(vdsdims_out(j).NE.vdsdims_out_correct(i,j))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + CALL H5Pget_virtual_view_f(dapl, virtual_view, error) + CALL check("h5pget_virtual_view_f", error, total_error) + + IF(i.EQ.1)THEN + IF(virtual_view .NE. H5D_VDS_FIRST_MISSING_F)THEN + total_error = total_error + 1 + ENDIF + ELSE + IF(virtual_view .NE. H5D_VDS_LAST_AVAILABLE_F)THEN + total_error = total_error + 1 + ENDIF + + ENDIF + + ! Close + CALL H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Sclose_f(vspace, error) + CALL check("H5Sclose_f", error, total_error) + ENDDO + + CALL H5Dopen_f(vfile, DATASET, vdset, error) + CALL check("H5Dopen_f", error, total_error) + + ! + ! Get creation property list and mapping properties. + ! + CALL H5Dget_create_plist_f (vdset, dcpl, error) + CALL check("H5Dget_create_plist_f", error, total_error) + + ! + ! Get storage layout. + CALL H5Pget_layout_f(dcpl, layout, error) + CALL check("H5Pget_layout_f", error, total_error) + + IF (H5D_VIRTUAL_F .NE. layout) THEN + PRINT*,"Wrong layout found" + total_error = total_error + 1 + ENDIF + + ! + ! Find number of mappings. + + CALL H5Pget_virtual_count_f(dcpl, num_map, error) + CALL check("H5Pget_virtual_count_f", error, total_error) + + IF(num_map.NE.4_size_t)THEN + PRINT*,"Number of mappings is incorrect" + total_error = total_error + 1 + ENDIF + ! + ! Get mapping parameters for each mapping. + ! + DO i = 1, num_map + CALL H5Pget_virtual_vspace_f(dcpl, INT(i-1,size_t), vspace, error) + CALL check("H5Pget_virtual_vspace_f", error, total_error) + + CALL h5sget_select_type_f(vspace, s_type, error) + CALL check("h5sget_select_type_f", error, total_error) + IF(s_type.EQ.H5S_SEL_HYPERSLABS_F)THEN + CALL H5Sis_regular_hyperslab_f(vspace, IsRegular, error) + CALL check("H5Sis_regular_hyperslab_f", error, total_error) + + IF(IsRegular)THEN + CALL H5Sget_regular_hyperslab_f(vspace, start_out, stride_out, count_out, block_out, error) + CALL check("H5Sget_regular_hyperslab_f", error, total_error) + DO j = 1, 3 + IF(start_out(j).NE.start_correct(j,i) .OR. & + stride_out(j).NE.stride(j).OR. & + count_out(j).NE.src_count(j))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + ENDIF + END IF + + ! Get source file name + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_EXACT, error, nsize) + CALL check("H5Pget_virtual_count_f", error, total_error) + + IF(nsize.NE.LEN(SRC_FILE_LEN_EXACT))THEN + PRINT*,"virtual filenname size is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that is very small + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_TINY, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_TINY.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_TINY)))THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that small by one + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_SMALL, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_SMALL.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_SMALL)))THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that is exact + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_EXACT, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_EXACT.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)))THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that bigger by one + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_LARGE, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_LARGE(1:LEN(SRC_FILE_LEN_EXACT)).NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)).AND. & + SRC_FILE_LEN_LARGE(LEN(SRC_FILE_LEN_EXACT):).NE.'')THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that is very big + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_HUGE, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_HUGE(1:LEN(SRC_FILE_LEN_EXACT)).NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)).AND. & + SRC_FILE_LEN_HUGE(LEN(SRC_FILE_LEN_EXACT):).NE.'')THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! Get source dataset name + CALL H5Pget_virtual_dsetname_f(dcpl, INT(i-1, size_t), SRC_DATASET_LEN_EXACT, error, nsize) + CALL check("H5Pget_virtual_dsetname_f", error, total_error) + + CALL H5Pget_virtual_dsetname_f(dcpl, INT(i-1, size_t), SRC_DATASET_LEN_EXACT, error) + CALL check("H5Pget_virtual_dsetname_f", error, total_error) + IF(SRC_DATASET_LEN_EXACT(1:LEN(SRC_DATASET_LEN_EXACT)).NE.SRC_DATASET(i)(1:LEN(SRC_DATASET_LEN_EXACT)).AND. & + SRC_DATASET_LEN_EXACT(LEN(SRC_DATASET_LEN_EXACT):).NE.'')THEN + PRINT*,"virtual dataset returned is incorrect" + total_error = total_error + 1 + ENDIF + + CALL h5pget_virtual_srcspace_f(dcpl, INT(i-1,size_t), space_out, error) + CALL check("H5Pget_virtual_srcspace_f", error, total_error) + + CALL h5sget_select_type_f(space_out, type1, error) + CALL check("H5Sget_select_type_f", error, total_error) + CALL h5sget_select_type_f(vspace, type2, error) + CALL check("H5Sget_select_type_f", error, total_error) + + IF(type1.NE.type2)THEN + total_error = total_error + 1 + ENDIF + + ENDDO + ! + ! Close and release resources. + + ! Clear virtual layout in DCPL + CALL h5pset_layout_f(dcpl, H5D_VIRTUAL_F,error) + CALL check("H5Pset_layout_f", error, total_error) + + CALL H5Pclose_f(dcpl, error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + + ! Reopen VDS with printf gap set to 1 + + CALL H5Pset_virtual_printf_gap_f(dapl, 1_hsize_t, error) + CALL check("H5Pset_virtual_printf_gap_f", error, total_error) + + CALL H5Dopen_f(vfile, DATASET, vdset, error, dapl) + CALL check("H5Dopen_f", error, total_error) + + CALL H5Pget_virtual_printf_gap_f(dapl, gap_size, error) + CALL check("H5Pget_virtual_printf_gap_f", error, total_error) + + IF(gap_size.NE.1_hsize_t)THEN + PRINT*,"gapsize is incorrect" + total_error = total_error + 1 + ENDIF + + CALL H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Sclose_f(vspace, error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Pclose_f(dapl, error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Fclose_f(vfile, error) + CALL check("H5Fclose_f", error, total_error) + +END SUBROUTINE test_vds + + END MODULE TH5P_F03 -- cgit v0.12