From 4a15b32a42f3f22773290e04f898d212e572dae0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 1 Dec 2017 13:36:23 -0600 Subject: H5detect and H5make_libsettings need include folder --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b163b8a..ab06ce8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -849,6 +849,9 @@ endif () #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) TARGET_C_PROPERTIES (H5detect STATIC " " " ") +if (H5_HAVE_PARALLEL AND MPI_C_FOUND) + target_include_directories (H5detect PUBLIC ${MPI_C_INCLUDE_DIRS}) +endif () if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif () @@ -863,6 +866,9 @@ add_custom_command ( add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") +if (H5_HAVE_PARALLEL AND MPI_C_FOUND) + target_include_directories (H5make_libsettings PUBLIC ${MPI_C_INCLUDE_DIRS}) +endif () if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif () -- cgit v0.12 From 9deb5267ca482050288d993bd67d1ec3064cdfb1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 4 Dec 2017 13:05:53 -0600 Subject: Changed reference from dl to CMake variable --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab06ce8..1d217c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -891,7 +891,7 @@ add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HE TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIB_TARGET} PUBLIC dl) + target_link_libraries (${HDF5_LIB_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () if (H5_HAVE_PARALLEL AND MPI_C_FOUND) target_include_directories (${HDF5_LIB_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) @@ -935,7 +935,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC dl) + target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () if (H5_HAVE_PARALLEL AND MPI_C_FOUND) target_include_directories (${HDF5_LIBSH_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) -- cgit v0.12 From 95e96246a67593776da863c88837c6cb0b7d0058 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 11 Dec 2017 14:44:30 -0600 Subject: HDFFV-9724 Initial changes and test --- src/H5Dint.c | 101 +++++++++++++++ src/H5Dpkg.h | 3 +- src/H5Dprivate.h | 11 +- src/H5Dvirtual.c | 65 ++++++++-- src/H5Fprivate.h | 1 + src/H5Pdapl.c | 366 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Pfapl.c | 69 +++++++++++ src/H5Ppublic.h | 4 + test/vds.c | 274 +++++++++++++++++++++++++++++++++++++++++ 9 files changed, 879 insertions(+), 15 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index b6c0341..2123836 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -63,6 +63,8 @@ static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix); +static herr_t H5D_build_vds_prefix(const H5D_t *dset, hid_t dapl_id, + char **vds_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); @@ -1037,6 +1039,81 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D_build_extfile_prefix() */ + +/*-------------------------------------------------------------------------- + * Function: H5D_build_vds_prefix + * + * Purpose: Determine the vds file prefix to be used and store + * it in vds_prefix. Stores an empty string if no prefix + * should be used. + * + * Return: SUCCEED/FAIL + *-------------------------------------------------------------------------- + */ +static herr_t +H5D_build_vds_prefix(const H5D_t *dset, hid_t dapl_id, char **vds_prefix /*out*/) +{ + char *prefix = NULL; /* prefix used to look for the file */ + char *vdspath = NULL; /* absolute path of directory the HDF5 file is in */ + size_t vdspath_len; /* length of vdstpath */ + size_t prefix_len; /* length of prefix */ + size_t vds_prefix_len; /* length of expanded prefix */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(dset); + HDassert(dset->oloc.file); + + vdspath = H5F_EXTPATH(dset->oloc.file); + HDassert(vdspath); + + /* XXX: Future thread-safety note - getenv is not required + * to be reentrant. + */ + prefix = HDgetenv("HDF5_VDS_PREFIX"); + + if(prefix == NULL || *prefix == '\0') { + /* Set prefix to value of H5D_ACS_VDS_PREFIX_NAME property */ + if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + if(H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds prefix") + } /* end if */ + + /* Prefix has to be checked for NULL / empty string again because the + * code above might have updated it. + */ + if(prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) { + /* filename is interpreted as relative to the current directory, + * does not need to be expanded + */ + if(NULL == (*vds_prefix = (char *)H5MM_strdup(""))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end if */ + else { + if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { + /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ + vdspath_len = HDstrlen(vdspath); + prefix_len = HDstrlen(prefix); + vds_prefix_len = vdspath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; + + if(NULL == (*vds_prefix = (char *)H5MM_malloc(vds_prefix_len))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") + HDsnprintf(*vds_prefix, vds_prefix_len, "%s%s", vdspath, prefix + HDstrlen("${ORIGIN}")); + } /* end if */ + else { + if(NULL == (*vds_prefix = (char *)H5MM_strdup(prefix))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end else */ + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_build_vds_prefix() */ + /*------------------------------------------------------------------------- * Function: H5D__create @@ -1220,6 +1297,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Set the vds file prefix */ + if(H5D_build_vds_prefix(new_dset, dapl_id, &new_dset->shared->vds_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") + /* Add the dataset to the list of opened objects in the file */ if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") @@ -1265,6 +1346,7 @@ done: if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); + new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; @@ -1351,6 +1433,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; char *extfile_prefix = NULL; /* Expanded external file prefix */ + char *vds_prefix = NULL; /* Expanded vds prefix */ H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1374,6 +1457,10 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Get the vds prefix */ + if(H5D_build_vds_prefix(dataset, dapl_id, &vds_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") + /* Check if dataset was already open */ if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ @@ -1399,6 +1486,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* Prevent string from being freed during done: */ extfile_prefix = NULL; + /* Set the vds file prefix */ + dataset->shared->vds_prefix = vds_prefix; + /* Prevent string from being freed during done: */ + vds_prefix = NULL; + } /* end if */ else { /* Point to shared info */ @@ -1430,12 +1522,14 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) done: extfile_prefix = (char *)H5MM_xfree(extfile_prefix); + vds_prefix = (char *)H5MM_xfree(vds_prefix); if(ret_value == NULL) { /* Free the location--casting away const*/ if(dataset) { if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); + dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); } @@ -1818,6 +1912,9 @@ H5D_close(H5D_t *dataset) /* Free the external file prefix */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); + /* Free the vds file prefix */ + dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); + /* Release layout, fill-value, efl & pipeline messages */ if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || @@ -3360,6 +3457,10 @@ H5D_get_access_plist(H5D_t *dset) if(H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap") + /* Set the vds prefix option */ + if(H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds prefix") + /* Set the external file prefix option */ if(H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 542abd0..45f2d3a 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -476,6 +476,7 @@ typedef struct H5D_shared_t { H5D_append_flush_t append_flush; /* Append flush property information */ char *extfile_prefix; /* expanded external file prefix */ + char *vds_prefix; /* expanded vds prefix */ } H5D_shared_t; struct H5D_t { @@ -598,7 +599,7 @@ H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id); H5_DLL herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id); /* Internal I/O routines */ -H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, +H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf); H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index fb994d8..ed13467 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -47,12 +47,13 @@ #define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */ /* ======== Dataset access property names ======== */ -#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ -#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ -#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ -#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ +#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ +#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ #define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */ -#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */ +#define H5D_ACS_VDS_PREFIX_NAME "vds_prefix" /* VDS file prefix */ +#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */ #define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */ /* ======== Data transfer properties ======== */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 3be2353..e0a4a83 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -731,6 +731,38 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_delete */ + +/*-------------------------------------------------------------------------- + * Function: H5D__virtual_build_name + * + * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME + * + * Return: Non-negative on success/Negative on failure + *--------------------------------------------------------------------------*/ +static herr_t +H5D__virtual_build_name(char *prefix, char *file_name, char **full_name/*out*/) +{ + size_t prefix_len; /* length of prefix */ + size_t fname_len; /* Length of external link file name */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + prefix_len = HDstrlen(prefix); + fname_len = HDstrlen(file_name); + + /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") + + /* Compose the full file name */ + HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, + (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__virtual_build_name() */ + /*------------------------------------------------------------------------- * Function: H5D__virtual_open_source_dset @@ -750,9 +782,11 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_srcdset_t *source_dset, hid_t dxpl_id) { H5F_t *src_file = NULL; /* Source file */ + char *vds_prefix = NULL; /* Source file vds_prefix */ hbool_t src_file_open = FALSE; /* Whether we have opened and need to close src_file */ H5G_loc_t src_root_loc; /* Object location of source file root group */ herr_t ret_value = SUCCEED; /* Return value */ + char *full_name = NULL; /* File name with prefix */ FUNC_ENTER_STATIC @@ -762,14 +796,27 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, HDassert(!source_dset->dset); HDassert(source_dset->file_name); HDassert(source_dset->dset_name); + vds_prefix = vdset->shared->vds_prefix; /* Check if we need to open the source file */ if(HDstrcmp(source_dset->file_name, ".")) { - /* Open the source file */ - if(NULL == (src_file = H5F_open(source_dset->file_name, H5F_INTENT(vdset->oloc.file) & (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ), H5P_FILE_CREATE_DEFAULT, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) - H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ - else - src_file_open = TRUE; + if(vds_prefix && HDstrlen(vds_prefix) > 0) { + if(H5D__virtual_build_name(vds_prefix, source_dset->file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") + /* Open the source file */ + if(NULL == (src_file = H5F_open(full_name, H5F_INTENT(vdset->oloc.file) & (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ), H5P_FILE_CREATE_DEFAULT, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) + H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ + else + src_file_open = TRUE; + full_name = (char *)H5MM_xfree(full_name); + } + else { + /* Open the source file */ + if(NULL == (src_file = H5F_open(source_dset->file_name, H5F_INTENT(vdset->oloc.file) & (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ), H5P_FILE_CREATE_DEFAULT, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) + H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ + else + src_file_open = TRUE; + } } /* end if */ else /* Source file is ".", use the virtual dataset's file */ @@ -1407,7 +1454,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") } /* end if */ - /* Update cached values unlim_extent_source and + /* Update cached values unlim_extent_source and * clip_size_virtual */ storage->list[i].unlim_extent_source = curr_dims[storage->list[i].unlim_dim_source]; storage->list[i].clip_size_virtual = clip_size; @@ -1559,7 +1606,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space") /* Mark the space as dirty, for later writing to the file */ - if(H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) + if(H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") } /* end if */ @@ -2246,7 +2293,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space") storage->list[i].sub_dset[j].projected_mem_space = NULL; } /* end if */ - else + else *tot_nelmts += (hsize_t)select_nelmts; } /* end if */ } /* end for */ @@ -2506,7 +2553,7 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection") /* Write fill values to memory buffer */ - if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, + if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, type_info->mem_type, fill_space, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed") diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 18d0460..262e63b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -489,6 +489,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ #define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ +#define H5F_ACS_VDS_SIZE_NAME "vds_size" /* Size of vds file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ #define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 494de3e..da06297 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -71,6 +71,17 @@ #define H5D_ACS_VDS_PRINTF_GAP_DEF (hsize_t)0 #define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t #define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t +/* Definitions for VDS file prefix */ +#define H5D_ACS_VDS_PREFIX_SIZE sizeof(char *) +#define H5D_ACS_VDS_PREFIX_DEF NULL /*default is no prefix */ +#define H5D_ACS_VDS_PREFIX_SET H5P__dapl_vds_file_pref_set +#define H5D_ACS_VDS_PREFIX_GET H5P__dapl_vds_file_pref_get +#define H5D_ACS_VDS_PREFIX_ENC H5P__dapl_vds_file_pref_enc +#define H5D_ACS_VDS_PREFIX_DEC H5P__dapl_vds_file_pref_dec +#define H5D_ACS_VDS_PREFIX_DEL H5P__dapl_vds_file_pref_del +#define H5D_ACS_VDS_PREFIX_COPY H5P__dapl_vds_file_pref_copy +#define H5D_ACS_VDS_PREFIX_CMP H5P__dapl_vds_file_pref_cmp +#define H5D_ACS_VDS_PREFIX_CLOSE H5P__dapl_vds_file_pref_close /* Definition for append flush */ #define H5D_ACS_APPEND_FLUSH_SIZE sizeof(H5D_append_flush_t) #define H5D_ACS_APPEND_FLUSH_DEF {0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},NULL,NULL} @@ -112,6 +123,14 @@ static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /* Property list callbacks */ static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); +static herr_t H5P__dapl_vds_file_pref_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_vds_file_pref_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__dapl_vds_file_pref_dec(const void **_pp, void *value); +static herr_t H5P__dapl_vds_file_pref_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_vds_file_pref_copy(const char* name, size_t size, void* value); +static int H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__dapl_vds_file_pref_close(const char* name, size_t size, void* value); /* Property list callbacks */ static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); @@ -160,6 +179,7 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /* Property value defaults */ static const H5D_append_flush_t H5D_def_append_flush_g = H5D_ACS_APPEND_FLUSH_DEF; /* Default setting for append flush */ static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ +static const char *H5D_def_vds_prefix_g = H5D_ACS_VDS_PREFIX_DEF; /* Default vds prefix string */ /*------------------------------------------------------------------------- @@ -210,6 +230,12 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register property for vds prefix */ + if(H5P_register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, + NULL, H5D_ACS_VDS_PREFIX_SET, H5D_ACS_VDS_PREFIX_GET, H5D_ACS_VDS_PREFIX_ENC, H5D_ACS_VDS_PREFIX_DEC, + H5D_ACS_VDS_PREFIX_DEL, H5D_ACS_VDS_PREFIX_COPY, H5D_ACS_VDS_PREFIX_CMP, H5D_ACS_VDS_PREFIX_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register info for append flush */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, @@ -226,6 +252,254 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dacc_reg_prop() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_set + * + * Purpose: Copies a vds file prefix property when it's set + * for a property list + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_get + * + * Purpose: Copies a vds file prefix property when it's retrieved + * from a property list + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_enc + * + * Purpose: Callback routine which is called whenever the vds file flags + * property in the dataset access property list is + * encoded. + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) +{ + const char *vds_file_pref = *(const char * const *)value; + uint8_t **pp = (uint8_t **)_pp; + size_t len = 0; + uint64_t enc_value; + unsigned enc_size; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* calculate prefix length */ + if(NULL != vds_file_pref) + len = HDstrlen(vds_file_pref); + + enc_value = (uint64_t)len; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* encode the length of the prefix */ + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode the prefix */ + if(NULL != vds_file_pref) { + HDmemcpy(*(char **)pp, vds_file_pref, len); + *pp += len; + } /* end if */ + } /* end if */ + + *size += (1 + enc_size); + if(NULL != vds_file_pref) + *size += len; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_dec + * + * Purpose: Callback routine which is called whenever the vds file prefix + * property in the dataset access property list is + * decoded. + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) +{ + char **vds_file_pref = (char **)_value; + const uint8_t **pp = (const uint8_t **)_pp; + size_t len; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(pp); + HDassert(*pp); + HDassert(vds_file_pref); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + len = (size_t)enc_value; + + if(0 != len) { + /* Make a copy of the user's prefix string */ + if(NULL == (*vds_file_pref = (char *)H5MM_malloc(len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HDstrncpy(*vds_file_pref, *(const char **)pp, len); + (*vds_file_pref)[len] = '\0'; + + *pp += len; + } /* end if */ + else + *vds_file_pref = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_vds_file_pref_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_del + * + * Purpose: Frees memory used to store the vds file prefix string + * + * Return: SUCCEED (Can't fail) + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_copy + * + * Purpose: Creates a copy of the vds file prefix string + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_cmp + * + * Purpose: Callback routine which is called whenever the vds file prefix + * property in the dataset creation property list is + * compared. + * + * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. + *------------------------------------------------------------------------- + */ +static int +H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +{ + const char *pref1 = *(const char * const *)value1; + const char *pref2 = *(const char * const *)value2; + int ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(NULL == pref1 && NULL != pref2) + HGOTO_DONE(1); + if(NULL != pref1 && NULL == pref2) + HGOTO_DONE(-1); + if(NULL != pref1 && NULL != pref2) + ret_value = HDstrcmp(pref1, pref2); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_vds_file_pref_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_close + * + * Purpose: Frees memory used to store the vds file prefix string + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_close() */ + /*------------------------------------------------------------------------- * Function: H5P__dapl_efile_pref_set @@ -1220,3 +1494,95 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_efile_prefix() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_virtual_prefix + * + * Purpose: Set a prefix to be applied to the path of any vds files + * traversed. + * + * If the prefix starts with ${ORIGIN}, this will be replaced by + * the absolute path of the directory of the HDF5 file containing + * the dataset. + * + * If the prefix is ".", no prefix will be applied. + * + * This property can be overwritten by the environment variable + * HDF5_VDS_PREFIX. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_virtual_prefix(hid_t plist_id, const char *prefix) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*s", plist_id, prefix); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set prefix */ + if(H5P_set(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_virtual_prefix() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_virtual_prefix + * + * Purpose: Gets the prefix to be applied to any vds file + * traversals made using this property list. + * + * If the pointer is not NULL, it points to a user-allocated + * buffer. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +ssize_t +H5Pget_virtual_prefix(hid_t plist_id, char *prefix, size_t size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + char *my_prefix; /* Library's copy of the prefix */ + size_t len; /* Length of prefix string */ + ssize_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("Zs", "i*sz", plist_id, prefix, size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Get the current prefix */ + if(H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &my_prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file prefix") + + /* Check for prefix being set */ + if(my_prefix) { + /* Copy to user's buffer, if given */ + len = HDstrlen(my_prefix); + if(prefix) { + HDstrncpy(prefix, my_prefix, MIN(len + 1, size)); + if(len >= size) + prefix[size - 1] = '\0'; + } /* end if */ + } /* end if */ + else + len = 0; + + /* Set return value */ + ret_value = (ssize_t)len; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_virtual_prefix() */ + diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 915aa38..8650a03 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2462,6 +2462,75 @@ done: /*------------------------------------------------------------------------- + * Function: H5Pset_vds_file_cache_size + * + * Purpose: Sets the number of files opened through vds links + * from the file associated with this fapl to be held open + * in that file's vds file cache. When the maximum + * number of files is reached, the least recently used file + * is closed (unless it is opened from somewhere else). + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "iIu", plist_id, vds_size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set value */ + if(H5P_set(plist, H5F_ACS_VDS_SIZE_NAME, &vds_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set elink file cache size") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_vds_file_cache_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_vds_file_cache_size + * + * Purpose: Gets the number of files opened through vds links + * from the file associated with this fapl to be held open + * in that file's vds file cache. When the maximum + * number of files is reached, the least recently used file + * is closed (unless it is opened from somewhere else). + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Iu", plist_id, vds_size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Get value */ + if(vds_size) + if(H5P_get(plist, H5F_ACS_VDS_SIZE_NAME, vds_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file cache size") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vds_file_cache_size() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_file_image * * Purpose: Sets the initial file image. Some file drivers can initialize diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 493a322..38be320 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -343,6 +343,8 @@ H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high); H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size); H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size); +H5_DLL herr_t H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size); +H5_DLL herr_t H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size); H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, @@ -420,6 +422,8 @@ H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view); H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view); H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size); H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size); +H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); +H5_DLL ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); H5_DLL herr_t H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t boundary[], H5D_append_cb_t func, void *udata); H5_DLL herr_t H5Pget_append_flush(hid_t plist_id, unsigned dims, diff --git a/test/vds.c b/test/vds.c index c9b7a1b..3485023 100644 --- a/test/vds.c +++ b/test/vds.c @@ -36,6 +36,12 @@ const char *FILENAME[] = { "vds_src_1", "vds%%_src", "vds_dapl", + "vds_virt_2", + "vds_virt_3", + "vds_src_2", + "vds_src_3", + "vds%%_src2", + "vds_dapl2", NULL }; @@ -49,6 +55,8 @@ const char *FILENAME[] = { #define FILENAME_BUF_SIZE 1024 +#define TMPDIR "tmp/" + /*------------------------------------------------------------------------- * Function: vds_select_equal @@ -1140,6 +1148,271 @@ error: return 1; } /* end test_api() */ +/*------------------------------------------------------------------------- + * Function: vds_link_prefix + * + * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp" + * Should be able to access the target source files in tmp directory via the prefix set + * by H5Pset_virtual_prefix() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +test_vds_prefix(unsigned config, hid_t fapl) +{ + char srcfilename[FILENAME_BUF_SIZE]; + char srcfilename_map[FILENAME_BUF_SIZE]; + char vfilename[FILENAME_BUF_SIZE]; + char vfilename2[FILENAME_BUF_SIZE]; + char srcfilenamepct[FILENAME_BUF_SIZE]; + char srcfilenamepct_map[FILENAME_BUF_SIZE]; + const char *srcfilenamepct_map_orig = "vds%%%%_src"; + hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t vfile2 = -1; /* File with copied virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t dapl = -1; /* Dataset access property list */ + hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ + hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ + hsize_t start[4]; /* Hyperslab start */ + hsize_t stride[4]; /* Hyperslab stride */ + hsize_t count[4]; /* Hyperslab count */ + hsize_t block[4]; /* Hyperslab block */ + hssize_t offset[2] = {0, 0}; /* Selection offset */ + int buf[10][26]; /* Write and expected read buffer */ + int rbuf[10][26]; /* Read buffer */ + int rbuf99[9][9]; /* 9x9 Read buffer */ + int evbuf[10][26]; /* Expected VDS "buffer" */ + int erbuf[10][26]; /* Expected read buffer */ + int fill = -1; /* Fill value */ + herr_t ret; /* Generic return value */ + int i, j; + char buffer[1024]; /* buffer to read vds_prefix */ + + TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()") + + h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); + h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2); + h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename); + h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map); + h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + + /* create tmp directory and get current working directory path */ + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + + /* Create DCPL */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + /* Set fill value */ + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + TEST_ERROR + + /* Initialize VDS prefix items */ + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + TEST_ERROR + + if(H5Pset_virtual_prefix(dapl, TMPDIR) < 0) + TEST_ERROR + if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) + TEST_ERROR + + if(HDstrcmp(buffer, TMPDIR) != 0) + FAIL_PUTS_ERROR("vds prefix not set correctly"); + + /* + * Test 1: All - all selection + */ + /* Create source dataspace */ + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspace */ + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all (should not be necessary, but just to be sure) */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + if(H5Sselect_all(vspace[0]) < 0) + TEST_ERROR + + /* Add virtual layout mapping */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) + TEST_ERROR + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } /* end if */ + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } /* end if */ + + /* Create source dataset */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + TEST_ERROR + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Write data directly to source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Close srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + + if(config & TEST_IO_DIFFERENT_FILE) { + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } /* end if */ + } /* end if */ + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + TEST_ERROR + } /* end if */ + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) { + TEST_ERROR + } + } + + /* Adjust write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); + + /* Write data through virtual dataset */ + if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Reopen srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } /* end if */ + + /* Read data directly from source dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) + TEST_ERROR + + /* Close */ + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { + if(srcdset[i] >= 0) + (void)H5Dclose(srcdset[i]); + } /* end for */ + if(vdset >= 0) + (void)H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { + if(srcfile[i] >= 0) + (void)H5Fclose(srcfile[i]); + } /* end for */ + if(vfile >= 0) + (void)H5Fclose(vfile); + if(vfile2 >= 0) + (void)H5Fclose(vfile2); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if(srcspace[i] >= 0) + (void)H5Sclose(srcspace[i]); + } /* end for */ + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(memspace >= 0) + (void)H5Sclose(memspace); + if(dcpl >= 0) + (void)H5Pclose(dcpl); + } H5E_END_TRY; + + return 1; +} /* end vds_link_prefix() */ + /*------------------------------------------------------------------------- * Function: test_basic_io @@ -11299,6 +11572,7 @@ main(void) for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, fapl); + nerrors += test_vds_prefix(bit_config, fapl); nerrors += test_unlim(bit_config, fapl); nerrors += test_printf(bit_config, fapl); nerrors += test_all(bit_config, fapl); -- cgit v0.12 From 690cb84f10da7d72fcf87b07d346a26e6fefd1d0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 12 Dec 2017 13:10:46 -0600 Subject: Added java wrappers and tests --- java/src/hdf/hdf5lib/H5.java | 196 ++++++- java/src/hdf/hdf5lib/HDF5Constants.java | 3 + java/src/hdf/overview.html | 6 +- java/src/jni/h5Constants.c | 2 + java/src/jni/h5pImp.c | 246 ++++++++ java/src/jni/h5pImp.h | 91 ++- java/test/JUnit-interface.txt | 10 +- java/test/TestH5P.java | 53 +- java/test/TestH5Pfapl.java | 41 ++ java/test/TestH5Pvirtual.java | 33 ++ release_docs/RELEASE.txt | 32 +- src/H5Pfapl.c | 954 ++++++++++++++++---------------- 12 files changed, 1172 insertions(+), 495 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 7b5b5c9..3de49da 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -4451,7 +4451,7 @@ public class H5 implements java.io.Serializable { // // // //////////////////////////////////////////////////////////// - // Generic property list routines + // /////// Generic property list routines /////// /** * H5Pget_class_name retrieves the name of a generic property list class @@ -4767,7 +4767,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, H5P_iterate_t op_data) throws HDF5LibraryException; - // Object creation property list (OCPL) routines + // /////// Object creation property list (OCPL) routines /////// /** * H5Pget_attr_phase_change retrieves attribute storage phase change thresholds. @@ -5071,7 +5071,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException, NullPointerException; - // File creation property list (FCPL) routines + // /////// File creation property list (FCPL) routines /////// /** * H5Pget_userblock retrieves the size of a user block in a file creation property list. @@ -5480,7 +5480,7 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, IllegalArgumentException; - // File access property list (FAPL) routines + // /////// File access property list (FAPL) routines /////// /** * H5Pget_alignment retrieves the current settings for alignment properties from a file access property list. @@ -5860,6 +5860,37 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_metadata_read_attempts(long plist_id, long attempts) throws HDF5LibraryException; + /** + * H5Pget_evict_on_close retrieves the file access property list setting that determines whether an HDF5 object + * will be evicted from the library's metadata cache when it is closed. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return indication if the object will be evicted on close. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_evict_on_close(long fapl_id) + throws HDF5LibraryException; + + /** + * H5Pset_evict_on_close controls the library's behavior of evicting metadata associated with a closed object. + * + * @param fapl_id + * IN: File access property list identifier + * @param evict_on_close + * IN: Whether the HDF5 object should be evicted on close. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close) + throws HDF5LibraryException; + // Dataset creation property list (DCPL) routines // /** @@ -6067,6 +6098,35 @@ public class H5 implements java.io.Serializable { public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; /** + * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return VDS link open file cache size in number of files. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException; + + /** + * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache. + * + * @param fapl_id + * IN: File access property list identifier + * @param efc_size + * IN: VDS link open file cache size in number of files. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size) + throws HDF5LibraryException; + + /** * H5Pget_external returns information about an external file. * * @param plist @@ -6285,7 +6345,37 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException, NullPointerException; - // Dataset access property list (DAPL) routines // + // /////// Dataset creation property list (DCPL) routines /////// + + /** + * H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list. + * + * @param dcpl_id + * IN: Dataset creation property list identifier + * @param opts + * IN: Edge chunk option flag. Valid values are: + * H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS - filters are not applied to partial edge chunks. + * 0 - Disables option; partial edge chunks will be compressed. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native void H5Pset_chunk_opts(long dcpl_id, int opts) throws HDF5LibraryException; + + /** + * H5Pget_chunk_opts retrieves the edge chunk option setting stored in the dataset creation property list . + * + * @param dcpl_id + * IN: Dataset creation property list + + * @return The edge chunk option setting. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException; + + // /////// Dataset access property list (DAPL) routines /////// /** * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes @@ -6388,12 +6478,76 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException; + /** + * H5Pget_virtual_prefix Retrieves prefix applied to virtual file paths. + * + * @param dapl_id + * IN: Link access property list identifier + * + * @return the prefix to be applied to virtual file paths. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native String H5Pget_virtual_prefix(long dapl_id) + throws HDF5LibraryException; + + /** + * H5Pset_virtual_prefix Sets prefix to be applied to virtual file paths. + * + * @param dapl_id + * IN: Dataset access property list identifier + * @param prefix + * IN: Prefix to be applied to virtual file paths + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native void H5Pset_virtual_prefix(long dapl_id, String prefix) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_efile_prefix Retrieves prefix applied to external file paths. + * + * @param dapl_id + * IN: Link access property list identifier + * + * @return the prefix to be applied to external file paths. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native String H5Pget_efile_prefix(long dapl_id) + throws HDF5LibraryException; + + /** + * H5Pset_efile_prefix Sets prefix to be applied to external file paths. + * + * @param dapl_id + * IN: Dataset access property list identifier + * @param prefix + * IN: Prefix to be applied to external file paths + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native void H5Pset_efile_prefix(long dapl_id, String prefix) + throws HDF5LibraryException, NullPointerException; + // public synchronized static native void H5Pset_append_flush(long plist_id, int ndims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; // public synchronized static native void H5Pget_append_flush(long plist_id, int dims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; - // Dataset xfer property list (DXPL) routines // + // /////// Dataset xfer property list (DXPL) routines /////// /** * H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property @@ -6544,7 +6698,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size) throws HDF5LibraryException, NullPointerException; - // Link creation property list (LCPL) routines // + // /////// Link creation property list (LCPL) routines /////// /** * H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate @@ -6579,7 +6733,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group) throws HDF5LibraryException; - // Group creation property list (GCPL) routines // + // /////// Group creation property list (GCPL) routines /////// /** * H5Pget_local_heap_size_hint Retrieves the anticipated size of the local heap for original-style groups. @@ -6736,14 +6890,14 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags) throws HDF5LibraryException; - // String creation property list (STRCPL) routines // + // /////// String creation property list (STRCPL) routines /////// public synchronized static native int H5Pget_char_encoding(long plist_id) throws HDF5LibraryException; public synchronized static native void H5Pset_char_encoding(long plist_id, int encoding) throws HDF5LibraryException; - // Link access property list (LAPL) routines // + // /////// Link access property list (LAPL) routines /////// /** * H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the @@ -6896,7 +7050,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException, IllegalArgumentException; - // Object copy property list (OCPYPL) routines // + // /////// Object copy property list (OCPYPL) routines /////// /** * H5Pget_copy_object retrieves the properties to be used when an object is copied. @@ -6927,7 +7081,7 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options) throws HDF5LibraryException; - // Other/Older property list routines // + // /////// Other/Older property list routines /////// /** * H5Pget_version retrieves the version information of various objects for a file creation property list. @@ -6955,7 +7109,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; - // file drivers property list routines // + // /////// file drivers property list routines /////// public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store) throws HDF5LibraryException, NullPointerException; @@ -7102,20 +7256,28 @@ public class H5 implements java.io.Serializable { // File creation property list (FCPL) routines // // File access property list (FAPL) routines // - // herr_t H5Pset_driver( hid_t plist_id, hid_t new_driver_id, const void *new_driver_info ) - // const void *H5Pget_driver_info( hid_t plist_id ) - // herr_t H5Pget_multi_type ( hid_t fapl_id, H5FD_mem_t *type ) - // herr_t H5Pset_multi_type ( hid_t fapl_id, H5FD_mem_t type ) + // herr_t H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info) + // const void *H5Pget_driver_info(hid_t plist_id) + // herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type) + // herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) // herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); // herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); // herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); // herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); // herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); // herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); + // herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective); + // herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective); + // herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective); + // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc); + // herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data); + // herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data); // Dataset creation property list (DCPL) routines // // Dataset access property list (DAPL) routines // + // herr_t H5Pset_append_flush (hid_t dapl_id, int ndims, const hsize_t boundary[], H5D_append_cb_t func, void *user_data); + // herr_t H5Pget_append_flush(hid_t dapl_id, int ndims, hsize_t boundary[], H5D_append_cb_t *func, void **user_data) // Dataset xfer property list (DXPL) routines // // herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 8a3d6c8..3e43ba2 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -88,6 +88,7 @@ public class HDF5Constants { public static final int H5D_VDS_ERROR = H5D_VDS_ERROR(); public static final int H5D_VDS_FIRST_MISSING = H5D_VDS_FIRST_MISSING(); public static final int H5D_VDS_LAST_AVAILABLE = H5D_VDS_LAST_AVAILABLE(); + public static final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS = H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS(); public static final int H5E_MAJOR = H5E_MAJOR(); public static final int H5E_MINOR = H5E_MINOR(); @@ -768,6 +769,8 @@ public class HDF5Constants { private static native final int H5D_VDS_LAST_AVAILABLE(); + private static native final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS(); + private static native final long H5E_ALIGNMENT(); private static native final long H5E_ALREADYEXISTS(); diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index 39d75b7..9c19442 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -47,20 +47,20 @@ which has a method: The native method is implemented in C using the Java Native Method Interface (JNI). This is written something like the following: -
JNIEXPORT jint
+
JNIEXPORT jlong
 JNICALL Java_hdf_hdf5lib_H5_H5Fopen
 (
  JNIEnv *env,
  jclass class,
  jstring hdfFile,
  jint flags,
- jint access)
+ jlong access)
  {
 
  /* ...convert Java String to (char *) */
 
  /* call the HDF library */
- retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access );
+ retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access);
 
  /* ... */
 }
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index f6f8bfa..5a4b53e 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -140,6 +140,8 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1DONT_1FILTER_1PARTIAL_1CHUNKS(JNIEnv *env, jclass cls) { return H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; } diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index dcfcd82..3c799f2 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -5733,6 +5733,252 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts } /* end else */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_vds_file_cache_size + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size + (JNIEnv *env, jclass clss, jlong plist, jint size) +{ + unsigned sz = (unsigned)size; + + if (H5Pset_vds_file_cache_size((hid_t)plist, (unsigned)sz) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_vds_file_cache_size + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size + (JNIEnv *env, jclass clss, jlong plist) +{ + unsigned s; + + if (H5Pget_vds_file_cache_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jint)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) +{ + herr_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(prefix, aName); + if (aName != NULL) { + retVal = H5Pset_virtual_prefix((hid_t)dapl_id, aName); + + UNPIN_JAVA_STRING(prefix, aName); + + if(retVal < 0) + h5libraryError(env); + } + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id) +{ + size_t size = 0; + char *pre; + jlong prefix_size = -1; + jstring str = NULL; + + prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)NULL, size); + if(prefix_size < 0) { + h5libraryError(env); + } /* end if */ + else { + size = (size_t)prefix_size + 1;/* add extra space for the null terminator */ + pre = (char*)HDmalloc(sizeof(char)*size); + if (pre == NULL) { + h5outOfMemory(env, "H5Pget_virtual_prefix: malloc failed "); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)pre, size); + + if (prefix_size >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR pre); + HDfree(pre); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_virtual_prefix: return string not allocated"); + } /* end if */ + else { + HDfree(pre); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_efile_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) +{ + herr_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(prefix, aName); + if (aName != NULL) { + retVal = H5Pset_efile_prefix((hid_t)dapl_id, aName); + + UNPIN_JAVA_STRING(prefix, aName); + + if(retVal < 0) + h5libraryError(env); + } + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_efile_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id) +{ + size_t size = 0; + char *pre; + jlong prefix_size = -1; + jstring str = NULL; + + prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)NULL, size); + if(prefix_size < 0) { + h5libraryError(env); + } /* end if */ + else { + size = (size_t)prefix_size + 1;/* add extra space for the null terminator */ + pre = (char*)HDmalloc(sizeof(char)*size); + if (pre == NULL) { + h5outOfMemory(env, "H5Pget_efile_prefix: malloc failed "); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)pre, size); + + if (prefix_size >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR pre); + HDfree(pre); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_efile_prefix: return string not allocated"); + } /* end if */ + else { + HDfree(pre); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_evict_on_close + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close + (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close) +{ + herr_t retVal = -1; + hbool_t evict_on_close_val; + + if (evict_on_close == JNI_TRUE) + evict_on_close_val = TRUE; + else + evict_on_close_val = FALSE; + + retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val); + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_evict_on_close + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close + (JNIEnv *env, jclass clss, jlong fapl_id) +{ + hbool_t evict_on_close_val = FALSE; + jboolean bval = JNI_FALSE; + + if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0) { + h5libraryError(env); + } /* end if */ + else { + if (evict_on_close_val == TRUE) + bval = JNI_TRUE; + } /* end else */ + + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_opts + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts + (JNIEnv *env, jclass clss, jlong dcpl_id, jint opts) +{ + herr_t retVal = -1; + + retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts); + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_opts + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts + (JNIEnv *env, jclass clss, jlong dcpl_id) +{ + unsigned opts = 0; + + if (H5Pget_chunk_opts((hid_t)dcpl_id, opts) < 0) + h5libraryError(env); + + return (jint)opts; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */ + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index d413f69..19df4b2 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -1533,7 +1533,6 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts (JNIEnv *, jclass, jlong); - /* * Class: hdf_hdf5lib_H5 * Method: H5Pset_metadata_read_attempts @@ -1543,6 +1542,96 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts (JNIEnv *, jclass, jlong, jlong); +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_vds_file_cache_size + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_vds_file_cache_size + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_efile_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_efile_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_evict_on_close + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_evict_on_close + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_opts + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_opts + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts +(JNIEnv *, jclass, jlong); + #ifdef __cplusplus } /* end extern "C" */ diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt index ab2f3b1..fa5b149 100644 --- a/java/test/JUnit-interface.txt +++ b/java/test/JUnit-interface.txt @@ -415,6 +415,7 @@ JUnit version 4.11 .testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue .testH5P_layout .testH5Pget_link_creation_order +.testH5Pget_efile_prefix .testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes .testH5P_file_space_page_size .testH5Pget_shared_mesg_index_Invalid_indexnum @@ -444,6 +445,7 @@ JUnit version 4.11 .testH5Pset_est_link_info_InvalidValues .testH5Pset_local_heap_size_hint .testH5Pget_est_link_info +.testH5Pset_efile_prefix_null .testH5Pset_scaleoffset .testH5Pset_create_intermediate_group_invalidobject .testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue @@ -466,6 +468,7 @@ JUnit version 4.11 .testH5Pget_sym_k_null .testH5Pset_nlinks .testH5P_obj_track_times +.testH5Pset_efile_prefix .testH5P_userblock .testH5Pget_local_heap_size_hint .testH5Pset_shared_mesg_index_Invalid_indexnum @@ -502,8 +505,10 @@ JUnit version 4.11 .testH5Fmdc_logging .testH5Pget_elink_fapl .testH5Pset_mdc_config +.testH5P_vds_file_cache_size .testH5P_small_data_block_size .testH5Pset_fapl_log +.testH5P_evict_on_close .testH5Pset_libver_bounds .testH5P_sieve_buf_size .testH5P_elink_file_cache_size @@ -530,11 +535,14 @@ JUnit version 4.11 .testH5Pget_source_datasetname .testH5Pvirtual_storage .testH5Pget_selection_source_dataset +.testH5Pget_virtual_prefix .testH5Pget_source_filename .testH5Pset_get_virtual_printf_gap .testH5Pget_virtual_count +.testH5Pset_virtual_prefix .testH5Pset_get_virtual_view .testH5Pget_mapping_parameters +.testH5Pset_virtual_prefix_null .testH5P_genprop_basic_class .testH5P_genprop_class_iter .testH5P_genprop_basic_class_prop @@ -640,7 +648,7 @@ JUnit version 4.11 Time: XXXX -OK (638 tests) +OK (646 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 5aafb5b..9e45e4c 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -28,6 +28,7 @@ import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -852,7 +853,7 @@ public class TestH5P { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pset_est_link_info: " + err); + fail("H5Pset_elink_prefix: " + err); } assertTrue("H5Pset_elink_prefix", ret_val >= 0); } @@ -1232,4 +1233,54 @@ public class TestH5P { fail("testH5P_file_space_page_size: " + err); } } + + @Test + public void testH5Pset_efile_prefix() { + String prefix = "tmp"; + try { + H5.H5Pset_efile_prefix(lapl_id, prefix); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_efile_prefix: " + err); + } + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_efile_prefix_null() throws Throwable{ + H5.H5Pset_efile_prefix(lapl_id, null); + } + + @Test + public void testH5Pget_efile_prefix() { + String prefix = "tmp"; + String pre = ""; + + try { + H5.H5Pset_efile_prefix(lapl_id, prefix); + pre = H5.H5Pget_efile_prefix(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_efile_prefix: " + err); + } + assertTrue("The prefix: ", prefix.equals(pre)); + } + + @Ignore + public void testH5P_chunk_opts() { + int chunk_opts = -1; + + try { + chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); + assertTrue("chunk_opts: "+chunk_opts, chunk_opts == 0); + H5.H5Pset_chunk_opts(ocpl_id, HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); + chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); + assertTrue("chunk_opts: "+chunk_opts, chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_lchunk_opts: " + err); + } + } } diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index d4a2231..f6783d4 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -1376,4 +1376,45 @@ public class TestH5Pfapl { deleteH5file(); _deleteLogFile(); } + + @Test + public void testH5P_evict_on_close() { + boolean ret_val_id = false; + try { + H5.H5Pset_evict_on_close(fapl_id, true); + ret_val_id = H5.H5Pget_evict_on_close(fapl_id); + assertTrue("H5P_evict_on_close", ret_val_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_evict_on_close: " + err); + } + } + + @Test + public void testH5P_vds_file_cache_size() { + int vds_size = 0; + try { + try { + vds_size = H5.H5Pget_vds_file_cache_size(fapl_id); + assertTrue("H5P_vds_file_cache_size default", vds_size == 0); + } + catch (UnsupportedOperationException err) { + System.out.println(err.getMessage()); + } + try { + vds_size = 8; + H5.H5Pset_vds_file_cache_size(fapl_id, vds_size); + vds_size = H5.H5Pget_vds_file_cache_size(fapl_id); + assertTrue("H5P_vds_file_cache_size 8", vds_size == 8); + } + catch (UnsupportedOperationException err) { + System.out.println(err.getMessage()); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_vds_file_cache_size: " + err); + } + } } diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java index 40cfbac..ff2e4dc 100644 --- a/java/test/TestH5Pvirtual.java +++ b/java/test/TestH5Pvirtual.java @@ -429,4 +429,37 @@ public class TestH5Pvirtual { try {H5.H5Dclose(H5did);} catch (Exception ex) {} } } + + @Test + public void testH5Pset_virtual_prefix() { + String prefix = "tmp"; + try { + H5.H5Pset_virtual_prefix(H5dapl_id, prefix); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_virtual_prefix: " + err); + } + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_virtual_prefix_null() throws Throwable{ + H5.H5Pset_virtual_prefix(H5dapl_id, null); + } + + @Test + public void testH5Pget_virtual_prefix() { + String prefix = "tmp"; + String pre = ""; + + try { + H5.H5Pset_virtual_prefix(H5dapl_id, prefix); + pre = H5.H5Pget_virtual_prefix(H5dapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_virtual_prefix: " + err); + } + assertTrue("The prefix: ", prefix.equals(pre)); + } } diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7498d01..5249c1a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -58,7 +58,23 @@ New Features Library: -------- - - + - Add prefix option to VDS files. + + Currently, VDS source files must be in the active directory to be + found by the virtual file. Adding the option of a prefix to be set + on the virtual file, using a data access property list (DAPL), + allows the source files to located at an absolute or relative path + to the virtual file. + + New public APIs: + herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); + ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); + herr_t H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size); + herr_t H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size); + The prefix can also be set with an environment variable, HDF5_VDS_PREFIX. + + (ADB - 2017/12/12, HDFFV-9724) + Parallel Library: ----------------- @@ -119,6 +135,20 @@ New Features ------------ - + Java Library: + ---------------- + - Wrappers added for the following APIs: + H5Pset_evict_on_close + H5Pget_evict_on_close + H5Pset_chunk_opts + H5Pget_chunk_opts + H5Pset_efile_prefix + H5Pget_efile_prefix + H5Pset_virtual_prefix + H5Pget_virtual_prefix + H5Pset_vds_file_cache_size + H5Pget_vds_file_cache_size + Tools: ------ - h5diff diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 8650a03..586f559 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -13,9 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pfapl.c + * Created: H5Pfapl.c * - * Purpose: File access property list class routines + * Purpose: File access property list class routines * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ #include "H5Ppkg.h" /* Property lists */ /* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ +#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ #include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ @@ -54,10 +54,10 @@ /* ========= File Access properties ============ */ /* Definitions for the initial metadata cache resize configuration */ -#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) -#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG -#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc -#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec +#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG +#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec #define H5F_ACS_META_CACHE_INIT_CONFIG_CMP H5P__facc_cache_config_cmp /* Definitions for size of raw data chunk cache(slots) */ #define H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t) @@ -118,10 +118,10 @@ #define H5F_ACS_FILE_DRV_CMP H5P__facc_file_driver_cmp #define H5F_ACS_FILE_DRV_CLOSE H5P__facc_file_driver_close /* Definition for file close degree */ -#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) -#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT -#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc -#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec +#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) +#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT +#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc +#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec /* Definition for offset position in file for family file driver */ #define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t) #define H5F_ACS_FAMILY_OFFSET_DEF 0 @@ -155,6 +155,11 @@ #define H5F_ACS_EFC_SIZE_DEF 0 #define H5F_ACS_EFC_SIZE_ENC H5P__encode_unsigned #define H5F_ACS_EFC_SIZE_DEC H5P__decode_unsigned +/* Definition for vds file cache size */ +#define H5F_ACS_VDS_SIZE_SIZE sizeof(unsigned) +#define H5F_ACS_VDS_SIZE_DEF 0 +#define H5F_ACS_VDS_SIZE_ENC H5P__encode_unsigned +#define H5F_ACS_VDS_SIZE_DEC H5P__decode_unsigned /* Definition of pointer to initial file image info */ #define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t) #define H5F_ACS_FILE_IMAGE_INFO_DEF H5FD_DEFAULT_FILE_IMAGE_INFO @@ -175,12 +180,12 @@ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t /* Definition for # of metadata read attempts */ -#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned) -#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0 -#define H5F_ACS_METADATA_READ_ATTEMPTS_ENC H5P__encode_unsigned -#define H5F_ACS_METADATA_READ_ATTEMPTS_DEC H5P__decode_unsigned +#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned) +#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0 +#define H5F_ACS_METADATA_READ_ATTEMPTS_ENC H5P__encode_unsigned +#define H5F_ACS_METADATA_READ_ATTEMPTS_DEC H5P__decode_unsigned /* Definition for object flush callback */ -#define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) +#define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) #define H5F_ACS_OBJECT_FLUSH_CB_DEF {NULL, NULL} /* Definition for status_flags in the superblock */ #define H5F_ACS_CLEAR_STATUS_FLAGS_SIZE sizeof(hbool_t) @@ -309,21 +314,21 @@ static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); /* File access property list class library initialization object */ const H5P_libclass_t H5P_CLS_FACC[1] = {{ - "file access", /* Class name for debugging */ + "file access", /* Class name for debugging */ H5P_TYPE_FILE_ACCESS, /* Class type */ - &H5P_CLS_ROOT_g, /* Parent class */ - &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ - &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ - &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P__facc_reg_prop, /* 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 */ + &H5P_CLS_ROOT_g, /* Parent class */ + &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ + &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ + H5P__facc_reg_prop, /* 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 */ }}; @@ -355,6 +360,7 @@ static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */ static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */ +static const unsigned H5F_def_vds_size_g = H5F_ACS_VDS_SIZE_DEF; /* Default vds file cache size */ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ @@ -395,149 +401,155 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, - NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, - NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, - NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, - NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, + if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, + NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, - NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, + if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, - NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, + if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, - NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, + NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, - NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, + NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, - NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, + NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, - NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, + if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, + NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ - if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, - NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, + if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, + NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, - NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, + NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of new family file size. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, - NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, + if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, + NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'use the latest version of the format' flag */ - if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g, - NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC, + if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g, + NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, + if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file cache size */ - if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, - NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, + NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the vds file cache size */ + if(H5P_register_real(pclass, H5F_ACS_VDS_SIZE_NAME, H5F_ACS_VDS_SIZE_SIZE, &H5F_def_vds_size_g, + NULL, NULL, NULL, H5F_ACS_VDS_SIZE_ENC, H5F_ACS_VDS_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, + if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) 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, - NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, + 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, - NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, + 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") /* Register the # of read attempts */ - if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, - NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, + if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, + NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object flush callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, + if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -563,44 +575,44 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the evict on close flag */ - if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, - NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, + if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, + NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, - NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective write flag */ - if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, - NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, + if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ /* Register the initial metadata cache image configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, - NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum metadata size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum raw data size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -610,33 +622,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_alignment + * Function: H5Pset_alignment * - * Purpose: Sets the alignment properties of a file access property list - * so that any file object >= THRESHOLD bytes will be aligned on - * an address which is a multiple of ALIGNMENT. The addresses - * are relative to the end of the user block; the alignment is - * calculated by subtracting the user block size from the - * absolute file address and then adjusting the address to be a - * multiple of ALIGNMENT. + * Purpose: Sets the alignment properties of a file access property list + * so that any file object >= THRESHOLD bytes will be aligned on + * an address which is a multiple of ALIGNMENT. The addresses + * are relative to the end of the user block; the alignment is + * calculated by subtracting the user block size from the + * absolute file address and then adjusting the address to be a + * multiple of ALIGNMENT. * - * Default values for THRESHOLD and ALIGNMENT are one, implying - * no alignment. Generally the default values will result in - * the best performance for single-process access to the file. - * For MPI-IO and other parallel systems, choose an alignment - * which is a multiple of the disk block size. + * Default values for THRESHOLD and ALIGNMENT are one, implying + * no alignment. Generally the default values will result in + * the best performance for single-process access to the file. + * For MPI-IO and other parallel systems, choose an alignment + * which is a multiple of the disk block size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed file access property list mechanism to the new - * generic property list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed file access property list mechanism to the new + * generic property list. *------------------------------------------------------------------------- */ herr_t @@ -668,15 +680,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_alignment + * Function: H5Pget_alignment * - * Purpose: Returns the current settings for alignment properties from a - * file access property list. The THRESHOLD and/or ALIGNMENT - * pointers may be null pointers. + * Purpose: Returns the current settings for alignment properties from a + * file access property list. The THRESHOLD and/or ALIGNMENT + * pointers may be null pointers. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * *------------------------------------------------------------------------- @@ -709,20 +721,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_set_driver + * Function: H5P_set_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -757,20 +769,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_driver + * Function: H5Pset_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -800,20 +812,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_peek_driver + * Function: H5P_peek_driver * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -844,22 +856,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_driver + * Function: H5Pget_driver * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Note: The ID returned should not be closed. + * Note: The ID returned should not be closed. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -867,7 +879,7 @@ hid_t H5Pget_driver(hid_t plist_id) { H5P_genplist_t *plist; /* Property list pointer */ - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", plist_id); @@ -885,20 +897,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_peek_driver_info + * Function: H5P_peek_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -927,20 +939,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_driver_info + * Function: H5Pget_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -973,7 +985,7 @@ done: * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. + * finishes the "deep" part of the copy. * * Return: Success: Non-negative * Failure: Negative @@ -1486,30 +1498,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_cache + * Function: H5Pset_cache * - * Purpose: Set the number of objects in the meta data cache and the - * maximum number of chunks and bytes in the raw data chunk - * cache. + * Purpose: Set the number of objects in the meta data cache and the + * maximum number of chunks and bytes in the raw data chunk + * cache. * - * The RDCC_W0 value should be between 0 and 1 inclusive and - * indicates how much chunks that have been fully read or fully - * written are favored for preemption. A value of zero means - * fully read or written chunks are treated no differently than - * other chunks (the preemption is strictly LRU) while a value - * of one means fully read chunks are always preempted before - * other chunks. + * The RDCC_W0 value should be between 0 and 1 inclusive and + * indicates how much chunks that have been fully read or fully + * written are favored for preemption. A value of zero means + * fully read or written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) while a value + * of one means fully read chunks are always preempted before + * other chunks. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, - size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) + size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ @@ -1540,24 +1552,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_cache + * Function: H5Pget_cache * - * Purpose: Retrieves the maximum possible number of elements in the meta - * data cache and the maximum possible number of elements and - * bytes and the RDCC_W0 value in the raw data chunk cache. Any - * (or all) arguments may be null pointers in which case the - * corresponding datum is not returned. + * Purpose: Retrieves the maximum possible number of elements in the meta + * data cache and the maximum possible number of elements and + * bytes and the RDCC_W0 value in the raw data chunk cache. Any + * (or all) arguments may be null pointers in which case the + * corresponding datum is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, - size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) + size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ @@ -1592,14 +1604,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_image_config + * Function: H5Pset_mdc_image_config * - * Purpose: Set the initial metadata cache image configuration in the - * target FAPL. + * Purpose: Set the initial metadata cache image configuration in the + * target FAPL. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, June 25, 2015 * *------------------------------------------------------------------------- @@ -1636,18 +1648,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_image_config + * Function: H5Pget_mdc_image_config * - * Purpose: Retrieve the metadata cache initial image configuration - * from the target FAPL. + * Purpose: Retrieve the metadata cache initial image configuration + * from the target FAPL. * - * Observe that the function will fail if config_ptr is - * NULL, or if config_ptr->version specifies an unknown - * version of H5AC_cache_image_config_t. + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_image_config_t. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Friday, June 26, 2015 * *------------------------------------------------------------------------- @@ -1687,14 +1699,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_config + * Function: H5Pset_mdc_config * - * Purpose: Set the initial metadata cache resize configuration in the - * target FAPL. + * Purpose: Set the initial metadata cache resize configuration in the + * target FAPL. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, April 7, 2005 * *------------------------------------------------------------------------- @@ -1731,18 +1743,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_config + * Function: H5Pget_mdc_config * - * Purpose: Retrieve the metadata cache initial resize configuration - * from the target FAPL. + * Purpose: Retrieve the metadata cache initial resize configuration + * from the target FAPL. * - * Observe that the function will fail if config_ptr is - * NULL, or if config_ptr->version specifies an unknown - * version of H5AC_cache_config_t. + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_config_t. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, April 7, 2005 * *------------------------------------------------------------------------- @@ -1782,33 +1794,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_gc_references + * Function: H5Pset_gc_references * - * Purpose: Sets the flag for garbage collecting references for the file. - * Dataset region references (and other reference types - * probably) use space in the file heap. If garbage collection - * is on and the user passes in an uninitialized value in a - * reference structure, the heap might get corrupted. When - * garbage collection is off however and the user re-uses a - * reference, the previous heap block will be orphaned and not - * returned to the free heap space. When garbage collection is - * on, the user must initialize the reference structures to 0 or - * risk heap corruption. + * Purpose: Sets the flag for garbage collecting references for the file. + * Dataset region references (and other reference types + * probably) use space in the file heap. If garbage collection + * is on and the user passes in an uninitialized value in a + * reference structure, the heap might get corrupted. When + * garbage collection is off however and the user re-uses a + * reference, the previous heap block will be orphaned and not + * returned to the free heap space. When garbage collection is + * on, the user must initialize the reference structures to 0 or + * risk heap corruption. * - * Default value for garbage collecting references is off, just - * to be on the safe side. + * Default value for garbage collecting references is off, just + * to be on the safe side. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June, 1999 + * Programmer: Quincey Koziol + * June, 1999 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -1835,22 +1847,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_gc_references + * Function: H5Pget_gc_references * - * Purpose: Returns the current setting for the garbage collection - * references property from a file access property list. + * Purpose: Returns the current setting for the garbage collection + * references property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * June, 1999 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -1949,31 +1961,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_meta_block_size + * Function: H5Pset_meta_block_size * - * Purpose: Sets the minimum size of metadata block allocations when + * Purpose: Sets the minimum size of metadata block allocations when * the H5FD_FEAT_AGGREGATE_METADATA is set by a VFL driver. * Each "raw" metadata block is allocated to be this size and then * specific pieces of metadata (object headers, local heaps, B-trees, etc) * are sub-allocated from this block. * - * The default value is set to 2048 (bytes), indicating that metadata + * The default value is set to 2048 (bytes), indicating that metadata * will be attempted to be bunched together in (at least) 2K blocks in * the file. Setting the value to 0 with this API function will * turn off the metadata aggregation, even if the VFL driver attempts to * use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2000,22 +2012,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_meta_block_size + * Function: H5Pget_meta_block_size * - * Purpose: Returns the current settings for the metadata block allocation + * Purpose: Returns the current settings for the metadata block allocation * property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 29, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2044,31 +2056,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_sieve_buf_size + * Function: H5Pset_sieve_buf_size * - * Purpose: Sets the maximum size of the data seive buffer used for file + * Purpose: Sets the maximum size of the data seive buffer used for file * drivers which are capable of using data sieving. The data sieve * buffer is used when performing I/O on datasets in the file. Using a * buffer which is large anough to hold several pieces of the dataset * being read in for hyperslab selections boosts performance by quite a * bit. * - * The default value is set to 64KB, indicating that file I/O for raw data + * The default value is set to 64KB, indicating that file I/O for raw data * reads and writes will occur in at least 64KB blocks. * Setting the value to 0 with this API function will turn off the * data sieving, even if the VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2095,22 +2107,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_sieve_buf_size + * Function: H5Pget_sieve_buf_size * - * Purpose: Returns the current settings for the data sieve buffer size + * Purpose: Returns the current settings for the data sieve buffer size * property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2138,23 +2150,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_small_data_block_size + * Function: H5Pset_small_data_block_size * - * Purpose: Sets the minimum size of "small" raw data block allocations + * Purpose: Sets the minimum size of "small" raw data block allocations * when the H5FD_FEAT_AGGREGATE_SMALLDATA is set by a VFL driver. * Each "small" raw data block is allocated to be this size and then * pieces of raw data which are small enough to fit are sub-allocated from * this block. * - * The default value is set to 2048 (bytes), indicating that raw data + * The default value is set to 2048 (bytes), indicating that raw data * smaller than this value will be attempted to be bunched together in (at * least) 2K blocks in the file. Setting the value to 0 with this API * function will turn off the "small" raw data aggregation, even if the * VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * * Modifications: @@ -2184,14 +2196,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_small_data_block_size + * Function: H5Pget_small_data_block_size * - * Purpose: Returns the current settings for the "small" raw data block + * Purpose: Returns the current settings for the "small" raw data block * allocation property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * * Modifications: @@ -2223,9 +2235,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_libver_bounds + * Function: H5Pset_libver_bounds * - * Purpose: Indicates which versions of the file format the library should + * Purpose: Indicates which versions of the file format the library should * use when creating objects. LOW is the earliest version of the HDF5 * library that is guaranteed to be able to access the objects created * (the format of some objects in an HDF5 file may not have changed between @@ -2301,9 +2313,9 @@ done: * releases and then map down to the previous actual library release which * had a format change. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, December 30, 2007 * *------------------------------------------------------------------------- @@ -2341,14 +2353,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_libver_bounds + * Function: H5Pget_libver_bounds * - * Purpose: Returns the current settings for the library version format bounds + * Purpose: Returns the current settings for the library version format bounds * from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 3, 2008 * *------------------------------------------------------------------------- @@ -2488,7 +2500,7 @@ H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size) /* Set value */ if(H5P_set(plist, H5F_ACS_VDS_SIZE_NAME, &vds_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set elink file cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds file cache size") done: FUNC_LEAVE_API(ret_value) @@ -2523,7 +2535,7 @@ H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size) /* Get value */ if(vds_size) if(H5P_get(plist, H5F_ACS_VDS_SIZE_NAME, vds_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file cache size") done: FUNC_LEAVE_API(ret_value) @@ -2533,9 +2545,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_file_image * - * Purpose: Sets the initial file image. Some file drivers can initialize - * the starting data in a file from a buffer. - * + * Purpose: Sets the initial file image. Some file drivers can initialize + * the starting data in a file from a buffer. + * * Return: Non-negative on success/Negative on failure * * Programmer: Jacob Gruber @@ -2549,22 +2561,22 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) H5P_genplist_t *fapl; /* Property list pointer */ H5FD_file_image_info_t image_info; /* File image info */ herr_t ret_value = SUCCEED; /* Return value */ - + FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*xz", fapl_id, buf_ptr, buf_len); /* validate parameters */ if(!(((buf_ptr == NULL) && (buf_len == 0)) || ((buf_ptr != NULL) && (buf_len > 0)))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistant buf_ptr and buf_len") - + /* Get the plist structure */ if(NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - + /* Get old image info */ if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image pointer") - + /* Release previous buffer, if it exists */ if(image_info.buffer != NULL) { if(image_info.callbacks.image_free) { @@ -2573,8 +2585,8 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) } /* end if */ else H5MM_xfree(image_info.buffer); - } /* end if */ - + } /* end if */ + /* Update struct */ if(buf_ptr) { /* Allocate memory */ @@ -2586,15 +2598,15 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) else if(NULL == (image_info.buffer = H5MM_malloc(buf_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") - + /* Copy data */ if(image_info.callbacks.image_memcpy) { - if(image_info.buffer != image_info.callbacks.image_memcpy(image_info.buffer, - buf_ptr, buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, + if(image_info.buffer != image_info.callbacks.image_memcpy(image_info.buffer, + buf_ptr, buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, image_info.callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(image_info.buffer, buf_ptr, buf_len); } /* end if */ else @@ -2614,24 +2626,24 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_file_image * - * Purpose: If the file image exists and buf_ptr_ptr is not NULL, - * allocate a buffer of the correct size, copy the image into - * the new buffer, and return the buffer to the caller in - * *buf_ptr_ptr. Do this using the file image callbacks - * if defined. + * Purpose: If the file image exists and buf_ptr_ptr is not NULL, + * allocate a buffer of the correct size, copy the image into + * the new buffer, and return the buffer to the caller in + * *buf_ptr_ptr. Do this using the file image callbacks + * if defined. * - * NB: It is the responsibility of the caller to free the - * buffer whose address is returned in *buf_ptr_ptr. Do - * this using free if the file image callbacks are not - * defined, or with whatever method is appropriate if - * the callbacks are defined. + * NB: It is the responsibility of the caller to free the + * buffer whose address is returned in *buf_ptr_ptr. Do + * this using free if the file image callbacks are not + * defined, or with whatever method is appropriate if + * the callbacks are defined. * - * If buf_ptr_ptr is not NULL, and no image exists, set - * *buf_ptr_ptr to NULL. + * If buf_ptr_ptr is not NULL, and no image exists, set + * *buf_ptr_ptr to NULL. * - * If buf_len_ptr is not NULL, set *buf_len_ptr equal - * to the length of the file image if it exists, and - * to 0 if it does not. + * If buf_len_ptr is not NULL, set *buf_len_ptr equal + * to the length of the file image if it exists, and + * to 0 if it does not. * * Return: Non-negative on success/Negative on failure * @@ -2659,7 +2671,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ - HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || + HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || ((image_info.buffer == NULL) && (image_info.size == 0))); /* Set output size */ @@ -2680,15 +2692,15 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) else if(NULL == (copy_ptr = H5MM_malloc(image_info.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate copy") - + /* Copy data */ if(image_info.callbacks.image_memcpy) { if(copy_ptr != image_info.callbacks.image_memcpy(copy_ptr, image_info.buffer, - image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, + image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, image_info.callbacks.udata)) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(copy_ptr, image_info.buffer, image_info.size); } /* end if */ @@ -2705,7 +2717,7 @@ done: * * Purpose: Sets the callbacks for file images. Some file drivers allow * the use of user-defined callbacks for allocating, freeing and - * copying the drivers internal buffer, potentially allowing a + * copying the drivers internal buffer, potentially allowing a * clever user to do optimizations such as avoiding large mallocs * and memcpys or to perform detailed logging. * @@ -2735,7 +2747,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || + HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* Make sure a file image hasn't already been set */ @@ -2744,7 +2756,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* verify that callbacks_ptr is not NULL */ if(NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") /* Make sure udata callbacks are going to be set if udata is going to be set */ if(callbacks_ptr->udata) @@ -2755,7 +2767,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback if(info.callbacks.udata != NULL) { HDassert(info.callbacks.udata_free); if(info.callbacks.udata_free(info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") } /* end if */ /* Update struct */ @@ -2782,7 +2794,7 @@ done: * * Purpose: Sets the callbacks for file images. Some file drivers allow * the use of user-defined callbacks for allocating, freeing and - * copying the drivers internal buffer, potentially allowing a + * copying the drivers internal buffer, potentially allowing a * clever user to do optimizations such as avoiding large mallocs * * Return: Non-negative on success/Negative on failure @@ -2811,12 +2823,12 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || + HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* verify that callbacks_ptr is not NULL */ if(NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") /* Transfer values to parameters */ *callbacks_ptr = info.callbacks; @@ -2837,12 +2849,12 @@ done: * Function: H5P__file_image_info_copy * * Purpose: Copy file image info. The buffer - * and udata may need to be copied, possibly using their + * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. + * finishes the "deep" part of the copy. * * Return: Success: Non-negative * Failure: Negative @@ -2865,7 +2877,7 @@ H5P__file_image_info_copy(void *value) info = (H5FD_file_image_info_t *)value; /* verify file image field consistancy */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || + HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); if(info->buffer && info->size > 0) { @@ -2884,14 +2896,14 @@ H5P__file_image_info_copy(void *value) if(NULL == (info->buffer = H5MM_malloc(info->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ - + /* Copy data to new buffer */ if(info->callbacks.image_memcpy) { - if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, - info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, + info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(info->buffer, old_buffer, info->size); } /* end if */ @@ -2915,8 +2927,8 @@ done: * Function: H5P__file_image_info_free * * Purpose: Free file image info. The buffer and udata may need to be - * freed, possibly using their respective callbacks, so the - * default free won't work. + * freed, possibly using their respective callbacks, so the + * default free won't work. * * Return: Success: Non-negative * Failure: Negative @@ -2937,16 +2949,16 @@ H5P__file_image_info_free(void *value) H5FD_file_image_info_t *info; /* Image info struct */ info = (H5FD_file_image_info_t *)value; - + /* Verify file image field consistancy */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || + HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); /* Free buffer */ - if(info->buffer != NULL && info->size > 0) { + if(info->buffer != NULL && info->size > 0) { if(info->callbacks.image_free) { if((*info->callbacks.image_free)(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") } /* end if */ else H5MM_xfree(info->buffer); @@ -2972,7 +2984,7 @@ done: * Purpose: Compare two cache image configurations. * * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is - * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * * Programmer: John Mainzer * June 26, 2015 @@ -3013,11 +3025,11 @@ done: * Function: H5P__facc_cache_image_config_enc * * Purpose: Callback routine which is called whenever the default - * cache image config property in the file creation - * property list is encoded. + * cache image config property in the file creation + * property list is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: John Mainzer * June 26, 2015 @@ -3059,11 +3071,11 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) * Function: H5P__facc_cache_image_config_dec * * Purpose: Callback routine which is called whenever the default - * cache image config property in the file creation property - * list is decoded. + * cache image config property in the file creation property + * list is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: John Mainzer * June 26, 2015 @@ -3178,7 +3190,7 @@ done: * * Purpose: Delete callback for the file image info property, called * when the property is deleted from the plist. The buffer - * and udata may need to be freed, possibly using their + * and udata may need to be freed, possibly using their * respective callbacks so the default free won't work. * * Return: Non-negative on success/Negative on failure @@ -3208,7 +3220,7 @@ done: * Function: H5P__facc_file_image_info_copy * * Purpose: Copy callback for the file image info property. The buffer - * and udata may need to be copied, possibly using their + * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * * Return: Non-negative on success/Negative on failure @@ -3297,7 +3309,7 @@ done: * Function: H5P__facc_file_image_info_close * * Purpose: Close callback for the file image info property. The buffer - * and udata may need to be freed, possibly using their + * and udata may need to be freed, possibly using their * respective callbacks so the standard free won't work. * * Return: Non-negative on success/Negative on failure @@ -3329,7 +3341,7 @@ done: * Purpose: Compare two cache configurations. * * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is - * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * * Programmer: Mohamad Chaarawi * September 24, 2012 @@ -3442,8 +3454,8 @@ done: * cache config property in the file creation property list is * encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * August 09, 2012 @@ -3587,8 +3599,8 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) * cache config property in the file creation property list is * decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * August 09, 2012 @@ -3722,8 +3734,8 @@ done: * degree property in the file access property list * is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3760,8 +3772,8 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) * degree property in the file access property list * is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3795,8 +3807,8 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) * memory type property in the file access property list * is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3833,8 +3845,8 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) * memory type property in the file access property list * is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3862,12 +3874,12 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) /*------------------------------------------------------------------------- - * Function: H5Pset_core_write_tracking + * Function: H5Pset_core_write_tracking * - * Purpose: Enables/disables core VFD write tracking and page + * Purpose: Enables/disables core VFD write tracking and page * aggregation size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Dana Robinson * Tuesday, April 8, 2014 @@ -3903,12 +3915,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_core_write_tracking + * Function: H5Pget_core_write_tracking * - * Purpose: Gets information about core VFD write tracking and page + * Purpose: Gets information about core VFD write tracking and page * aggregation size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Dana Robinson * Tuesday, April 8, 2014 @@ -3945,19 +3957,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_metadata_read_attempts + * Function: H5Pset_metadata_read_attempts + * + * Purpose: Sets the # of read attempts in the file access property list + * when reading metadata with checksum. + * The # of read attempts set via this routine will only apply + * when opening a file with SWMR access. + * The # of read attempts set via this routine does not have + * any effect when opening a file with non-SWMR access; for this + * case, the # of read attempts will be always be 1. * - * Purpose: Sets the # of read attempts in the file access property list - * when reading metadata with checksum. - * The # of read attempts set via this routine will only apply - * when opening a file with SWMR access. - * The # of read attempts set via this routine does not have - * any effect when opening a file with non-SWMR access; for this - * case, the # of read attempts will be always be 1. - * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 + * Programmer: Vailin Choi; Sept 2013 * *------------------------------------------------------------------------- */ @@ -3988,13 +4000,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_metadata_read_attempts + * Function: H5Pget_metadata_read_attempts * - * Purpose: Returns the # of metadata read attempts set in the file access property list. + * Purpose: Returns the # of metadata read attempts set in the file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 + * Programmer: Vailin Choi; Sept 2013 * *------------------------------------------------------------------------- */ @@ -4014,13 +4026,13 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts/*out*/) if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Get the # of read attempts set */ + /* Get the # of read attempts set */ if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, attempts) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get the number of metadata read attempts") - /* If not set, return the default value */ - if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ - *attempts = H5F_METADATA_READ_ATTEMPTS; + /* If not set, return the default value */ + if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ + *attempts = H5F_METADATA_READ_ATTEMPTS; } /* end if */ done: @@ -4029,14 +4041,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_obj_flush_cb + * Function: H5Pset_obj_flush_cb * - * Purpose: Sets the callback function to invoke and the user data when an - * object flush occurs in the file. - * - * Return: Non-negative on success/Negative on failure + * Purpose: Sets the callback function to invoke and the user data when an + * object flush occurs in the file. * - * Programmer: Vailin Choi; Dec 2013 + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ @@ -4073,14 +4085,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_obj_flush_cb + * Function: H5Pget_obj_flush_cb + * + * Purpose: Retrieves the callback function and user data set in the + * property list for an object flush. * - * Purpose: Retrieves the callback function and user data set in the - * property list for an object flush. - * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Dec 2013 + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ @@ -4104,9 +4116,9 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata) /* Assign return value */ if(func) - *func = flush_info.func; + *func = flush_info.func; if(udata) - *udata = flush_info.udata; + *udata = flush_info.udata; done: FUNC_LEAVE_API(ret_value) @@ -4114,11 +4126,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_log_options + * Function: H5Pset_mdc_log_options * - * Purpose: Set metadata cache log options. + * Purpose: Set metadata cache log options. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -4166,11 +4178,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_log_options + * Function: H5Pget_mdc_log_options * - * Purpose: Get metadata cache log options. + * Purpose: Get metadata cache log options. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -4524,8 +4536,8 @@ done: * * Purpose: Generic encoding callback routine for 'coll_md_read_flag' properties. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 @@ -4562,8 +4574,8 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) * * Purpose: Generic decoding callback routine for 'coll_md_read_flag' properties. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 @@ -4592,22 +4604,22 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) /*------------------------------------------------------------------------- - * Function: H5Pset_all_coll_metadata_ops + * Function: H5Pset_all_coll_metadata_ops * - * Purpose: Tell the library whether the metadata read operations will - * be done collectively (1) or not (0). Default is independent. - * With collective mode, the library will optimize access to - * metadata operations on the file. + * Purpose: Tell the library whether the metadata read operations will + * be done collectively (1) or not (0). Default is independent. + * With collective mode, the library will optimize access to + * metadata operations on the file. * - * Note: This routine accepts file access property lists, link - * access property lists, attribute access property lists, - * dataset access property lists, group access property lists, - * named datatype access property lists, - * and dataset transfer property lists. + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4651,19 +4663,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_all_coll_metadata_ops + * Function: H5Pget_all_coll_metadata_ops * - * Purpose: Gets information about collective metadata read mode. + * Purpose: Gets information about collective metadata read mode. * - * Note: This routine accepts file access property lists, link - * access property lists, attribute access property lists, - * dataset access property lists, group access property lists, - * named datatype access property lists, - * and dataset transfer property lists. + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4709,14 +4721,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_coll_metadata_write + * Function: H5Pset_coll_metadata_write * - * Purpose: Tell the library whether the metadata write operations will - * be done collectively (1) or not (0). Default is collective. + * Purpose: Tell the library whether the metadata write operations will + * be done collectively (1) or not (0). Default is collective. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4748,13 +4760,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_coll_metadata_write + * Function: H5Pget_coll_metadata_write * - * Purpose: Gets information about collective metadata write mode. + * Purpose: Gets information about collective metadata write mode. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4786,15 +4798,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_page_buffer_size + * Function: H5Pset_page_buffer_size * * Purpose: Set the maximum page buffering size. This has to be a * multiple of the page allocation size which must be enabled; * otherwise file create/open will fail. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * June 2015 * *------------------------------------------------------------------------- @@ -4834,13 +4846,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_page_buffer_size + * Function: H5Pget_page_buffer_size * - * Purpose: Retrieves the maximum page buffer size. + * Purpose: Retrieves the maximum page buffer size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * June 2015 * *------------------------------------------------------------------------- -- cgit v0.12 From b475a809d823c0aaf91260f3b3b7df6026ba13b9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Dec 2017 10:31:30 -0600 Subject: Remove return from void functions --- java/src/jni/h5pImp.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 3c799f2..b144ff6 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -5786,8 +5786,6 @@ Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix if(retVal < 0) h5libraryError(env); } - - return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */ /* @@ -5854,8 +5852,6 @@ Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix if(retVal < 0) h5libraryError(env); } - - return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */ /* -- cgit v0.12 From 8561bd327b37960d62e977e1283a10d8e5102424 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Dec 2017 11:04:29 -0600 Subject: Fix VDS file cache var names --- src/H5Fprivate.h | 424 +++++++++++++++++++++++++++---------------------------- src/H5Pfapl.c | 18 +-- 2 files changed, 221 insertions(+), 221 deletions(-) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 262e63b..84c8c90 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -25,13 +25,13 @@ typedef struct H5F_t H5F_t; #include "H5Fpublic.h" /* Public headers needed by this file */ -#include "H5FDpublic.h" /* File drivers */ +#include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ #ifdef H5_HAVE_PARALLEL -#include "H5Pprivate.h" /* Property lists */ +#include "H5Pprivate.h" /* Property lists */ #endif /* H5_HAVE_PARALLEL */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /**************************/ @@ -43,68 +43,68 @@ typedef struct H5F_t H5F_t; * Currently, all file meta-data is little-endian. */ -# define INT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ +# define INT16ENCODE(p, i) { \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } -# define UINT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ +# define UINT16ENCODE(p, i) { \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } -# define INT32ENCODE(p, i) { \ - *(p) = (uint8_t)( (uint32_t)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); (p)++; \ +# define INT32ENCODE(p, i) { \ + *(p) = (uint8_t)( (uint32_t)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); (p)++; \ } -# define UINT32ENCODE(p, i) { \ - *(p) = (uint8_t)( (i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \ +# define UINT32ENCODE(p, i) { \ + *(p) = (uint8_t)( (i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \ } /* Encode an unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define ENCODE_VAR(p, typ, n, l) { \ - typ _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for(_i = 0; _i < l; _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t*)(p) + l; \ +# define ENCODE_VAR(p, typ, n, l) { \ + typ _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for(_i = 0; _i < l; _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t*)(p) + l; \ } /* Encode a 32-bit unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ # define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l) -# define INT64ENCODE(p, n) { \ - int64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = (n) < 0 ? 0xff : 0; \ - (p) = (uint8_t*)(p)+8; \ +# define INT64ENCODE(p, n) { \ + int64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = (n) < 0 ? 0xff : 0; \ + (p) = (uint8_t*)(p)+8; \ } -# define UINT64ENCODE(p, n) { \ - uint64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = 0; \ - (p) = (uint8_t*)(p) + 8; \ +# define UINT64ENCODE(p, n) { \ + uint64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = 0; \ + (p) = (uint8_t*)(p) + 8; \ } /* Encode a 64-bit unsigned integer into a variable-sized buffer */ @@ -113,31 +113,31 @@ typedef struct H5F_t H5F_t; /* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define UINT64ENCODE_VARLEN(p, n) { \ - uint64_t __n = (uint64_t)(n); \ - unsigned _s = H5VM_limit_enc_size(__n); \ - \ - *(p)++ = (uint8_t)_s; \ - UINT64ENCODE_VAR(p, __n, _s); \ +# define UINT64ENCODE_VARLEN(p, n) { \ + uint64_t __n = (uint64_t)(n); \ + unsigned _s = H5VM_limit_enc_size(__n); \ + \ + *(p)++ = (uint8_t)_s; \ + UINT64ENCODE_VAR(p, __n, _s); \ } -# define H5_ENCODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32ENCODE(p, n) \ +# define H5_ENCODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32ENCODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ -# define H5_ENCODE_DOUBLE(p, n) { \ - uint64_t _n; \ - size_t _u; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - HDmemcpy(&_n, &n, sizeof(double)); \ - for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t *)(p) + 8; \ +# define H5_ENCODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + HDmemcpy(&_n, &n, sizeof(double)); \ + for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t *)(p) + 8; \ } /* DECODE converts little endian bytes pointed by p to integer values and store @@ -148,68 +148,68 @@ typedef struct H5F_t H5F_t; * correctly even if i is actually a 64bit int like in a Cray. */ -# define INT16DECODE(p, i) { \ - (i) = (int16_t)((*(p) & 0xff)); (p)++; \ +# define INT16DECODE(p, i) { \ + (i) = (int16_t)((*(p) & 0xff)); (p)++; \ (i) |= (int16_t)(((*(p) & 0xff) << 8) | \ - ((*(p) & 0x80) ? ~0xffff : 0x0)); (p)++; \ + ((*(p) & 0x80) ? ~0xffff : 0x0)); (p)++; \ } -# define UINT16DECODE(p, i) { \ - (i) = (uint16_t) (*(p) & 0xff); (p)++; \ - (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ +# define UINT16DECODE(p, i) { \ + (i) = (uint16_t) (*(p) & 0xff); (p)++; \ + (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ } -# define INT32DECODE(p, i) { \ - (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ +# define INT32DECODE(p, i) { \ + (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \ } -# define UINT32DECODE(p, i) { \ - (i) = (uint32_t)(*(p) & 0xff); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ +# define UINT32DECODE(p, i) { \ + (i) = (uint32_t)(*(p) & 0xff); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ } /* Decode a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define DECODE_VAR(p, n, l) { \ - size_t _i; \ - \ - n = 0; \ - (p) += l; \ - for (_i = 0; _i < l; _i++) \ - n = (n << 8) | *(--p); \ - (p) += l; \ +# define DECODE_VAR(p, n, l) { \ + size_t _i; \ + \ + n = 0; \ + (p) += l; \ + for (_i = 0; _i < l; _i++) \ + n = (n << 8) | *(--p); \ + (p) += l; \ } /* Decode a variable-sized buffer into a 32-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ # define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) -# define INT64DECODE(p, n) { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(int64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ +# define INT64DECODE(p, n) { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(int64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ } -# define UINT64DECODE(p, n) { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(uint64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ +# define UINT64DECODE(p, n) { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(uint64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ } /* Decode a variable-sized buffer into a 64-bit unsigned integer */ @@ -218,58 +218,58 @@ typedef struct H5F_t H5F_t; /* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define UINT64DECODE_VARLEN(p, n) { \ - unsigned _s = *(p)++; \ - \ - UINT64DECODE_VAR(p, n, _s); \ +# define UINT64DECODE_VARLEN(p, n) { \ + unsigned _s = *(p)++; \ + \ + UINT64DECODE_VAR(p, n, _s); \ } -# define H5_DECODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32DECODE(p, n) \ +# define H5_DECODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32DECODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ -# define H5_DECODE_DOUBLE(p, n) { \ - uint64_t _n; \ - size_t _u; \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - _n = 0; \ - (p) += 8; \ - for(_u = 0; _u < sizeof(uint64_t); _u++) \ - _n = (_n << 8) | *(--p); \ - HDmemcpy(&(n), &_n, sizeof(double)); \ - (p) += 8; \ +# define H5_DECODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + _n = 0; \ + (p) += 8; \ + for(_u = 0; _u < sizeof(uint64_t); _u++) \ + _n = (_n << 8) | *(--p); \ + HDmemcpy(&(n), &_n, sizeof(double)); \ + (p) += 8; \ } /* Address-related macros */ -#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ - HADDR_UNDEF==(X)+(haddr_t)(Z) || \ - (X)+(haddr_t)(Z)<(X)) -#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) +#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ + HADDR_UNDEF==(X)+(haddr_t)(Z) || \ + (X)+(haddr_t)(Z)<(X)) +#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) /* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making * certain that X is not HADDR_UNDEF and then checking that X equals Y */ -#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ - (X)==(Y)) -#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>=(Y)) -#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ - (H5F_addr_lt((X), (Y)) ? -1 : 1)) -#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) +#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ + (X)==(Y)) +#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) +#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<(Y)) +#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<=(Y)) +#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>(Y)) +#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>=(Y)) +#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ + (H5F_addr_lt((X), (Y)) ? -1 : 1)) +#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) #define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \ ((O1) >= (O2) && (O1) < ((O2) + (L2)))) @@ -294,7 +294,7 @@ typedef struct H5F_t H5F_t; #define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr) #define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k) #define H5F_KVALUE(F,T) ((F)->shared->sblock->btree_k[(T)->id]) -#define H5F_NREFS(F) ((F)->shared->nrefs) +#define H5F_NREFS(F) ((F)->shared->nrefs) #define H5F_SIZEOF_ADDR(F) ((F)->shared->sizeof_addr) #define H5F_SIZEOF_SIZE(F) ((F)->shared->sizeof_size) #define H5F_SOHM_ADDR(F) ((F)->shared->sohm_addr) @@ -325,8 +325,8 @@ typedef struct H5F_t H5F_t; #define H5F_USE_MDC_LOGGING(F) ((F)->shared->use_mdc_logging) #define H5F_START_MDC_LOG_ON_ACCESS(F) ((F)->shared->start_mdc_log_on_access) #define H5F_MDC_LOG_LOCATION(F) ((F)->shared->mdc_log_location) -#define H5F_ALIGNMENT(F) ((F)->shared->alignment) -#define H5F_THRESHOLD(F) ((F)->shared->threshold) +#define H5F_ALIGNMENT(F) ((F)->shared->alignment) +#define H5F_THRESHOLD(F) ((F)->shared->threshold) #define H5F_PGEND_META_THRES(F) ((F)->shared->fs.pgend_meta_thres) #define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return) #define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc) @@ -351,7 +351,7 @@ typedef struct H5F_t H5F_t; #define H5F_BASE_ADDR(F) (H5F_get_base_addr(F)) #define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F)) #define H5F_KVALUE(F,T) (H5F_Kvalue(F,T)) -#define H5F_NREFS(F) (H5F_get_nrefs(F)) +#define H5F_NREFS(F) (H5F_get_nrefs(F)) #define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) #define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) #define H5F_SOHM_ADDR(F) (H5F_get_sohm_addr(F)) @@ -382,8 +382,8 @@ typedef struct H5F_t H5F_t; #define H5F_USE_MDC_LOGGING(F) (H5F_use_mdc_logging(F)) #define H5F_START_MDC_LOG_ON_ACCESS(F) (H5F_start_mdc_log_on_access(F)) #define H5F_MDC_LOG_LOCATION(F) (H5F_mdc_log_location(F)) -#define H5F_ALIGNMENT(F) (H5F_get_alignment(F)) -#define H5F_THRESHOLD(F) (H5F_get_threshold(F)) +#define H5F_ALIGNMENT(F) (H5F_get_alignment(F)) +#define H5F_THRESHOLD(F) (H5F_get_threshold(F)) #define H5F_PGEND_META_THRES(F) (H5F_get_pgend_meta_thres(F)) #define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F)) #define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F)) @@ -392,32 +392,32 @@ typedef struct H5F_t H5F_t; /* Macros to encode/decode offset/length's for storing in the file */ -#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ - case 4: UINT32ENCODE(p,o); break; \ - case 8: UINT64ENCODE(p,o); break; \ - case 2: UINT16ENCODE(p,o); break; \ +#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ + case 4: UINT32ENCODE(p,o); break; \ + case 8: UINT64ENCODE(p,o); break; \ + case 2: UINT16ENCODE(p,o); break; \ } -#define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) { \ - case 4: UINT32DECODE(p, o); break; \ - case 8: UINT64DECODE(p, o); break; \ - case 2: UINT16DECODE(p, o); break; \ +#define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) { \ + case 4: UINT32DECODE(p, o); break; \ + case 8: UINT64DECODE(p, o); break; \ + case 2: UINT16DECODE(p, o); break; \ } -#define H5F_ENCODE_LENGTH_LEN(p,l,s) switch(s) { \ - case 4: UINT32ENCODE(p,l); break; \ - case 8: UINT64ENCODE(p,l); break; \ - case 2: UINT16ENCODE(p,l); break; \ - default: HDassert("bad sizeof size" && 0); \ +#define H5F_ENCODE_LENGTH_LEN(p,l,s) switch(s) { \ + case 4: UINT32ENCODE(p,l); break; \ + case 8: UINT64ENCODE(p,l); break; \ + case 2: UINT16ENCODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_ENCODE_LENGTH(f,p,l) H5F_ENCODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) -#define H5F_DECODE_LENGTH_LEN(p,l,s) switch(s) { \ - case 4: UINT32DECODE(p,l); break; \ - case 8: UINT64DECODE(p,l); break; \ - case 2: UINT16DECODE(p,l); break; \ - default: HDassert("bad sizeof size" && 0); \ +#define H5F_DECODE_LENGTH_LEN(p,l,s) switch(s) { \ + case 4: UINT32DECODE(p,l); break; \ + case 8: UINT64DECODE(p,l); break; \ + case 2: UINT16DECODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_DECODE_LENGTH(f,p,l) H5F_DECODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) @@ -427,13 +427,13 @@ typedef struct H5F_t H5F_t; * with. */ #if (H5_SIZEOF_SIZE_T >= H5_SIZEOF_OFF_T) -# define H5F_OVERFLOW_SIZET2OFFT(X) \ +# define H5F_OVERFLOW_SIZET2OFFT(X) \ ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(HDoff_t)-1))) #else # define H5F_OVERFLOW_SIZET2OFFT(X) 0 #endif #if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T) -# define H5F_OVERFLOW_HSIZET2OFFT(X) \ +# define H5F_OVERFLOW_HSIZET2OFFT(X) \ ((hsize_t)(X) >= (hsize_t)((hsize_t)1 << (8 * sizeof(HDoff_t) - 1))) #else # define H5F_OVERFLOW_HSIZET2OFFT(X) 0 @@ -461,14 +461,14 @@ typedef struct H5F_t H5F_t; #define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */ #define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */ #define H5F_CRT_FILE_SPACE_STRATEGY_NAME "file_space_strategy" /* File space handling strategy */ -#define H5F_CRT_FREE_SPACE_PERSIST_NAME "free_space_persist" /* Free-space persisting status */ +#define H5F_CRT_FREE_SPACE_PERSIST_NAME "free_space_persist" /* Free-space persisting status */ #define H5F_CRT_FREE_SPACE_THRESHOLD_NAME "free_space_threshold" /* Free space section threshold */ #define H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME "file_space_page_size" /* File space page size */ /* ========= File Access properties ============ */ -#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ +#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ #define H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ #define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ #define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ @@ -487,9 +487,9 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_LATEST_FORMAT_NAME "latest_format" /* 'Use latest format version' flag */ #define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */ #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ -#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ +#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ -#define H5F_ACS_VDS_SIZE_NAME "vds_size" /* Size of vds file cache */ +#define H5F_ACS_VDS_FILE_CACHE_SIZE_NAME "vds_file_cache_size" /* Size of vds file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ #define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */ @@ -505,7 +505,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME "page_buffer_min_raw_perc" /* the min raw data percentage for the page buffer cache */ /* ======================== File Mount properties ====================*/ -#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ +#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ #ifdef H5_HAVE_PARALLEL @@ -514,20 +514,20 @@ typedef struct H5F_t H5F_t; #endif /* H5_HAVE_PARALLEL */ /* Define the HDF5 file signature */ -#define H5F_SIGNATURE "\211HDF\r\n\032\n" +#define H5F_SIGNATURE "\211HDF\r\n\032\n" #define H5F_SIGNATURE_LEN 8 /* Version #'s of the major components of the file format */ -#define HDF5_SUPERBLOCK_VERSION_DEF 0 /* The default super block format */ -#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */ -#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_DEF 0 /* The default super block format */ +#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */ +#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 */ -#define HDF5_DRIVERINFO_VERSION_0 0 /* of the Driver Information Block*/ +#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 */ +#define HDF5_DRIVERINFO_VERSION_0 0 /* of the Driver Information Block*/ /* B-tree internal 'K' values */ #define HDF5_BTREE_SNODE_IK_DEF 16 @@ -537,43 +537,43 @@ typedef struct H5F_t H5F_t; if it is changed, the code must compensate. -QAK */ -#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */ - /* See format specification on version 1 B-trees */ +#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */ + /* See format specification on version 1 B-trees */ /* Default file space handling strategy */ -#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR +#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR /* Default free space section threshold used by free-space managers */ -#define H5F_FREE_SPACE_PERSIST_DEF FALSE +#define H5F_FREE_SPACE_PERSIST_DEF FALSE /* Default free space section threshold used by free-space managers */ -#define H5F_FREE_SPACE_THRESHOLD_DEF 1 +#define H5F_FREE_SPACE_THRESHOLD_DEF 1 /* For paged aggregation: default file space page size when not set */ -#define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096 +#define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096 /* For paged aggregation: minimum value for file space page size */ -#define H5F_FILE_SPACE_PAGE_SIZE_MIN 512 +#define H5F_FILE_SPACE_PAGE_SIZE_MIN 512 /* For paged aggregation: maxiumum value for file space page size: 1 gigabyte */ -#define H5F_FILE_SPACE_PAGE_SIZE_MAX 1024*1024*1024 +#define H5F_FILE_SPACE_PAGE_SIZE_MAX 1024*1024*1024 /* For paged aggregation: drop free-space with size <= this threshold for small meta section */ #define H5F_FILE_SPACE_PGEND_META_THRES 0 /* Default for threshold for alignment (can be set via H5Pset_alignment()) */ -#define H5F_ALIGN_DEF 1 +#define H5F_ALIGN_DEF 1 /* Default for alignment (can be set via H5Pset_alignment()) */ -#define H5F_ALIGN_THRHD_DEF 1 +#define H5F_ALIGN_THRHD_DEF 1 /* Default size for meta data aggregation block (can be set via H5Pset_meta_block_size()) */ -#define H5F_META_BLOCK_SIZE_DEF 2048 +#define H5F_META_BLOCK_SIZE_DEF 2048 /* Default size for small data aggregation block (can be set via H5Pset_small_data_block_size()) */ -#define H5F_SDATA_BLOCK_SIZE_DEF 2048 +#define H5F_SDATA_BLOCK_SIZE_DEF 2048 /* Check for file using paged aggregation */ #define H5F_PAGED_AGGR(F) (F->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && F->shared->fs_page_size) /* Metadata read attempt values */ -#define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */ -#define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */ +#define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */ +#define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */ /* Macros to define signatures of all objects in the file */ @@ -584,10 +584,10 @@ typedef struct H5F_t H5F_t; /* Size of checksum information (on disk) */ /* (all on-disk checksums should be this length) */ -#define H5_SIZEOF_CHKSUM 4 +#define H5_SIZEOF_CHKSUM 4 /* v1 B-tree node signature */ -#define H5B_MAGIC "TREE" +#define H5B_MAGIC "TREE" /* v2 B-tree signatures */ #define H5B2_HDR_MAGIC "BTHD" /* Header */ @@ -617,7 +617,7 @@ typedef struct H5F_t H5F_t; #define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */ /* Global heap signature */ -#define H5HG_MAGIC "GCOL" +#define H5HG_MAGIC "GCOL" /* Local heap signature */ #define H5HL_MAGIC "HEAP" @@ -705,11 +705,11 @@ typedef enum H5F_fs_state_t { typedef enum H5F_mem_page_t { H5F_MEM_PAGE_DEFAULT = 0, /* Not used */ H5F_MEM_PAGE_SUPER = 1, - H5F_MEM_PAGE_BTREE = 2, - H5F_MEM_PAGE_DRAW = 3, - H5F_MEM_PAGE_GHEAP = 4, - H5F_MEM_PAGE_LHEAP = 5, - H5F_MEM_PAGE_OHDR = 6, + H5F_MEM_PAGE_BTREE = 2, + H5F_MEM_PAGE_DRAW = 3, + H5F_MEM_PAGE_GHEAP = 4, + H5F_MEM_PAGE_LHEAP = 5, + H5F_MEM_PAGE_OHDR = 6, H5F_MEM_PAGE_LARGE_SUPER = 7, H5F_MEM_PAGE_LARGE_BTREE = 8, H5F_MEM_PAGE_LARGE_DRAW = 9, diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 586f559..d4e84ab 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -156,10 +156,10 @@ #define H5F_ACS_EFC_SIZE_ENC H5P__encode_unsigned #define H5F_ACS_EFC_SIZE_DEC H5P__decode_unsigned /* Definition for vds file cache size */ -#define H5F_ACS_VDS_SIZE_SIZE sizeof(unsigned) -#define H5F_ACS_VDS_SIZE_DEF 0 -#define H5F_ACS_VDS_SIZE_ENC H5P__encode_unsigned -#define H5F_ACS_VDS_SIZE_DEC H5P__decode_unsigned +#define H5F_ACS_VDS_FILE_CACHE_SIZE_SIZE sizeof(unsigned) +#define H5F_ACS_VDS_FILE_CACHE_SIZE_DEF 0 +#define H5F_ACS_VDS_FILE_CACHE_SIZE_ENC H5P__encode_unsigned +#define H5F_ACS_VDS_FILE_CACHE_SIZE_DEC H5P__decode_unsigned /* Definition of pointer to initial file image info */ #define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t) #define H5F_ACS_FILE_IMAGE_INFO_DEF H5FD_DEFAULT_FILE_IMAGE_INFO @@ -360,7 +360,7 @@ static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */ static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */ -static const unsigned H5F_def_vds_size_g = H5F_ACS_VDS_SIZE_DEF; /* Default vds file cache size */ +static const unsigned H5F_def_vds_file_cache_size_g = H5F_ACS_VDS_FILE_CACHE_SIZE_DEF; /* Default vds file cache size */ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ @@ -517,8 +517,8 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vds file cache size */ - if(H5P_register_real(pclass, H5F_ACS_VDS_SIZE_NAME, H5F_ACS_VDS_SIZE_SIZE, &H5F_def_vds_size_g, - NULL, NULL, NULL, H5F_ACS_VDS_SIZE_ENC, H5F_ACS_VDS_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_VDS_FILE_CACHE_SIZE_NAME, H5F_ACS_VDS_FILE_CACHE_SIZE_SIZE, &H5F_def_vds_file_cache_size_g, + NULL, NULL, NULL, H5F_ACS_VDS_FILE_CACHE_SIZE_ENC, H5F_ACS_VDS_FILE_CACHE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -2499,7 +2499,7 @@ H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set value */ - if(H5P_set(plist, H5F_ACS_VDS_SIZE_NAME, &vds_size) < 0) + if(H5P_set(plist, H5F_ACS_VDS_FILE_CACHE_SIZE_NAME, &vds_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds file cache size") done: @@ -2534,7 +2534,7 @@ H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size) /* Get value */ if(vds_size) - if(H5P_get(plist, H5F_ACS_VDS_SIZE_NAME, vds_size) < 0) + if(H5P_get(plist, H5F_ACS_VDS_FILE_CACHE_SIZE_NAME, vds_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file cache size") done: -- cgit v0.12 From 8b24653c1fba1d1811e692a028760ffb091cd0a8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Dec 2017 11:14:49 -0600 Subject: Correct var name --- src/H5Fprivate.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 84c8c90..575aa1c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -489,7 +489,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ #define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ -#define H5F_ACS_VDS_FILE_CACHE_SIZE_NAME "vds_file_cache_size" /* Size of vds file cache */ +#define H5F_ACS_VDS_FILE_CACHE_SIZE_NAME "vds_file_cache_size" /* Size of vds file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ #define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */ @@ -580,14 +580,14 @@ typedef struct H5F_t H5F_t; /* Size of signature information (on disk) */ /* (all on-disk signatures should be this length) */ -#define H5_SIZEOF_MAGIC 4 +#define H5_SIZEOF_MAGIC 4 /* Size of checksum information (on disk) */ /* (all on-disk checksums should be this length) */ #define H5_SIZEOF_CHKSUM 4 /* v1 B-tree node signature */ -#define H5B_MAGIC "TREE" +#define H5B_MAGIC "TREE" /* v2 B-tree signatures */ #define H5B2_HDR_MAGIC "BTHD" /* Header */ @@ -617,7 +617,7 @@ typedef struct H5F_t H5F_t; #define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */ /* Global heap signature */ -#define H5HG_MAGIC "GCOL" +#define H5HG_MAGIC "GCOL" /* Local heap signature */ #define H5HL_MAGIC "HEAP" -- cgit v0.12 From 386be69a30f2ef8db94c32b1d9731fd379a4062a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Dec 2017 11:51:09 -0600 Subject: HDFFV-9724 combine efc and vds into one function --- src/H5Dint.c | 131 +++++++++++++-------------------------------------------- src/H5Fquery.c | 2 +- 2 files changed, 31 insertions(+), 102 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index 2123836..8b663b8 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -61,9 +61,7 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); -static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, - char **extfile_prefix); -static herr_t H5D_build_vds_prefix(const H5D_t *dset, hid_t dapl_id, +static herr_t H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char * prefix_type, char **vds_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, @@ -965,99 +963,25 @@ done: } /* end H5D__update_oh_info() */ -/*-------------------------------------------------------------------------- - * Function: H5D_build_extfile_prefix - * - * Purpose: Determine the external file prefix to be used and store - * it in extfile_prefix. Stores an empty string if no prefix - * should be used. - * - * Return: SUCCEED/FAIL - *-------------------------------------------------------------------------- - */ -static herr_t -H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/) -{ - char *prefix = NULL; /* prefix used to look for the file */ - char *extpath = NULL; /* absolute path of directory the HDF5 file is in */ - size_t extpath_len; /* length of extpath */ - size_t prefix_len; /* length of prefix */ - size_t extfile_prefix_len; /* length of expanded prefix */ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(dset); - HDassert(dset->oloc.file); - - extpath = H5F_EXTPATH(dset->oloc.file); - HDassert(extpath); - - /* XXX: Future thread-safety note - getenv is not required - * to be reentrant. - */ - prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); - - if(prefix == NULL || *prefix == '\0') { - /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */ - if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") - } /* end if */ - - /* Prefix has to be checked for NULL / empty string again because the - * code above might have updated it. - */ - if(prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) { - /* filename is interpreted as relative to the current directory, - * does not need to be expanded - */ - if(NULL == (*extfile_prefix = (char *)H5MM_strdup(""))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end if */ - else { - if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { - /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ - extpath_len = HDstrlen(extpath); - prefix_len = HDstrlen(prefix); - extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; - - if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") - HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); - } /* end if */ - else { - if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end else */ - } /* end else */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_build_extfile_prefix() */ - /*-------------------------------------------------------------------------- - * Function: H5D_build_vds_prefix + * Function: H5D_build_file_prefix * - * Purpose: Determine the vds file prefix to be used and store - * it in vds_prefix. Stores an empty string if no prefix + * Purpose: Determine the file prefix to be used and store + * it in file_prefix. Stores an empty string if no prefix * should be used. * * Return: SUCCEED/FAIL *-------------------------------------------------------------------------- */ static herr_t -H5D_build_vds_prefix(const H5D_t *dset, hid_t dapl_id, char **vds_prefix /*out*/) +H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix /*out*/) { char *prefix = NULL; /* prefix used to look for the file */ - char *vdspath = NULL; /* absolute path of directory the HDF5 file is in */ - size_t vdspath_len; /* length of vdstpath */ + char *filepath = NULL; /* absolute path of directory the HDF5 file is in */ + size_t filepath_len; /* length of file path */ size_t prefix_len; /* length of prefix */ - size_t vds_prefix_len; /* length of expanded prefix */ + size_t file_prefix_len; /* length of expanded prefix */ H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1067,20 +991,25 @@ H5D_build_vds_prefix(const H5D_t *dset, hid_t dapl_id, char **vds_prefix /*out*/ HDassert(dset); HDassert(dset->oloc.file); - vdspath = H5F_EXTPATH(dset->oloc.file); - HDassert(vdspath); + filepath = H5F_EXTPATH(dset->oloc.file); + HDassert(filepath); /* XXX: Future thread-safety note - getenv is not required * to be reentrant. */ - prefix = HDgetenv("HDF5_VDS_PREFIX"); + if (HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) + prefix = HDgetenv("HDF5_VDS_PREFIX"); + else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) + prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); + else + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") if(prefix == NULL || *prefix == '\0') { - /* Set prefix to value of H5D_ACS_VDS_PREFIX_NAME property */ + /* Set prefix to value of prefix_type property */ if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds prefix") + if(H5P_peek(plist, prefix_type, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix") } /* end if */ /* Prefix has to be checked for NULL / empty string again because the @@ -1090,29 +1019,29 @@ H5D_build_vds_prefix(const H5D_t *dset, hid_t dapl_id, char **vds_prefix /*out*/ /* filename is interpreted as relative to the current directory, * does not need to be expanded */ - if(NULL == (*vds_prefix = (char *)H5MM_strdup(""))) + if(NULL == (*file_prefix = (char *)H5MM_strdup(""))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ else { if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ - vdspath_len = HDstrlen(vdspath); + filepath_len = HDstrlen(filepath); prefix_len = HDstrlen(prefix); - vds_prefix_len = vdspath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; + file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; - if(NULL == (*vds_prefix = (char *)H5MM_malloc(vds_prefix_len))) + if(NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") - HDsnprintf(*vds_prefix, vds_prefix_len, "%s%s", vdspath, prefix + HDstrlen("${ORIGIN}")); + HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}")); } /* end if */ else { - if(NULL == (*vds_prefix = (char *)H5MM_strdup(prefix))) + if(NULL == (*file_prefix = (char *)H5MM_strdup(prefix))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end else */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_build_vds_prefix() */ +} /* H5D_build_file_prefix() */ /*------------------------------------------------------------------------- @@ -1294,11 +1223,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ - if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) + if(H5D_build_file_prefix(new_dset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &new_dset->shared->extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") /* Set the vds file prefix */ - if(H5D_build_vds_prefix(new_dset, dapl_id, &new_dset->shared->vds_prefix) < 0) + if(H5D_build_file_prefix(new_dset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &new_dset->shared->vds_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") /* Add the dataset to the list of opened objects in the file */ @@ -1454,11 +1383,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") /* Get the external file prefix */ - if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0) + if(H5D_build_file_prefix(dataset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") /* Get the vds prefix */ - if(H5D_build_vds_prefix(dataset, dapl_id, &vds_prefix) < 0) + if(H5D_build_file_prefix(dataset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &vds_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") /* Check if dataset was already open */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 61b4183..4765d00 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -144,7 +144,7 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location + * This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's location * when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) -- cgit v0.12 From 4da73f893ab4df56871e11d82978d21b6b9a6ecb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Dec 2017 14:29:22 -0600 Subject: Add h5dump VDS prefix tests --- tools/test/h5dump/CMakeTestsVDS.cmake | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 3addecf..368471c 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -72,6 +72,14 @@ f-3.h5 vds-eiger.h5 ) + set (HDF5_REFERENCE_PREFIX_VDS + 1_vds.h5 + 2_vds.h5 + 4_vds.h5 + 5_vds.h5 + vds-percival-unlim-maxmin.h5 + vds-eiger.h5 + ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -80,12 +88,21 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () + foreach (vds_h5_file ${HDF5_REFERENCE_PREFIX_VDS}) + get_filename_component(fname "${vds_h5_file}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") + endforeach () foreach (ddl_vds ${HDF5_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () + foreach (ddl_vds ${HDF5_REFERENCE_VDS}) + get_filename_component(fname "${ddl_vds}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") + endforeach () + foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") @@ -134,6 +151,44 @@ endif () endmacro () + macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + if (NOT "${resultcode}" STREQUAL "0") + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_vds_test}" STREQUAL "") + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) + endif () + else () + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP_PREFIX-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5DUMP_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + add_test ( + NAME H5DUMP_PREFIX-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/testfiles/vds/" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS H5DUMP_PREFIX-${resultfile}-clear-objects) + endif () + endmacro () + macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) @@ -261,3 +316,15 @@ 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 () + + # Data read with prefix + if (USE_FILTER_DEFLATE) + ADD_H5_VDS_PREFIX_TEST (tvds-1 0 --enable-error-stack 1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-2 0 --enable-error-stack 2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_PREFIX_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) + ADD_H5_VDS_PREFIX_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_PREFIX_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) + endif () + -- cgit v0.12 From ba714e682047d19fba7ef2c87b072f75ac772e88 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Dec 2017 15:08:04 -0600 Subject: HDFFV-9724 Add H5LS prefix test with ${ORIGIN} --- MANIFEST | 6 ++++ config/cmake_ext_mod/runTest.cmake | 1 + tools/test/h5ls/CMakeTestsVDS.cmake | 55 ++++++++++++++++++++++++++++++++++ tools/test/h5ls/vds_prefix/tvds-1.ls | 14 +++++++++ tools/test/h5ls/vds_prefix/tvds-2.ls | 13 ++++++++ tools/test/h5ls/vds_prefix/tvds-3_1.ls | 14 +++++++++ tools/test/h5ls/vds_prefix/tvds-3_2.ls | 13 ++++++++ tools/test/h5ls/vds_prefix/tvds-4.ls | 9 ++++++ tools/test/h5ls/vds_prefix/tvds-5.ls | 11 +++++++ 9 files changed, 136 insertions(+) create mode 100644 tools/test/h5ls/vds_prefix/tvds-1.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-2.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-3_1.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-3_2.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-4.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-5.ls diff --git a/MANIFEST b/MANIFEST index 9b91c78..c6c7b3c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1430,6 +1430,12 @@ ./tools/test/h5ls/h5ls_plugin.sh.in ./tools/test/h5ls/testh5ls.sh.in ./tools/test/h5ls/testh5lsvds.sh.in +./tools/test/h5ls/vds_prefix/tvds-1.ls +./tools/test/h5ls/vds_prefix/tvds-2.ls +./tools/test/h5ls/vds_prefix/tvds-3_1.ls +./tools/test/h5ls/vds_prefix/tvds-3_2.ls +./tools/test/h5ls/vds_prefix/tvds-4.ls +./tools/test/h5ls/vds_prefix/tvds-5.ls # h5copy sources ./tools/src/h5copy/Makefile.am diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 2479728..5569a73 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -55,6 +55,7 @@ endif () if (TEST_ENV_VAR) set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") + #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") endif () if (NOT TEST_INPUT) diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 5df61bb..f7eb198 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -61,6 +61,17 @@ get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5ls_vds_files") endforeach () + + foreach (listfiles ${LIST_HDF5_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") + endforeach () + + foreach (listfiles ${LIST_OTHER_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5LS_SOURCE_DIR}/vds_prefix/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") + endforeach () + add_custom_target(h5ls_vds_files ALL COMMENT "Copying files needed by h5ls_vds tests" DEPENDS ${h5ls_vds_files_list}) ############################################################################## @@ -104,6 +115,43 @@ endif () endmacro () + macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") + if ("${resultcode}" STREQUAL "1") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else () + add_test ( + NAME H5LS_PREFIX-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") + add_test ( + NAME H5LS_PREFIX-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=vds/prefix/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=vds/prefix/${resultfile}.ls" + -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE=\${ORIGIN}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS H5LS_PREFIX-${resultfile}-clear-objects) + endif () + endmacro () + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -155,3 +203,10 @@ ADD_H5_VDS_TEST (tvds-4 0 -w80 -v -S 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 -w80 -v -S 5_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-1 0 -w80 -v -S vds/prefix/1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-2 0 -w80 -v -S vds/prefix/2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-3_1 0 -w80 -v -S vds/prefix/3_1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-3_2 0 -w80 -v -S vds/prefix/3_2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-4 0 -w80 -v -S vds/prefix/4_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-5 0 -w80 -v -S vds/prefix/5_vds.h5) + diff --git a/tools/test/h5ls/vds_prefix/tvds-1.ls b/tools/test/h5ls/vds_prefix/tvds-1.ls new file mode 100644 index 0000000..2830d1a --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-1.ls @@ -0,0 +1,14 @@ +Opened "vds/prefix/1_vds.h5" with sec2 driver. +vds_dset Dataset {5/Inf, 18/18, 8/8} + Location: 1:800 + Links: 1 + Maps: {6} Source { + 1_a.h5 /source_dset + 1_b.h5 /source_dset + 1_c.h5 /source_dset + 1_d.h5 /source_dset + 1_e.h5 /source_dset + 1_f.h5 /source_dset + } + Storage: 2880 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-2.ls b/tools/test/h5ls/vds_prefix/tvds-2.ls new file mode 100644 index 0000000..5c6f9d3 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-2.ls @@ -0,0 +1,13 @@ +Opened "vds/prefix/2_vds.h5" with sec2 driver. +vds_dset Dataset {6/Inf, 8/8, 14/14} + Location: 1:800 + Links: 1 + Maps: {5} Source { + 2_a.h5 /source_dset + 2_b.h5 /source_dset + 2_c.h5 /source_dset + 2_d.h5 /source_dset + 2_e.h5 /source_dset + } + Storage: 2688 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_1.ls b/tools/test/h5ls/vds_prefix/tvds-3_1.ls new file mode 100644 index 0000000..f4c8e78 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-3_1.ls @@ -0,0 +1,14 @@ +Opened "vds/prefix/3_1_vds.h5" with sec2 driver. +vds_dset Dataset {5/Inf, 25/25, 8/8} + Location: 1:800 + Links: 1 + Maps: {6} Source { + 1_a.h5 /source_dset + 1_b.h5 /source_dset + 1_c.h5 /source_dset + 1_d.h5 /source_dset + 1_e.h5 /source_dset + 1_f.h5 /source_dset + } + Storage: 4000 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_2.ls b/tools/test/h5ls/vds_prefix/tvds-3_2.ls new file mode 100644 index 0000000..5a7e2d8 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-3_2.ls @@ -0,0 +1,13 @@ +Opened "vds/prefix/3_2_vds.h5" with sec2 driver. +vds_dset Dataset {6/Inf, 13/13, 19/19} + Location: 1:800 + Links: 1 + Maps: {5} Source { + 2_a.h5 /source_dset + 2_b.h5 /source_dset + 2_c.h5 /source_dset + 2_d.h5 /source_dset + 2_e.h5 /source_dset + } + Storage: 5928 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-4.ls b/tools/test/h5ls/vds_prefix/tvds-4.ls new file mode 100644 index 0000000..c22d3a4 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-4.ls @@ -0,0 +1,9 @@ +Opened "vds/prefix/4_vds.h5" with sec2 driver. +vds_dset Dataset {9/Inf, 4/4, 4/4} + Location: 1:800 + Links: 1 + Maps: {1} Source { + 4_%b.h5 /source_dset + } + Storage: 576 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-5.ls b/tools/test/h5ls/vds_prefix/tvds-5.ls new file mode 100644 index 0000000..efba8dc --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-5.ls @@ -0,0 +1,11 @@ +Opened "vds/prefix/5_vds.h5" with sec2 driver. +vds_dset Dataset {9/Inf, 4/4, 4/4} + Location: 1:800 + Links: 1 + Maps: {3} Source { + 5_a.h5 /source_dset + 5_b.h5 /source_dset + 5_c.h5 /source_dset + } + Storage: 576 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer -- cgit v0.12 From 65e09afd6c05ab34fde4f8779ca93a822014c8aa Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Dec 2017 15:17:02 -0600 Subject: Add prefix dir to the clear command --- tools/test/h5ls/CMakeTestsVDS.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index f7eb198..f25bd98 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -119,7 +119,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -134,7 +134,7 @@ ${resultfile}.out ${resultfile}.out.err ) - set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") + set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") add_test ( NAME H5LS_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" -- cgit v0.12 From ac8274c3506c106a65dbc9c7a53a6f574ff3379a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 15 Dec 2017 15:32:27 -0600 Subject: HDFFV-9724 Copy efc_open search from Lextern_traverse --- src/H5Dvirtual.c | 230 ++++++++++++++++++++++++++++++++++++++++++++++++++----- src/H5system.c | 2 +- 2 files changed, 212 insertions(+), 20 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e0a4a83..4882e9f 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -763,6 +763,208 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D__virtual_build_name() */ + +/*-------------------------------------------------------------------------- + * Function: H5D_getenv_prefix_name -- + * + * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, + * which is separated by the environment delimiter. + * env_prefix is modified to point to the remaining pathnames + * in the list. + * + * Return: A pointer to a pathname +--------------------------------------------------------------------------*/ +static char * +H5D_getenv_prefix_name(char **env_prefix/*in,out*/) +{ + char *retptr=NULL; + char *strret=NULL; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + strret = HDstrchr(*env_prefix, H5_COLON_SEPC); + if (strret == NULL) { + retptr = *env_prefix; + *env_prefix = strret; + } else { + retptr = *env_prefix; + *env_prefix = strret + 1; + *strret = '\0'; + } + + FUNC_LEAVE_NOAPI(retptr) +} /* end H5D_getenv_prefix_name() */ + +/*------------------------------------------------------------------------- + * Function: H5D__virtual_open_file + * + * Purpose: Attempts to open a source dataset file. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +static H5F_t * +H5D__virtual_open_file(H5P_genplist_t *plist, const H5F_t *vdset_file, + const char *file_name, + hid_t fapl_id, hid_t dxpl_id) +{ + H5F_t *src_file = NULL; /* Source file */ + H5F_t *ret_value = NULL; /* Actual return value */ + char *full_name = NULL; /* File name with prefix */ + char *my_prefix; /* Library's copy of the prefix */ + unsigned intent; /* File access permissions */ + char *actual_file_name = NULL; /* Virtual file's actual name */ + char *temp_file_name = NULL; /* Temporary pointer to file name */ + size_t temp_file_name_len; /* Length of temporary file name */ + + FUNC_ENTER_STATIC + + /* Simplify intent flags for open calls */ + intent = H5F_INTENT(vdset_file); + intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); + + /* Copy the file name to use */ + if(NULL == (temp_file_name = H5MM_strdup(file_name))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + temp_file_name_len = HDstrlen(temp_file_name); + + /* target file_name is an absolute pathname: see RM for detailed description */ + if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { + /* Try opening file */ + if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { + char *ptr; + + H5E_clear_stack(NULL); + + /* get last component of file_name */ + H5_GET_LAST_DELIMITER(file_name, ptr) + HDassert(ptr); + + /* Increment past delimiter */ + ptr++; + + /* Copy into the temp. file name */ + HDstrncpy(temp_file_name, ptr, temp_file_name_len); + temp_file_name[temp_file_name_len - 1] = '\0'; + } /* end if */ + } /* end if */ + else if(H5_CHECK_ABS_DRIVE(file_name)) { + /* Try opening file */ + if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { + + H5E_clear_stack(NULL); + + /* strip ":" */ + HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len); + temp_file_name[temp_file_name_len - 1] = '\0'; + } /* end if */ + } /* end if */ + + /* try searching from paths set in the environment variable */ + if(src_file == NULL) { + char *env_prefix; + + if(NULL != (env_prefix = HDgetenv("HDF5_VDS_PREFIX"))) { + char *tmp_env_prefix, *saved_env; + + if(NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + while((tmp_env_prefix) && (*tmp_env_prefix)) { + char *out_prefix_name; + + out_prefix_name = H5D_getenv_prefix_name(&tmp_env_prefix/*in,out*/); + if(out_prefix_name && (*out_prefix_name)) { + if(H5D__virtual_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { + saved_env = (char *)H5MM_xfree(saved_env); + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + } /* end if */ + + src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id); + full_name = (char *)H5MM_xfree(full_name); + if(src_file != NULL) + break; + H5E_clear_stack(NULL); + } /* end if */ + } /* end while */ + saved_env = (char *)H5MM_xfree(saved_env); + } /* end if */ + } /* end if */ + + /* try searching from property list */ + if(src_file == NULL) { + size_t size = 0; + if((size = H5Pget_virtual_prefix(plist, NULL, 0)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vds prefix") + /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ + if(NULL == (my_prefix = (char *)H5MM_malloc(size + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate prefix buffer") + if(H5Pget_virtual_prefix(plist, my_prefix, size+1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vds prefix") + if(my_prefix) { + if(H5D__virtual_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + full_name = (char *)H5MM_xfree(full_name); + } /* end if */ + } /* end if */ + + /* try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ + if(src_file == NULL) { + char *vdspath; + + if(NULL != (vdspath = H5F_EXTPATH(vdset_file))) { + if(H5D__virtual_build_name(vdspath, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + full_name = (char *)H5MM_xfree(full_name); + } /* end if */ + } /* end if */ + + /* try the relative file_name stored in temp_file_name */ + if(src_file == NULL) { + if(NULL == (src_file = H5F_open(temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + } /* end if */ + + /* try the 'resolved' name for the virtual file */ + if(src_file == NULL) { + char *ptr = NULL; + + /* Copy resolved file name */ + if(NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(vdset_file)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string") + + /* get last component of file_name */ + H5_GET_LAST_DELIMITER(actual_file_name, ptr) + if(!ptr) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) + + /* Truncate filename portion from actual file name path */ + *ptr = '\0'; + + /* Build new file name for the external file */ + if(H5D__virtual_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + + /* Try opening with the resolved name */ + if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) + full_name = (char *)H5MM_xfree(full_name); + } /* end if */ + + /* Success */ + ret_value = src_file; +done: + if((NULL == ret_value) && src_file) + if(H5F_try_close(src_file, NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "can't close source file") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__virtual_open_file() */ + /*------------------------------------------------------------------------- * Function: H5D__virtual_open_source_dset @@ -787,6 +989,8 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5G_loc_t src_root_loc; /* Object location of source file root group */ herr_t ret_value = SUCCEED; /* Return value */ char *full_name = NULL; /* File name with prefix */ + unsigned intent; /* File access permissions */ + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER_STATIC @@ -796,27 +1000,15 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, HDassert(!source_dset->dset); HDassert(source_dset->file_name); HDassert(source_dset->dset_name); - vds_prefix = vdset->shared->vds_prefix; /* Check if we need to open the source file */ if(HDstrcmp(source_dset->file_name, ".")) { - if(vds_prefix && HDstrlen(vds_prefix) > 0) { - if(H5D__virtual_build_name(vds_prefix, source_dset->file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") - /* Open the source file */ - if(NULL == (src_file = H5F_open(full_name, H5F_INTENT(vdset->oloc.file) & (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ), H5P_FILE_CREATE_DEFAULT, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) - H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ - else - src_file_open = TRUE; - full_name = (char *)H5MM_xfree(full_name); - } - else { - /* Open the source file */ - if(NULL == (src_file = H5F_open(source_dset->file_name, H5F_INTENT(vdset->oloc.file) & (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ), H5P_FILE_CREATE_DEFAULT, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) - H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ - else - src_file_open = TRUE; - } + if((plist = H5D_get_access_plist(vdset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist") + if(NULL == (src_file = H5D__virtual_open_file(plist, vdset->oloc.file, source_dset->file_name, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) + H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ + else + src_file_open = TRUE; } /* end if */ else /* Source file is ".", use the virtual dataset's file */ @@ -2312,7 +2504,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, /* Check if anything is selected */ if(select_nelmts > (hssize_t)0) { /* Open source dataset */ - if(!storage->list[i].source_dset.dset) + if(!storage->list[i].source_dset.dset) /* Try to open dataset */ if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") diff --git a/src/H5system.c b/src/H5system.c index a8726c2..7b3a0eb 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1043,7 +1043,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) * Unix: does not apply */ if(H5_CHECK_ABS_DRIVE(name)) { - drive = name[0] - 'A' + 1; + drive = toupper(name[0]) - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); HDstrncpy(new_name, &name[2], name_len); } /* end if */ -- cgit v0.12 From 8444f018ca115dcf8b1066b9dbad69b0617c0e58 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 19 Dec 2017 14:58:17 -0600 Subject: HDFFV-9724 Add ENV VAR to vds test --- test/CMakeTests.cmake | 2 +- test/vds.c | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+), 1 deletion(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 973d389..e0acc6d 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -452,7 +452,6 @@ set (test_CLEANFILES extlinks19B00026.h5 extlinks19B00027.h5 extlinks19B00028.h5 - tmp big.data big*.h5 stdio.h5 @@ -582,6 +581,7 @@ set (test_CLEANFILES cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 + tmp/vds_src_2.h5 ) # Remove any output file left over from previous test run diff --git a/test/vds.c b/test/vds.c index 3485023..66de456 100644 --- a/test/vds.c +++ b/test/vds.c @@ -1376,6 +1376,193 @@ test_vds_prefix(unsigned config, hid_t fapl) if(H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; + if(H5Pclose(dapl) < 0) + TEST_ERROR + dapl = -1; + if(H5Pclose(dcpl) < 0) + TEST_ERROR + dcpl = -1; + + /* + * Test 2: All - all selection with ENV prefix + */ + if(HDsetenv("HDF5_VDS_PREFIX", "${ORIGIN}/tmp", 1)) + TEST_ERROR + + /* Create DCPL */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + /* Set fill value */ + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + TEST_ERROR + + /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + TEST_ERROR + + if(H5Pset_virtual_prefix(dapl, "someprefix") < 0) + TEST_ERROR + if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) + TEST_ERROR + + if(HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("vds prefix not set correctly"); + + /* Create source dataspace */ + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspace */ + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all (should not be necessary, but just to be sure) */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + if(H5Sselect_all(vspace[0]) < 0) + TEST_ERROR + + /* Add virtual layout mapping */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) + TEST_ERROR + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } /* end if */ + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } /* end if */ + + /* Create source dataset */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + TEST_ERROR + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Write data directly to source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Close srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + + if(config & TEST_IO_DIFFERENT_FILE) { + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } /* end if */ + } /* end if */ + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + TEST_ERROR + } /* end if */ + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) { + TEST_ERROR + } + } + + /* Adjust write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); + + /* Write data through virtual dataset */ + if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Reopen srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } /* end if */ + + /* Read data directly from source dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) + TEST_ERROR + + /* Close */ + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Pclose(dapl) < 0) + TEST_ERROR + dapl = -1; + if(H5Pclose(dcpl) < 0) + TEST_ERROR + dcpl = -1; + + if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) + TEST_ERROR PASSED(); return 0; @@ -1410,6 +1597,9 @@ test_vds_prefix(unsigned config, hid_t fapl) (void)H5Pclose(dcpl); } H5E_END_TRY; + if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) + TEST_ERROR + return 1; } /* end vds_link_prefix() */ -- cgit v0.12 From 6cbb336ca753118a8413feb928627cb3a33a227f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 19 Dec 2017 15:47:05 -0600 Subject: Skip test if 1.6 API --- test/CMakeTests.cmake | 74 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index e0acc6d..fca2f27 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -839,21 +839,28 @@ add_test (NAME H5TEST-clear-error_test-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" -) -set_tests_properties (H5TEST-error_test PROPERTIES - DEPENDS H5TEST-clear-error_test-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) +if (HDF5_USE_16_API_DEFAULT) + add_test ( + NAME H5TEST-error_test-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" + ) +else () + add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-error_test PROPERTIES + DEPENDS H5TEST-clear-error_test-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +endif () #-- Adding test for links_env add_test (NAME H5TEST-clear-links_env-objects @@ -959,21 +966,28 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-error_test PROPERTIES - DEPENDS H5TEST-shared-clear-error_test-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) + if (HDF5_USE_16_API_DEFAULT) + add_test ( + NAME H5TEST-shared-error_test-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" + ) + else () + add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-shared-error_test PROPERTIES + DEPENDS H5TEST-shared-clear-error_test-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + endif () #-- Adding test for links_env add_test (NAME H5TEST-shared-clear-links_env-objects -- cgit v0.12 From 0065fd4b6d5edf61b21cd352c74268de13fd516a Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Tue, 19 Dec 2017 16:47:31 -0600 Subject: Fix -- HDFFV-10363 Fortran compilation fails for xlf and cmake builds --- fortran/src/CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 0f576d4..18d6d80 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -95,6 +95,18 @@ add_custom_command ( ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +if (BUILD_SHARED_LIBS) + set (CMDSH $) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 + COMMAND ${CMDSH} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared + DEPENDS H5match_types + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h PROPERTIES GENERATED TRUE) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +endif () #----------------------------------------------------------------------------- # f90CStub lib @@ -223,7 +235,7 @@ set (f90_F_SOURCES if (BUILD_SHARED_LIBS) set (f90_F_SOURCES_SHARED # generated file - ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 + ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 ${f90_F_BASE_SOURCES} @@ -243,6 +255,7 @@ set (SHARED_LINK_FLAGS " ") TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET}) target_link_libraries (${HDF5_F90_LIB_TARGET} PRIVATE ${LINK_Fortran_LIBS}) +target_include_directories (${HDF5_F90_LIB_TARGET} PUBLIC ${CMAKE_Fortran_MODULE_DIRECTORY}/static) if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_include_directories (${HDF5_F90_LIB_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS}) endif () @@ -271,6 +284,7 @@ if (BUILD_SHARED_LIBS) TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) target_link_libraries (${HDF5_F90_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET}) target_link_libraries (${HDF5_F90_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS}) + target_include_directories (${HDF5_F90_LIBSH_TARGET} PUBLIC ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_include_directories (${HDF5_F90_LIBSH_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS}) endif () -- cgit v0.12 From 94b8a212bfba2ad7a7740c8a22e0e5d96d05e4ec Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Dec 2017 10:57:41 -0600 Subject: Cleanup comments and if() in TRY blocks --- test/vds.c | 1105 +++++++++++++++++++++++++++--------------------------------- 1 file changed, 497 insertions(+), 608 deletions(-) diff --git a/test/vds.c b/test/vds.c index 66de456..eca26bc 100644 --- a/test/vds.c +++ b/test/vds.c @@ -65,14 +65,7 @@ const char *FILENAME[] = { * provided dataspaces are the same. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Neil Fortner - * Monday, March 2, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -138,7 +131,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } /* end if */ + } /* Free buffers */ HDfree(buf1); @@ -188,7 +181,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } /* end if */ + } /* Free buffers */ HDfree(buf1); @@ -225,14 +218,7 @@ error: * parameters. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Neil Fortner - * Monday, March 2, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -306,8 +292,7 @@ vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, error: H5E_BEGIN_TRY { - if(space_out >= 0) - (void)H5Sclose(space_out); + H5Sclose(space_out); } H5E_END_TRY return -1; @@ -320,14 +305,7 @@ error: * Purpose: Tests API functions related to virtual datasets. * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Monday, February 16, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ /* Helper function to get DCPL for examination depending on config */ @@ -378,12 +356,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, file = -1; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } /* Open dataset */ if((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get DCPL from dataset */ if((*ex_dcpl = H5Dget_create_plist(dset)) < 0) @@ -402,8 +380,8 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(oinfo.meta_size.obj.heap_size != exp_meta_size) { printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR - } /* end if */ - } /* end if */ + } + } else if((oinfo.meta_size.obj.heap_size != exp_meta_size) && (oinfo.meta_size.obj.heap_size != (hsize_t)0)) @@ -432,12 +410,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(H5Fclose(file) < 0) TEST_ERROR file = -1; - } /* end if */ + } else if(config == TEST_API_COPY_PLIST) { /* Copy property list */ if((*ex_dcpl = H5Pcopy(dcpl)) < 0) TEST_ERROR - } /* end if */ + } else if(config == TEST_API_ENCDEC_PLIST) { size_t plist_buf_size; @@ -456,14 +434,14 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, /* Free plist_buf */ HDfree(plist_buf); plist_buf = NULL; - } /* end if */ + } else { /* Simply copy the id to ex_dcpl and increment the ref count so ex_dcpl * can be closed */ if(H5Iinc_ref(dcpl) < 0) TEST_ERROR *ex_dcpl = dcpl; - } /* end else */ + } /* Verify examination DCPL is equal to original DCPL. Do not compare the * plist to itself, and do not do the comparison if we reopened the file, @@ -474,16 +452,14 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(!tri_ret) TEST_ERROR - } /* end if */ + } return 0; error: H5E_BEGIN_TRY { - if(file >= 0) - (void)H5Fclose(file); - if(dset >= 0) - (void)H5Dclose(dset); + H5Fclose(file); + H5Dclose(dset); } H5E_END_TRY; if(plist_buf) HDfree(plist_buf); @@ -540,7 +516,7 @@ test_api(test_api_config_t config, hid_t fapl) case TEST_API_NTESTS: default: TEST_ERROR - } /* end switch */ + } h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -826,7 +802,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Create virtual dataspace */ if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - } /* end for */ + } /* Select all (should not be necessary, but just to be sure) */ if(H5Sselect_all(srcspace[0]) < 0) @@ -940,7 +916,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } /* end for */ + } if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1046,7 +1022,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Add virtual layout mapping */ if(H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0) TEST_ERROR - } /* end if */ + } /* Get examination DCPL */ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)697) < 0) @@ -1071,7 +1047,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Check that the mapping in the DCPL is correct */ if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0) TEST_ERROR - } /* end if */ + } /* Close */ if(H5Sclose(srcspace[0]) < 0) @@ -1081,7 +1057,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } /* end for */ + } if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1131,18 +1107,12 @@ test_api(test_api_config_t config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(dcpl >= 0) - (void)H5Pclose(dcpl); - if(ex_dcpl >= 0) - (void)H5Pclose(ex_dcpl); + for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Pclose(dcpl); + H5Pclose(ex_dcpl); } H5E_END_TRY; return 1; @@ -1260,12 +1230,12 @@ test_vds_prefix(unsigned config, hid_t fapl) if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR HDchdir(buffer); - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1294,8 +1264,8 @@ test_vds_prefix(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1309,7 +1279,7 @@ test_vds_prefix(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1344,7 +1314,7 @@ test_vds_prefix(unsigned config, hid_t fapl) } if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1438,12 +1408,12 @@ test_vds_prefix(unsigned config, hid_t fapl) if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR HDchdir(buffer); - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1472,8 +1442,8 @@ test_vds_prefix(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1487,7 +1457,7 @@ test_vds_prefix(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1522,7 +1492,7 @@ test_vds_prefix(unsigned config, hid_t fapl) } if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1569,32 +1539,19 @@ test_vds_prefix(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { - if(srcfile[i] >= 0) - (void)H5Fclose(srcfile[i]); - } /* end for */ - if(vfile >= 0) - (void)H5Fclose(vfile); - if(vfile2 >= 0) - (void)H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + H5Fclose(vfile2); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(memspace); + H5Pclose(dcpl); } H5E_END_TRY; if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) @@ -1611,14 +1568,7 @@ test_vds_prefix(unsigned config, hid_t fapl) * pattern-matching file/dataset strings * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Tuesday, March 3, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1701,12 +1651,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1735,8 +1685,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1750,7 +1700,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1779,7 +1729,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1863,12 +1813,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1904,8 +1854,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1919,7 +1869,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1950,7 +1900,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1999,8 +1949,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2009,7 +1959,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } /* Open v_dset2 */ if((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0) @@ -2035,7 +1985,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Only copy to a different file if the source datasets are in a different * file */ @@ -2077,8 +2027,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen copied virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2087,7 +2037,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile2 = -1; if((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } /* Open v_dset3 */ if((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0) @@ -2113,13 +2063,13 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Close copied virtual file */ if(H5Fclose(vfile2) < 0) TEST_ERROR vfile2 = -1; - } /* end if */ + } /* Close */ if(H5Dclose(srcdset[0]) < 0) @@ -2198,12 +2148,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2245,8 +2195,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2260,7 +2210,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2291,7 +2241,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2386,12 +2336,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2427,8 +2377,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2442,7 +2392,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read first source dataset through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2495,7 +2445,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2594,12 +2544,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2627,7 +2577,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i][j] = buf[2 * i][j]; for(/* j = 13 */; j < 26; j++) evbuf[i][j] = buf[2 * i + 1][j - 13]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2644,7 +2594,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i + 5][j] = buf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) evbuf[i + 5][j] = buf[2 * i + 1][j]; - } /* end for */ + } /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2659,8 +2609,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2674,7 +2624,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -2690,7 +2640,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i][j] = evbuf[2 * i][j]; for(/* j = 13 */; j < 26; j++) erbuf[i][j] = evbuf[2 * i + 1][j - 13]; - } /* end for */ + } /* Read second slice */ if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2702,7 +2652,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i + 5][j] = evbuf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) erbuf[i + 5][j] = evbuf[2 * i + 1][j]; - } /* end for */ + } /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2726,7 +2676,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j] = buf[i][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j - 13] = buf[i][j]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2743,7 +2693,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j + 13] = buf[i + 5][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j] = buf[i + 5][j]; - } /* end for */ + } /* Reopen srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2754,7 +2704,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ /* Reset rbuf */ @@ -2770,7 +2720,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j] = evbuf[i][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j - 13] = evbuf[i][j]; - } /* end for */ + } /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2782,7 +2732,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j + 13] = evbuf[i + 5][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j] = evbuf[i + 5][j]; - } /* end for */ + } /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2902,12 +2852,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2961,8 +2911,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2976,7 +2926,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -3001,7 +2951,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } /* end for */ + } /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -3047,7 +2997,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ /* Reset rbuf */ @@ -3068,7 +3018,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } /* end for */ + } /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) @@ -3243,12 +3193,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -3285,8 +3235,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3300,7 +3250,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ /* Reset rbuf */ @@ -3406,7 +3356,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 3) && (j < 6)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -3459,7 +3409,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 6) && (j < 9)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -3677,7 +3627,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source dataset */ /* Select hyperslab in memory space */ @@ -3752,32 +3702,19 @@ test_basic_io(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { - if(srcfile[i] >= 0) - (void)H5Fclose(srcfile[i]); - } /* end for */ - if(vfile >= 0) - (void)H5Fclose(vfile); - if(vfile2 >= 0) - (void)H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + H5Fclose(vfile2); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(memspace); + H5Pclose(dcpl); } H5E_END_TRY; return 1; @@ -3790,14 +3727,7 @@ error: * Purpose: Tests VDS with unlimited selections * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Thursday, April 30, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -3910,12 +3840,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -3980,8 +3910,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3995,7 +3925,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4040,11 +3970,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Test H5Pget_virtual_view() */ if(H5Pget_virtual_view(dapl, &virtual_view) < 0) @@ -4064,7 +3994,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4112,11 +4042,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4125,7 +4055,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[0] = 5; @@ -4162,8 +4092,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4177,7 +4107,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4224,11 +4154,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -4242,7 +4172,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4295,11 +4225,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4308,7 +4238,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 5; @@ -4350,8 +4280,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4365,7 +4295,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4427,7 +4357,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -4492,11 +4422,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Shrink to 15 */ dims[1] = 15; @@ -4523,12 +4453,12 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end if */ + } + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4542,7 +4472,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4590,11 +4520,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -4629,11 +4559,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try setting extent manually */ /* Grow to 18 */ @@ -4661,11 +4591,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Grow to 20 */ dims[1] = 20; @@ -4691,7 +4621,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < (int)mdims[1]; j++) if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -4704,12 +4634,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -4785,12 +4715,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -4855,8 +4785,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4870,7 +4800,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4914,11 +4844,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4932,7 +4862,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4974,11 +4904,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4987,7 +4917,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[1] = 7; @@ -5029,8 +4959,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5044,7 +4974,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5090,11 +5020,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5108,7 +5038,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5159,11 +5089,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5172,7 +5102,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[1] = 10; @@ -5214,8 +5144,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5229,7 +5159,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5291,7 +5221,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -5308,7 +5238,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5360,11 +5290,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -5377,12 +5307,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -5477,12 +5407,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -5522,7 +5452,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][6 * j] = buf[i][2 * j]; erbuf[i][(6 * j) + 1] = buf[i][(2 * j) + 1]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5538,7 +5468,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][(6 * j) + 2] = buf[i][2 * j]; erbuf[i][(6 * j) + 3] = buf[i][(2 * j) + 1]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5559,7 +5489,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][4] = buf[i][0]; erbuf[i][5] = buf[i][1]; - } /* end for */ + } /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5577,8 +5507,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5592,7 +5522,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5636,11 +5566,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -5654,7 +5584,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5696,11 +5626,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5709,7 +5639,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[1] = 7; @@ -5746,8 +5676,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5761,7 +5691,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5806,11 +5736,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5824,7 +5754,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5834,7 +5764,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][12] = buf[i][0]; erbuf[i][13] = buf[i][1]; erbuf[i][18] = buf[i][2]; - } /* end for */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5878,11 +5808,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5891,7 +5821,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[2] */ dims[1] = 5; @@ -5923,7 +5853,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][10] = buf[i][0]; erbuf[i][11] = buf[i][1]; erbuf[i][16] = buf[i][2]; - } /* end for */ + } /* Close srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5935,8 +5865,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5950,7 +5880,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5995,11 +5925,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -6013,7 +5943,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6059,11 +5989,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6072,7 +6002,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[1] = 6; @@ -6103,7 +6033,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][14] = buf[i][0]; erbuf[i][15] = buf[i][1]; - } /* end for */ + } /* Close srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6115,8 +6045,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6130,7 +6060,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6174,11 +6104,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -6192,7 +6122,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6234,11 +6164,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now just read middle 2 rows */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -6264,11 +6194,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -6287,12 +6217,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -6373,12 +6303,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -6431,8 +6361,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6446,7 +6376,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6492,11 +6422,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -6510,7 +6440,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6552,11 +6482,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6565,7 +6495,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[0] = 5; @@ -6603,8 +6533,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6618,7 +6548,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6664,11 +6594,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -6682,7 +6612,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6730,11 +6660,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -6747,12 +6677,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -6795,23 +6725,23 @@ error: for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { if(srcdset[i] >= 0) (void)H5Dclose(srcdset[i]); - } /* end for */ + } if(vdset >= 0) (void)H5Dclose(vdset); for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { if(srcfile[i] >= 0) (void)H5Fclose(srcfile[i]); - } /* end for */ + } if(vfile >= 0) (void)H5Fclose(vfile); for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { if(srcspace[i] >= 0) (void)H5Sclose(srcspace[i]); - } /* end for */ + } for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { if(vspace[i] >= 0) (void)H5Sclose(vspace[i]); - } /* end for */ + } if(filespace >= 0) (void)H5Sclose(filespace); if(memspace >= 0) @@ -6948,12 +6878,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -6965,7 +6895,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6979,7 +6909,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7065,8 +6995,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7080,7 +7010,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7124,11 +7054,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -7165,8 +7095,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7180,7 +7110,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7220,11 +7150,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try with different selections */ count[0] = 10; @@ -7251,12 +7181,12 @@ test_printf(unsigned config, hid_t fapl) if((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end for */ + } + } start[1] = 0; /* Now try writing through VDS */ @@ -7292,7 +7222,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read srcdset[0] */ count[0] = 10; @@ -7394,12 +7324,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -7411,7 +7341,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7425,7 +7355,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7563,14 +7493,14 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7584,7 +7514,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7628,11 +7558,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Test H5Pget_virtual_printf_gap() */ if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) @@ -7652,7 +7582,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7704,11 +7634,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 2, reopen file as well if * config option specified */ @@ -7722,7 +7652,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7774,11 +7704,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 3, reopen file as well if * config option specified */ @@ -7792,7 +7722,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7844,11 +7774,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 4, reopen file as well if * config option specified */ @@ -7862,7 +7792,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7914,11 +7844,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -7932,7 +7862,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7978,11 +7908,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -7996,16 +7926,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8078,7 +8008,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8144,7 +8074,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8158,7 +8088,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8202,11 +8132,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -8241,7 +8171,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8255,7 +8185,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8299,11 +8229,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -8319,7 +8249,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8389,7 +8319,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8455,7 +8385,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8469,7 +8399,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8513,11 +8443,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -8552,7 +8482,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8566,7 +8496,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8610,11 +8540,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -8630,7 +8560,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8643,7 +8573,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - } /* end if */ + } /* @@ -8701,12 +8631,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -8718,7 +8648,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8732,7 +8662,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8818,8 +8748,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8833,7 +8763,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8877,11 +8807,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -8917,8 +8847,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8932,7 +8862,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8976,11 +8906,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -8994,7 +8924,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9041,11 +8971,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9081,8 +9011,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9096,7 +9026,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9140,11 +9070,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -9158,7 +9088,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9205,11 +9135,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf_gap set to 1, reopen file as well if * config option specified */ @@ -9223,7 +9153,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9270,11 +9200,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -9288,16 +9218,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -9373,12 +9303,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -9390,7 +9320,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9404,7 +9334,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9500,8 +9430,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9515,7 +9445,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9559,11 +9489,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -9577,7 +9507,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9624,11 +9554,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9668,8 +9598,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9683,7 +9613,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9727,11 +9657,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -9745,7 +9675,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9791,11 +9721,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9832,8 +9762,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9847,7 +9777,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9891,11 +9821,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -9929,11 +9859,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try setting extent manually */ /* Shrink to 12 */ @@ -9959,11 +9889,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Shrink to 10 */ dims[1] = 12; @@ -9988,12 +9918,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end if */ + } + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -10007,7 +9937,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -10053,11 +9983,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -10091,11 +10021,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try setting extent manually */ /* Grow to 12 */ @@ -10121,11 +10051,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Grow to 15 */ dims[1] = 15; @@ -10150,12 +10080,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end if */ + } + } /* Reset dapl */ if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) @@ -10167,16 +10097,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -10233,12 +10163,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -10250,7 +10180,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10264,7 +10194,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10330,8 +10260,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10345,7 +10275,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10389,11 +10319,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 127, reopen file as well if * config option specified */ @@ -10407,7 +10337,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -10453,11 +10383,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -10471,12 +10401,12 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -10507,32 +10437,19 @@ test_printf(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { - if(srcfile[i] >= 0) - (void)H5Fclose(srcfile[i]); - } /* end for */ - if(vfile >= 0) - (void)H5Fclose(vfile); - if(srcspace >= 0) - (void)H5Sclose(srcspace); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(filespace >= 0) - (void)H5Sclose(filespace); - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); - if(dapl >= 0) - (void)H5Pclose(dapl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + H5Sclose(srcspace); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(filespace); + H5Sclose(memspace); + H5Pclose(dcpl); + H5Pclose(dapl); } H5E_END_TRY; return 1; @@ -10546,14 +10463,7 @@ error: * VDS * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Friday, August 14, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -10675,12 +10585,12 @@ test_all(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile = vfile; if(H5Iinc_ref(srcfile) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -10692,7 +10602,7 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10706,7 +10616,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10777,14 +10687,14 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10798,7 +10708,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10844,11 +10754,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10857,7 +10767,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 2; @@ -10892,8 +10802,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10907,7 +10817,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10953,11 +10863,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -10997,8 +10907,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11012,7 +10922,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11058,11 +10968,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -11071,7 +10981,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 3; @@ -11115,8 +11025,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11130,7 +11040,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11176,11 +11086,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -11220,8 +11130,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11235,7 +11145,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11281,11 +11191,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -11294,7 +11204,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 7; @@ -11339,8 +11249,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11354,7 +11264,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11400,11 +11310,11 @@ test_all(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -11444,8 +11354,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11459,7 +11369,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11511,16 +11421,16 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -11531,12 +11441,12 @@ test_all(unsigned config, hid_t fapl) if(H5Sclose(srcspace[i]) < 0) TEST_ERROR srcspace[i] = -1; - } /* end for */ + } for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } /* end for */ + } if(H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; @@ -11552,32 +11462,19 @@ test_all(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - if(srcfile >= 0) - (void)H5Fclose(srcfile); - if(vfile >= 0) - (void)H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(filespace >= 0) - (void)H5Sclose(filespace); - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); - if(srcdcpl >= 0) - (void)H5Pclose(srcdcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + H5Fclose(srcfile); + H5Fclose(vfile); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(filespace); + H5Sclose(memspace); + H5Pclose(dcpl); + H5Pclose(srcdcpl); } H5E_END_TRY; return 1; @@ -11591,10 +11488,6 @@ error: * * Return: Success: 0 * Failure: 1 - * - * Programmer: Dana Robinson - * March 2016 - * *------------------------------------------------------------------------- */ static int @@ -11736,10 +11629,6 @@ test_dapl_values(hid_t fapl_id) * Purpose: Tests datasets with virtual layout * * Return: EXIT_SUCCESS/EXIT_FAILURE - * - * Programmer: Neil Fortner - * Tuesday, February 17, 2015 - * *------------------------------------------------------------------------- */ int @@ -11766,7 +11655,7 @@ main(void) nerrors += test_unlim(bit_config, fapl); nerrors += test_printf(bit_config, fapl); nerrors += test_all(bit_config, fapl); - } /* end for */ + } nerrors += test_dapl_values(fapl); -- cgit v0.12 From 925f3c9b54368005da0129d5928142f04f53ef57 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Dec 2017 13:10:34 -0600 Subject: Because of MPI requirements in library ALWAYS add include path --- CMakeLists.txt | 1 + config/cmake_ext_mod/FindMPI.cmake | 287 ++++++++++++++++++++++--------------- src/CMakeLists.txt | 12 -- 3 files changed, 171 insertions(+), 129 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e22ac2e..6165b35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -631,6 +631,7 @@ if (HDF5_ENABLE_PARALLEL) # Used by Fortran + MPI CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) + INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_DIRS}) else () message (STATUS "Parallel libraries not found") endif () diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake index 8084472..d01dd35 100644 --- a/config/cmake_ext_mod/FindMPI.cmake +++ b/config/cmake_ext_mod/FindMPI.cmake @@ -347,7 +347,7 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) # library that has invalid or missing version information there would be warning # messages emitted by ld.so in the compiler output. In either case, we'll treat # the output as invalid. - if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") + if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found") set(WRAPPER_RETURN 255) endif() # Ensure that no error output might be passed upwards. @@ -615,6 +615,16 @@ function (_MPI_interrogate_compiler lang) endif() endif() + if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") + endif() + if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_EXTRA_LIB_NAMES) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") + endif() + # If we found MPI, set up all of the appropriate cache entries if(NOT MPI_${LANG}_COMPILE_OPTIONS) set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) @@ -823,33 +833,43 @@ endfunction() macro(_MPI_assemble_libraries LANG) set(MPI_${LANG}_LIBRARIES "") - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() + # Only for libraries do we need to check whether the compiler's linking stage is separate. + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() + endif() endmacro() macro(_MPI_assemble_include_dirs LANG) - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_${LANG}_INCLUDE_DIRS "") + else() + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + endif() endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") + endforeach() endif() endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}") - endforeach() - endif() endmacro() function(_MPI_split_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + return() + endif() # Backwards compatibility: Search INCLUDE_PATH if given. if(MPI_${LANG}_INCLUDE_PATH) list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") @@ -885,6 +905,13 @@ function(_MPI_split_include_dirs LANG) endif() mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) endif() + # Remove duplicates and default system directories from the list. + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) + endforeach() + endif() set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) endfunction() @@ -1014,7 +1041,7 @@ elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") # FreeBSD ships mpich under the normal system paths - but available openmpi implementations # will be found in /usr/local/mpi/ - MPI_search_mpi_prefix_folder("/usr/local/mpi/") + MPI_search_mpi_prefix_folder("/usr/local/mpi") endif() # Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. @@ -1050,48 +1077,54 @@ mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXE # # Once we find the new variables, we translate them back into their old # equivalents below. -foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Chop the old compile flags into options and definitions - if(MPI_${LANG}_COMPILE_FLAGS) - unset(MPI_${LANG}_COMPILE_OPTIONS) - unset(MPI_${LANG}_COMPILE_DEFINITIONS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}") +if(NOT MPI_IGNORE_LEGACY_VARIABLES) + foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") endif() endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - # If a list of libraries was given, we'll split it into new-style cache variables - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - endif() -endforeach() + # Chop the old compile flags into options and definitions + + unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + if(MPI_${LANG}_COMPILE_FLAGS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") + endif() + endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() + + # If a list of libraries was given, we'll split it into new-style cache variables + unset(MPI_${LANG}_EXTRA_LIB_NAMES) + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + if(_MPI_LIB) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endif() + endforeach() + endif() + endforeach() +endif() #============================================================================= unset(MPI_VERSION) @@ -1100,6 +1133,11 @@ unset(MPI_VERSION_MINOR) unset(_MPI_MIN_VERSION) +# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. +if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) +endif() + # This loop finds the compilers and sends them off for interrogation. foreach(LANG IN ITEMS C CXX Fortran) if(CMAKE_${LANG}_COMPILER_LOADED) @@ -1121,6 +1159,8 @@ foreach(LANG IN ITEMS C CXX Fortran) mark_as_advanced(MPI_CXX_SKIP_MPICXX) endif() if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) + set(MPI_${LANG}_TRIED_IMPLICIT FALSE) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. # Cray PrgEnv. @@ -1130,80 +1170,90 @@ foreach(LANG IN ITEMS C CXX Fortran) # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. if(MPI_${LANG}_WORKS) set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) endif() + set(MPI_${LANG}_TRIED_IMPLICIT TRUE) endif() - # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. - if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) - endif() - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) + endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + endif() + + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH + DOC "MPI compiler for ${LANG}" + ) endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - else() - set(MPI_PINNED_COMPILER FALSE) - endif() - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. find_program(MPI_${LANG}_COMPILER NAMES ${_MPI_${LANG}_COMPILER_NAMES} PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH DOC "MPI compiler for ${LANG}" ) - endif() - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - DOC "MPI compiler for ${LANG}" - ) - - if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_SKIP_GUESSING TRUE) - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_PINNED_COMPILER TRUE) + + # If we haven't made the implicit compiler test yet, perform it now. + if(NOT MPI_${LANG}_TRIED_IMPLICIT) + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + endif() + + # Should the MPI compiler not work implicitly for MPI, still interrogate it. + # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used + # directly during linkage instead of CMAKE__COMPILER will not work. + if(NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + endif() endif() - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - endif() - if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - set(MPI_${LANG}_WRAPPER_FOUND TRUE) - elseif(NOT MPI_SKIP_GUESSING) - _MPI_guess_settings(${LANG}) + if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + else() + _MPI_guess_settings(${LANG}) + endif() endif() endif() endif() _MPI_split_include_dirs(${LANG}) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - endif() + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + _MPI_adjust_compile_definitions(${LANG}) # We always create imported targets even if they're empty _MPI_create_imported_target(${LANG}) @@ -1217,7 +1267,9 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + endif() mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) @@ -1337,7 +1389,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) unset(MPI_${LANG}_REQUIRED_VARS) - if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND) + if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") endforeach() @@ -1448,6 +1500,7 @@ if (MPI_NUMLIBS GREATER 1) else() set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") endif() +set(MPI_IGNORE_LEGACY_VARIABLES TRUE) #============================================================================= # unset these vars to cleanup namespace diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1d217c6..0552244 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -849,9 +849,6 @@ endif () #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) TARGET_C_PROPERTIES (H5detect STATIC " " " ") -if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_include_directories (H5detect PUBLIC ${MPI_C_INCLUDE_DIRS}) -endif () if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif () @@ -866,9 +863,6 @@ add_custom_command ( add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") -if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_include_directories (H5make_libsettings PUBLIC ${MPI_C_INCLUDE_DIRS}) -endif () if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif () @@ -893,9 +887,6 @@ target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () -if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_include_directories (${HDF5_LIB_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) -endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES @@ -937,9 +928,6 @@ if (BUILD_SHARED_LIBS) if (NOT WIN32) target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () - if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_include_directories (${HDF5_LIBSH_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) - endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES -- cgit v0.12 From 50238cb285c37dc32029f1891f069fc76f5cbb07 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Dec 2017 13:33:57 -0600 Subject: Par example needs to link with mpi libs --- examples/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d8eb1a2..04a99ce 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -63,13 +63,13 @@ if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) TARGET_NAMING (ph5example STATIC) TARGET_C_PROPERTIES (ph5example STATIC " " " ") - target_link_libraries (ph5example ${HDF5_LIB_TARGET}) + target_link_libraries (ph5example ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example PROPERTIES FOLDER examples) if (BUILD_SHARED_LIBS) add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) TARGET_NAMING (ph5example-shared SHARED) TARGET_C_PROPERTIES (ph5example-shared SHARED " " " ") - target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET}) + target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example-shared PROPERTIES FOLDER examples) endif () endif () -- cgit v0.12 From d989a0b1cb3d6abeb71d1e37fae5a6d353fb7fc2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Dec 2017 13:41:06 -0600 Subject: Removed incorrect MPI text --- release_docs/RELEASE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 5249c1a..96d247a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -243,7 +243,7 @@ Bug Fixes since HDF5-1.10.1 release CMake implementation for MPI was problematic and would create incorrect MPI library references in the hdf5 libraries. - Reworked the CMake MPI code to properly create CMake targets.Also merged + Reworked the CMake MPI code to properly create CMake targets. Also merged the latest CMake FindMPI.cmake changes to the local copy. This is necessary until HDF changes the CMake minimum to 3.9 or greater. -- cgit v0.12 From 4ecf02f6f6a7c79e4e0d57ea2058ccb5e760f992 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Dec 2017 14:23:19 -0600 Subject: HDFFV-9724 Remove VDS file cache functionality --- java/src/hdf/hdf5lib/H5.java | 57 +++++++++++++++--------------- java/src/jni/h5pImp.c | 31 ----------------- java/src/jni/h5pImp.h | 18 ---------- java/test/JUnit-interface.txt | 3 +- java/test/TestH5Pfapl.java | 27 --------------- release_docs/RELEASE.txt | 4 --- src/H5Fprivate.h | 1 - src/H5Pfapl.c | 81 ------------------------------------------- src/H5Ppublic.h | 2 -- 9 files changed, 30 insertions(+), 194 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 3de49da..78ebbe2 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -6097,34 +6097,35 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; - /** - * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache. - * - * @param fapl_id - * IN: File access property list identifier - * - * @return VDS link open file cache size in number of files. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * - **/ - public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException; - - /** - * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache. - * - * @param fapl_id - * IN: File access property list identifier - * @param efc_size - * IN: VDS link open file cache size in number of files. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * - **/ - public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size) - throws HDF5LibraryException; +// ///// unimplemented ///// +// /** +// * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache. +// * +// * @param fapl_id +// * IN: File access property list identifier +// * +// * @return VDS link open file cache size in number of files. +// * +// * @exception HDF5LibraryException +// * - Error from the HDF-5 Library. +// * +// **/ +// public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException; +// +// /** +// * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache. +// * +// * @param fapl_id +// * IN: File access property list identifier +// * @param efc_size +// * IN: VDS link open file cache size in number of files. +// * +// * @exception HDF5LibraryException +// * - Error from the HDF-5 Library. +// * +// **/ +// public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size) +// throws HDF5LibraryException; /** * H5Pget_external returns information about an external file. diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index b144ff6..cf27341 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -5733,37 +5733,6 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts } /* end else */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */ -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_vds_file_cache_size - * Signature: (JI)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size - (JNIEnv *env, jclass clss, jlong plist, jint size) -{ - unsigned sz = (unsigned)size; - - if (H5Pset_vds_file_cache_size((hid_t)plist, (unsigned)sz) < 0) - h5libraryError(env); -} /* end Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_vds_file_cache_size - * Signature: (J)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size - (JNIEnv *env, jclass clss, jlong plist) -{ - unsigned s; - - if (H5Pget_vds_file_cache_size((hid_t)plist, &s) < 0) - h5libraryError(env); - - return (jint)s; -} /* end Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size */ /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index 19df4b2..1d12e3d 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -1544,24 +1544,6 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts /* * Class: hdf_hdf5lib_H5 - * Method: H5Pset_vds_file_cache_size - * Signature: (JI)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size -(JNIEnv *, jclass, jlong, jint); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_vds_file_cache_size - * Signature: (J)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size -(JNIEnv *, jclass, jlong); - -/* - * Class: hdf_hdf5lib_H5 * Method: H5Pset_virtual_prefix * Signature: (JLjava/lang/String;)V */ diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt index fa5b149..91ea286 100644 --- a/java/test/JUnit-interface.txt +++ b/java/test/JUnit-interface.txt @@ -505,7 +505,6 @@ JUnit version 4.11 .testH5Fmdc_logging .testH5Pget_elink_fapl .testH5Pset_mdc_config -.testH5P_vds_file_cache_size .testH5P_small_data_block_size .testH5Pset_fapl_log .testH5P_evict_on_close @@ -648,7 +647,7 @@ JUnit version 4.11 Time: XXXX -OK (646 tests) +OK (645 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index f6783d4..48a5986 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -1390,31 +1390,4 @@ public class TestH5Pfapl { fail("H5P_evict_on_close: " + err); } } - - @Test - public void testH5P_vds_file_cache_size() { - int vds_size = 0; - try { - try { - vds_size = H5.H5Pget_vds_file_cache_size(fapl_id); - assertTrue("H5P_vds_file_cache_size default", vds_size == 0); - } - catch (UnsupportedOperationException err) { - System.out.println(err.getMessage()); - } - try { - vds_size = 8; - H5.H5Pset_vds_file_cache_size(fapl_id, vds_size); - vds_size = H5.H5Pget_vds_file_cache_size(fapl_id); - assertTrue("H5P_vds_file_cache_size 8", vds_size == 8); - } - catch (UnsupportedOperationException err) { - System.out.println(err.getMessage()); - } - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5P_vds_file_cache_size: " + err); - } - } } diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 96d247a..dc4c98e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -69,8 +69,6 @@ New Features New public APIs: herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); - herr_t H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size); - herr_t H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size); The prefix can also be set with an environment variable, HDF5_VDS_PREFIX. (ADB - 2017/12/12, HDFFV-9724) @@ -146,8 +144,6 @@ New Features H5Pget_efile_prefix H5Pset_virtual_prefix H5Pget_virtual_prefix - H5Pset_vds_file_cache_size - H5Pget_vds_file_cache_size Tools: ------ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 575aa1c..96b8e36 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -489,7 +489,6 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ #define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ -#define H5F_ACS_VDS_FILE_CACHE_SIZE_NAME "vds_file_cache_size" /* Size of vds file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ #define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index d4e84ab..ea9bfb4 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -155,11 +155,6 @@ #define H5F_ACS_EFC_SIZE_DEF 0 #define H5F_ACS_EFC_SIZE_ENC H5P__encode_unsigned #define H5F_ACS_EFC_SIZE_DEC H5P__decode_unsigned -/* Definition for vds file cache size */ -#define H5F_ACS_VDS_FILE_CACHE_SIZE_SIZE sizeof(unsigned) -#define H5F_ACS_VDS_FILE_CACHE_SIZE_DEF 0 -#define H5F_ACS_VDS_FILE_CACHE_SIZE_ENC H5P__encode_unsigned -#define H5F_ACS_VDS_FILE_CACHE_SIZE_DEC H5P__decode_unsigned /* Definition of pointer to initial file image info */ #define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t) #define H5F_ACS_FILE_IMAGE_INFO_DEF H5FD_DEFAULT_FILE_IMAGE_INFO @@ -360,7 +355,6 @@ static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */ static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */ -static const unsigned H5F_def_vds_file_cache_size_g = H5F_ACS_VDS_FILE_CACHE_SIZE_DEF; /* Default vds file cache size */ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ @@ -516,12 +510,6 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the vds file cache size */ - if(H5P_register_real(pclass, H5F_ACS_VDS_FILE_CACHE_SIZE_NAME, H5F_ACS_VDS_FILE_CACHE_SIZE_SIZE, &H5F_def_vds_file_cache_size_g, - NULL, NULL, NULL, H5F_ACS_VDS_FILE_CACHE_SIZE_ENC, H5F_ACS_VDS_FILE_CACHE_SIZE_DEC, - NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, @@ -2474,75 +2462,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_vds_file_cache_size - * - * Purpose: Sets the number of files opened through vds links - * from the file associated with this fapl to be held open - * in that file's vds file cache. When the maximum - * number of files is reached, the least recently used file - * is closed (unless it is opened from somewhere else). - * - * Return: Non-negative on success/Negative on failure - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "iIu", plist_id, vds_size); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Set value */ - if(H5P_set(plist, H5F_ACS_VDS_FILE_CACHE_SIZE_NAME, &vds_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds file cache size") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_vds_file_cache_size() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_vds_file_cache_size - * - * Purpose: Gets the number of files opened through vds links - * from the file associated with this fapl to be held open - * in that file's vds file cache. When the maximum - * number of files is reached, the least recently used file - * is closed (unless it is opened from somewhere else). - * - * Return: Non-negative on success/Negative on failure - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", plist_id, vds_size); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get value */ - if(vds_size) - if(H5P_get(plist, H5F_ACS_VDS_FILE_CACHE_SIZE_NAME, vds_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file cache size") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_vds_file_cache_size() */ - - -/*------------------------------------------------------------------------- * Function: H5Pset_file_image * * Purpose: Sets the initial file image. Some file drivers can initialize diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 38be320..a2c0418 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -343,8 +343,6 @@ H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high); H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size); H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size); -H5_DLL herr_t H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size); -H5_DLL herr_t H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size); H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, -- cgit v0.12 From e94ed99c5bf7c4ae5df56f75606ef1b486e16bb2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Dec 2017 14:24:57 -0600 Subject: Add HD prefix --- src/H5system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5system.c b/src/H5system.c index 7b3a0eb..719b7e0 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1043,7 +1043,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) * Unix: does not apply */ if(H5_CHECK_ABS_DRIVE(name)) { - drive = toupper(name[0]) - 'A' + 1; + drive = HDtoupper(name[0]) - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); HDstrncpy(new_name, &name[2], name_len); } /* end if */ -- cgit v0.12 From 86d8a4c267eccbc66d6ee6120c9099788853c40f Mon Sep 17 00:00:00 2001 From: lrknox Date: Fri, 22 Dec 2017 12:28:24 -0600 Subject: Revert "Merge pull request #826 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop" This reverts commit b1223dd653e65e076af92b2dfe236f3704da81c8, reversing changes made to b25f123f5f5e25c1447a6a02861cb7c7265c12f2. --- CMakeLists.txt | 1 - MANIFEST | 6 - config/cmake_ext_mod/FindMPI.cmake | 287 +++--- config/cmake_ext_mod/runTest.cmake | 1 - examples/CMakeLists.txt | 4 +- java/src/hdf/hdf5lib/H5.java | 197 +--- java/src/hdf/hdf5lib/HDF5Constants.java | 3 - java/src/hdf/overview.html | 6 +- java/src/jni/h5Constants.c | 2 - java/src/jni/h5pImp.c | 211 ----- java/src/jni/h5pImp.h | 73 +- java/test/JUnit-interface.txt | 9 +- java/test/TestH5P.java | 53 +- java/test/TestH5Pfapl.java | 14 - java/test/TestH5Pvirtual.java | 33 - release_docs/RELEASE.txt | 30 +- src/CMakeLists.txt | 10 +- src/H5Dint.c | 78 +- src/H5Dpkg.h | 3 +- src/H5Dprivate.h | 11 +- src/H5Dvirtual.c | 253 +----- src/H5Fprivate.h | 420 ++++----- src/H5Fquery.c | 2 +- src/H5Pdapl.c | 366 -------- src/H5Pfapl.c | 938 +++++++++---------- src/H5Ppublic.h | 2 - src/H5system.c | 2 +- test/CMakeTests.cmake | 76 +- test/vds.c | 1493 ++++++++++++------------------- tools/test/h5dump/CMakeTestsVDS.cmake | 67 -- tools/test/h5ls/CMakeTestsVDS.cmake | 55 -- tools/test/h5ls/vds_prefix/tvds-1.ls | 14 - tools/test/h5ls/vds_prefix/tvds-2.ls | 13 - tools/test/h5ls/vds_prefix/tvds-3_1.ls | 14 - tools/test/h5ls/vds_prefix/tvds-3_2.ls | 13 - tools/test/h5ls/vds_prefix/tvds-4.ls | 9 - tools/test/h5ls/vds_prefix/tvds-5.ls | 11 - 37 files changed, 1471 insertions(+), 3309 deletions(-) delete mode 100644 tools/test/h5ls/vds_prefix/tvds-1.ls delete mode 100644 tools/test/h5ls/vds_prefix/tvds-2.ls delete mode 100644 tools/test/h5ls/vds_prefix/tvds-3_1.ls delete mode 100644 tools/test/h5ls/vds_prefix/tvds-3_2.ls delete mode 100644 tools/test/h5ls/vds_prefix/tvds-4.ls delete mode 100644 tools/test/h5ls/vds_prefix/tvds-5.ls diff --git a/CMakeLists.txt b/CMakeLists.txt index 6165b35..e22ac2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -631,7 +631,6 @@ if (HDF5_ENABLE_PARALLEL) # Used by Fortran + MPI CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) - INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_DIRS}) else () message (STATUS "Parallel libraries not found") endif () diff --git a/MANIFEST b/MANIFEST index c6c7b3c..9b91c78 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1430,12 +1430,6 @@ ./tools/test/h5ls/h5ls_plugin.sh.in ./tools/test/h5ls/testh5ls.sh.in ./tools/test/h5ls/testh5lsvds.sh.in -./tools/test/h5ls/vds_prefix/tvds-1.ls -./tools/test/h5ls/vds_prefix/tvds-2.ls -./tools/test/h5ls/vds_prefix/tvds-3_1.ls -./tools/test/h5ls/vds_prefix/tvds-3_2.ls -./tools/test/h5ls/vds_prefix/tvds-4.ls -./tools/test/h5ls/vds_prefix/tvds-5.ls # h5copy sources ./tools/src/h5copy/Makefile.am diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake index d01dd35..8084472 100644 --- a/config/cmake_ext_mod/FindMPI.cmake +++ b/config/cmake_ext_mod/FindMPI.cmake @@ -347,7 +347,7 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) # library that has invalid or missing version information there would be warning # messages emitted by ld.so in the compiler output. In either case, we'll treat # the output as invalid. - if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found") + if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") set(WRAPPER_RETURN 255) endif() # Ensure that no error output might be passed upwards. @@ -615,16 +615,6 @@ function (_MPI_interrogate_compiler lang) endif() endif() - if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) - list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") - endif() - if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) - list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") - endif() - if(MPI_${LANG}_EXTRA_LIB_NAMES) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") - endif() - # If we found MPI, set up all of the appropriate cache entries if(NOT MPI_${LANG}_COMPILE_OPTIONS) set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) @@ -833,43 +823,33 @@ endfunction() macro(_MPI_assemble_libraries LANG) set(MPI_${LANG}_LIBRARIES "") - # Only for libraries do we need to check whether the compiler's linking stage is separate. - if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() - endif() + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() endmacro() macro(_MPI_assemble_include_dirs LANG) - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - set(MPI_${LANG}_INCLUDE_DIRS "") - else() - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") - endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") - endif() + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") - endforeach() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") endif() endif() + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}") + endforeach() + endif() endmacro() function(_MPI_split_include_dirs LANG) - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - return() - endif() # Backwards compatibility: Search INCLUDE_PATH if given. if(MPI_${LANG}_INCLUDE_PATH) list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") @@ -905,13 +885,6 @@ function(_MPI_split_include_dirs LANG) endif() mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) endif() - # Remove duplicates and default system directories from the list. - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) - endforeach() - endif() set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) endfunction() @@ -1041,7 +1014,7 @@ elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") # FreeBSD ships mpich under the normal system paths - but available openmpi implementations # will be found in /usr/local/mpi/ - MPI_search_mpi_prefix_folder("/usr/local/mpi") + MPI_search_mpi_prefix_folder("/usr/local/mpi/") endif() # Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. @@ -1077,54 +1050,48 @@ mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXE # # Once we find the new variables, we translate them back into their old # equivalents below. -if(NOT MPI_IGNORE_LEGACY_VARIABLES) - foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") +foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") + endif() + endforeach() + + # Chop the old compile flags into options and definitions + if(MPI_${LANG}_COMPILE_FLAGS) + unset(MPI_${LANG}_COMPILE_OPTIONS) + unset(MPI_${LANG}_COMPILE_DEFINITIONS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}") endif() endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() - # Chop the old compile flags into options and definitions - - unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) - unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) - if(MPI_${LANG}_COMPILE_FLAGS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") - endif() - endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - - # If a list of libraries was given, we'll split it into new-style cache variables - unset(MPI_${LANG}_EXTRA_LIB_NAMES) - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - if(_MPI_LIB) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endif() - endforeach() - endif() - endforeach() -endif() + # If a list of libraries was given, we'll split it into new-style cache variables + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + endif() +endforeach() #============================================================================= unset(MPI_VERSION) @@ -1133,11 +1100,6 @@ unset(MPI_VERSION_MINOR) unset(_MPI_MIN_VERSION) -# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. -if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) -endif() - # This loop finds the compilers and sends them off for interrogation. foreach(LANG IN ITEMS C CXX Fortran) if(CMAKE_${LANG}_COMPILER_LOADED) @@ -1159,8 +1121,6 @@ foreach(LANG IN ITEMS C CXX Fortran) mark_as_advanced(MPI_CXX_SKIP_MPICXX) endif() if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) - set(MPI_${LANG}_TRIED_IMPLICIT FALSE) - set(MPI_${LANG}_WORKS_IMPLICIT FALSE) if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. # Cray PrgEnv. @@ -1170,90 +1130,80 @@ foreach(LANG IN ITEMS C CXX Fortran) # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. if(MPI_${LANG}_WORKS) set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) - set(MPI_${LANG}_WORKS_IMPLICIT TRUE) endif() - set(MPI_${LANG}_TRIED_IMPLICIT TRUE) endif() - if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) - endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - endif() - - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH - DOC "MPI compiler for ${LANG}" - ) + # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. + if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) + endif() + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + else() + set(MPI_PINNED_COMPILER FALSE) + endif() - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) find_program(MPI_${LANG}_COMPILER NAMES ${_MPI_${LANG}_COMPILER_NAMES} PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH DOC "MPI compiler for ${LANG}" ) + endif() - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - set(MPI_PINNED_COMPILER TRUE) - - # If we haven't made the implicit compiler test yet, perform it now. - if(NOT MPI_${LANG}_TRIED_IMPLICIT) - _MPI_create_imported_target(${LANG}) - _MPI_check_lang_works(${LANG}) - endif() - - # Should the MPI compiler not work implicitly for MPI, still interrogate it. - # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used - # directly during linkage instead of CMAKE__COMPILER will not work. - if(NOT MPI_${LANG}_WORKS) - set(MPI_${LANG}_WORKS_IMPLICIT FALSE) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WORKS_IMPLICIT TRUE) - endif() - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - endif() + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + DOC "MPI compiler for ${LANG}" + ) + + if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_SKIP_GUESSING TRUE) + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WRAPPER_FOUND FALSE) endif() + else() + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + endif() - if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - else() - _MPI_guess_settings(${LANG}) - endif() + if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + set(MPI_${LANG}_WRAPPER_FOUND TRUE) + elseif(NOT MPI_SKIP_GUESSING) + _MPI_guess_settings(${LANG}) endif() endif() endif() _MPI_split_include_dirs(${LANG}) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + endif() _MPI_adjust_compile_definitions(${LANG}) # We always create imported targets even if they're empty _MPI_create_imported_target(${LANG}) @@ -1267,9 +1217,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) - endif() + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) @@ -1389,7 +1337,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) unset(MPI_${LANG}_REQUIRED_VARS) - if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND) foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") endforeach() @@ -1500,7 +1448,6 @@ if (MPI_NUMLIBS GREATER 1) else() set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") endif() -set(MPI_IGNORE_LEGACY_VARIABLES TRUE) #============================================================================= # unset these vars to cleanup namespace diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 5569a73..2479728 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -55,7 +55,6 @@ endif () if (TEST_ENV_VAR) set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") - #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") endif () if (NOT TEST_INPUT) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 04a99ce..d8eb1a2 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -63,13 +63,13 @@ if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) TARGET_NAMING (ph5example STATIC) TARGET_C_PROPERTIES (ph5example STATIC " " " ") - target_link_libraries (ph5example ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) + target_link_libraries (ph5example ${HDF5_LIB_TARGET}) set_target_properties (ph5example PROPERTIES FOLDER examples) if (BUILD_SHARED_LIBS) add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) TARGET_NAMING (ph5example-shared SHARED) TARGET_C_PROPERTIES (ph5example-shared SHARED " " " ") - target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) + target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET}) set_target_properties (ph5example-shared PROPERTIES FOLDER examples) endif () endif () diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 78ebbe2..7b5b5c9 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -4451,7 +4451,7 @@ public class H5 implements java.io.Serializable { // // // //////////////////////////////////////////////////////////// - // /////// Generic property list routines /////// + // Generic property list routines /** * H5Pget_class_name retrieves the name of a generic property list class @@ -4767,7 +4767,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, H5P_iterate_t op_data) throws HDF5LibraryException; - // /////// Object creation property list (OCPL) routines /////// + // Object creation property list (OCPL) routines /** * H5Pget_attr_phase_change retrieves attribute storage phase change thresholds. @@ -5071,7 +5071,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException, NullPointerException; - // /////// File creation property list (FCPL) routines /////// + // File creation property list (FCPL) routines /** * H5Pget_userblock retrieves the size of a user block in a file creation property list. @@ -5480,7 +5480,7 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, IllegalArgumentException; - // /////// File access property list (FAPL) routines /////// + // File access property list (FAPL) routines /** * H5Pget_alignment retrieves the current settings for alignment properties from a file access property list. @@ -5860,37 +5860,6 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_metadata_read_attempts(long plist_id, long attempts) throws HDF5LibraryException; - /** - * H5Pget_evict_on_close retrieves the file access property list setting that determines whether an HDF5 object - * will be evicted from the library's metadata cache when it is closed. - * - * @param fapl_id - * IN: File access property list identifier - * - * @return indication if the object will be evicted on close. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * - **/ - public synchronized static native boolean H5Pget_evict_on_close(long fapl_id) - throws HDF5LibraryException; - - /** - * H5Pset_evict_on_close controls the library's behavior of evicting metadata associated with a closed object. - * - * @param fapl_id - * IN: File access property list identifier - * @param evict_on_close - * IN: Whether the HDF5 object should be evicted on close. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * - **/ - public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close) - throws HDF5LibraryException; - // Dataset creation property list (DCPL) routines // /** @@ -6097,36 +6066,6 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; -// ///// unimplemented ///// -// /** -// * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache. -// * -// * @param fapl_id -// * IN: File access property list identifier -// * -// * @return VDS link open file cache size in number of files. -// * -// * @exception HDF5LibraryException -// * - Error from the HDF-5 Library. -// * -// **/ -// public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException; -// -// /** -// * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache. -// * -// * @param fapl_id -// * IN: File access property list identifier -// * @param efc_size -// * IN: VDS link open file cache size in number of files. -// * -// * @exception HDF5LibraryException -// * - Error from the HDF-5 Library. -// * -// **/ -// public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size) -// throws HDF5LibraryException; - /** * H5Pget_external returns information about an external file. * @@ -6346,37 +6285,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException, NullPointerException; - // /////// Dataset creation property list (DCPL) routines /////// - - /** - * H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list. - * - * @param dcpl_id - * IN: Dataset creation property list identifier - * @param opts - * IN: Edge chunk option flag. Valid values are: - * H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS - filters are not applied to partial edge chunks. - * 0 - Disables option; partial edge chunks will be compressed. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library - **/ - public synchronized static native void H5Pset_chunk_opts(long dcpl_id, int opts) throws HDF5LibraryException; - - /** - * H5Pget_chunk_opts retrieves the edge chunk option setting stored in the dataset creation property list . - * - * @param dcpl_id - * IN: Dataset creation property list - - * @return The edge chunk option setting. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library - **/ - public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException; - - // /////// Dataset access property list (DAPL) routines /////// + // Dataset access property list (DAPL) routines // /** * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes @@ -6479,76 +6388,12 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException; - /** - * H5Pget_virtual_prefix Retrieves prefix applied to virtual file paths. - * - * @param dapl_id - * IN: Link access property list identifier - * - * @return the prefix to be applied to virtual file paths. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * - **/ - public synchronized static native String H5Pget_virtual_prefix(long dapl_id) - throws HDF5LibraryException; - - /** - * H5Pset_virtual_prefix Sets prefix to be applied to virtual file paths. - * - * @param dapl_id - * IN: Dataset access property list identifier - * @param prefix - * IN: Prefix to be applied to virtual file paths - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * @exception NullPointerException - * - prefix is null. - * - **/ - public synchronized static native void H5Pset_virtual_prefix(long dapl_id, String prefix) - throws HDF5LibraryException, NullPointerException; - - /** - * H5Pget_efile_prefix Retrieves prefix applied to external file paths. - * - * @param dapl_id - * IN: Link access property list identifier - * - * @return the prefix to be applied to external file paths. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * - **/ - public synchronized static native String H5Pget_efile_prefix(long dapl_id) - throws HDF5LibraryException; - - /** - * H5Pset_efile_prefix Sets prefix to be applied to external file paths. - * - * @param dapl_id - * IN: Dataset access property list identifier - * @param prefix - * IN: Prefix to be applied to external file paths - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * @exception NullPointerException - * - prefix is null. - * - **/ - public synchronized static native void H5Pset_efile_prefix(long dapl_id, String prefix) - throws HDF5LibraryException, NullPointerException; - // public synchronized static native void H5Pset_append_flush(long plist_id, int ndims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; // public synchronized static native void H5Pget_append_flush(long plist_id, int dims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; - // /////// Dataset xfer property list (DXPL) routines /////// + // Dataset xfer property list (DXPL) routines // /** * H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property @@ -6699,7 +6544,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size) throws HDF5LibraryException, NullPointerException; - // /////// Link creation property list (LCPL) routines /////// + // Link creation property list (LCPL) routines // /** * H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate @@ -6734,7 +6579,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group) throws HDF5LibraryException; - // /////// Group creation property list (GCPL) routines /////// + // Group creation property list (GCPL) routines // /** * H5Pget_local_heap_size_hint Retrieves the anticipated size of the local heap for original-style groups. @@ -6891,14 +6736,14 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags) throws HDF5LibraryException; - // /////// String creation property list (STRCPL) routines /////// + // String creation property list (STRCPL) routines // public synchronized static native int H5Pget_char_encoding(long plist_id) throws HDF5LibraryException; public synchronized static native void H5Pset_char_encoding(long plist_id, int encoding) throws HDF5LibraryException; - // /////// Link access property list (LAPL) routines /////// + // Link access property list (LAPL) routines // /** * H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the @@ -7051,7 +6896,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException, IllegalArgumentException; - // /////// Object copy property list (OCPYPL) routines /////// + // Object copy property list (OCPYPL) routines // /** * H5Pget_copy_object retrieves the properties to be used when an object is copied. @@ -7082,7 +6927,7 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options) throws HDF5LibraryException; - // /////// Other/Older property list routines /////// + // Other/Older property list routines // /** * H5Pget_version retrieves the version information of various objects for a file creation property list. @@ -7110,7 +6955,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; - // /////// file drivers property list routines /////// + // file drivers property list routines // public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store) throws HDF5LibraryException, NullPointerException; @@ -7257,28 +7102,20 @@ public class H5 implements java.io.Serializable { // File creation property list (FCPL) routines // // File access property list (FAPL) routines // - // herr_t H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info) - // const void *H5Pget_driver_info(hid_t plist_id) - // herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type) - // herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) + // herr_t H5Pset_driver( hid_t plist_id, hid_t new_driver_id, const void *new_driver_info ) + // const void *H5Pget_driver_info( hid_t plist_id ) + // herr_t H5Pget_multi_type ( hid_t fapl_id, H5FD_mem_t *type ) + // herr_t H5Pset_multi_type ( hid_t fapl_id, H5FD_mem_t type ) // herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); // herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); // herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); // herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); // herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); // herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); - // herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective); - // herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective); - // herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective); - // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc); - // herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data); - // herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data); // Dataset creation property list (DCPL) routines // // Dataset access property list (DAPL) routines // - // herr_t H5Pset_append_flush (hid_t dapl_id, int ndims, const hsize_t boundary[], H5D_append_cb_t func, void *user_data); - // herr_t H5Pget_append_flush(hid_t dapl_id, int ndims, hsize_t boundary[], H5D_append_cb_t *func, void **user_data) // Dataset xfer property list (DXPL) routines // // herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 3e43ba2..8a3d6c8 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -88,7 +88,6 @@ public class HDF5Constants { public static final int H5D_VDS_ERROR = H5D_VDS_ERROR(); public static final int H5D_VDS_FIRST_MISSING = H5D_VDS_FIRST_MISSING(); public static final int H5D_VDS_LAST_AVAILABLE = H5D_VDS_LAST_AVAILABLE(); - public static final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS = H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS(); public static final int H5E_MAJOR = H5E_MAJOR(); public static final int H5E_MINOR = H5E_MINOR(); @@ -769,8 +768,6 @@ public class HDF5Constants { private static native final int H5D_VDS_LAST_AVAILABLE(); - private static native final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS(); - private static native final long H5E_ALIGNMENT(); private static native final long H5E_ALREADYEXISTS(); diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index 9c19442..39d75b7 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -47,20 +47,20 @@ which has a method: The native method is implemented in C using the Java Native Method Interface (JNI). This is written something like the following: -
JNIEXPORT jlong
+
JNIEXPORT jint
 JNICALL Java_hdf_hdf5lib_H5_H5Fopen
 (
  JNIEnv *env,
  jclass class,
  jstring hdfFile,
  jint flags,
- jlong access)
+ jint access)
  {
 
  /* ...convert Java String to (char *) */
 
  /* call the HDF library */
- retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access);
+ retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access );
 
  /* ... */
 }
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 5a4b53e..f6f8bfa 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -140,8 +140,6 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; } -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1DONT_1FILTER_1PARTIAL_1CHUNKS(JNIEnv *env, jclass cls) { return H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; } diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index cf27341..dcfcd82 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -5733,217 +5733,6 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts } /* end else */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_virtual_prefix - * Signature: (JLjava/lang/String;)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix - (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) -{ - herr_t retVal = -1; - const char *aName; - - PIN_JAVA_STRING(prefix, aName); - if (aName != NULL) { - retVal = H5Pset_virtual_prefix((hid_t)dapl_id, aName); - - UNPIN_JAVA_STRING(prefix, aName); - - if(retVal < 0) - h5libraryError(env); - } -} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_virtual_prefix - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix - (JNIEnv *env, jclass clss, jlong dapl_id) -{ - size_t size = 0; - char *pre; - jlong prefix_size = -1; - jstring str = NULL; - - prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)NULL, size); - if(prefix_size < 0) { - h5libraryError(env); - } /* end if */ - else { - size = (size_t)prefix_size + 1;/* add extra space for the null terminator */ - pre = (char*)HDmalloc(sizeof(char)*size); - if (pre == NULL) { - h5outOfMemory(env, "H5Pget_virtual_prefix: malloc failed "); - } /* end if */ - else { - prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)pre, size); - - if (prefix_size >= 0) { - str = ENVPTR->NewStringUTF(ENVPAR pre); - HDfree(pre); - if (str == NULL) - h5JNIFatalError( env, "H5Pget_virtual_prefix: return string not allocated"); - } /* end if */ - else { - HDfree(pre); - h5libraryError(env); - } /* end else */ - } /* end else */ - } /* end else */ - - return (jstring)str; -} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_efile_prefix - * Signature: (JLjava/lang/String;)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix - (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) -{ - herr_t retVal = -1; - const char *aName; - - PIN_JAVA_STRING(prefix, aName); - if (aName != NULL) { - retVal = H5Pset_efile_prefix((hid_t)dapl_id, aName); - - UNPIN_JAVA_STRING(prefix, aName); - - if(retVal < 0) - h5libraryError(env); - } -} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_efile_prefix - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix - (JNIEnv *env, jclass clss, jlong dapl_id) -{ - size_t size = 0; - char *pre; - jlong prefix_size = -1; - jstring str = NULL; - - prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)NULL, size); - if(prefix_size < 0) { - h5libraryError(env); - } /* end if */ - else { - size = (size_t)prefix_size + 1;/* add extra space for the null terminator */ - pre = (char*)HDmalloc(sizeof(char)*size); - if (pre == NULL) { - h5outOfMemory(env, "H5Pget_efile_prefix: malloc failed "); - } /* end if */ - else { - prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)pre, size); - - if (prefix_size >= 0) { - str = ENVPTR->NewStringUTF(ENVPAR pre); - HDfree(pre); - if (str == NULL) - h5JNIFatalError( env, "H5Pget_efile_prefix: return string not allocated"); - } /* end if */ - else { - HDfree(pre); - h5libraryError(env); - } /* end else */ - } /* end else */ - } /* end else */ - - return (jstring)str; -} /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_evict_on_close - * Signature: (JZ)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close - (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close) -{ - herr_t retVal = -1; - hbool_t evict_on_close_val; - - if (evict_on_close == JNI_TRUE) - evict_on_close_val = TRUE; - else - evict_on_close_val = FALSE; - - retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val); - if (retVal < 0) - h5libraryError(env); -} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_evict_on_close - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close - (JNIEnv *env, jclass clss, jlong fapl_id) -{ - hbool_t evict_on_close_val = FALSE; - jboolean bval = JNI_FALSE; - - if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0) { - h5libraryError(env); - } /* end if */ - else { - if (evict_on_close_val == TRUE) - bval = JNI_TRUE; - } /* end else */ - - return bval; -} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_chunk_opts - * Signature: (JI)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts - (JNIEnv *env, jclass clss, jlong dcpl_id, jint opts) -{ - herr_t retVal = -1; - - retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts); - if (retVal < 0) - h5libraryError(env); -} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */ - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_chunk_opts - * Signature: (J)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts - (JNIEnv *env, jclass clss, jlong dcpl_id) -{ - unsigned opts = 0; - - if (H5Pget_chunk_opts((hid_t)dcpl_id, opts) < 0) - h5libraryError(env); - - return (jint)opts; -} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */ - #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index 1d12e3d..d413f69 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -1533,6 +1533,7 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts (JNIEnv *, jclass, jlong); + /* * Class: hdf_hdf5lib_H5 * Method: H5Pset_metadata_read_attempts @@ -1542,78 +1543,6 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts (JNIEnv *, jclass, jlong, jlong); -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_virtual_prefix - * Signature: (JLjava/lang/String;)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix -(JNIEnv *, jclass, jlong, jstring); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_virtual_prefix - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix -(JNIEnv *, jclass, jlong); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_efile_prefix - * Signature: (JLjava/lang/String;)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix -(JNIEnv *, jclass, jlong, jstring); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_efile_prefix - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix -(JNIEnv *, jclass, jlong); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_evict_on_close - * Signature: (JZ)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close -(JNIEnv *, jclass, jlong, jboolean); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_evict_on_close - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close -(JNIEnv *, jclass, jlong); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pset_chunk_opts - * Signature: (JI)V - */ -JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts -(JNIEnv *, jclass, jlong, jint); - -/* - * Class: hdf_hdf5lib_H5 - * Method: H5Pget_chunk_opts - * Signature: (J)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts -(JNIEnv *, jclass, jlong); - #ifdef __cplusplus } /* end extern "C" */ diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt index 91ea286..ab2f3b1 100644 --- a/java/test/JUnit-interface.txt +++ b/java/test/JUnit-interface.txt @@ -415,7 +415,6 @@ JUnit version 4.11 .testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue .testH5P_layout .testH5Pget_link_creation_order -.testH5Pget_efile_prefix .testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes .testH5P_file_space_page_size .testH5Pget_shared_mesg_index_Invalid_indexnum @@ -445,7 +444,6 @@ JUnit version 4.11 .testH5Pset_est_link_info_InvalidValues .testH5Pset_local_heap_size_hint .testH5Pget_est_link_info -.testH5Pset_efile_prefix_null .testH5Pset_scaleoffset .testH5Pset_create_intermediate_group_invalidobject .testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue @@ -468,7 +466,6 @@ JUnit version 4.11 .testH5Pget_sym_k_null .testH5Pset_nlinks .testH5P_obj_track_times -.testH5Pset_efile_prefix .testH5P_userblock .testH5Pget_local_heap_size_hint .testH5Pset_shared_mesg_index_Invalid_indexnum @@ -507,7 +504,6 @@ JUnit version 4.11 .testH5Pset_mdc_config .testH5P_small_data_block_size .testH5Pset_fapl_log -.testH5P_evict_on_close .testH5Pset_libver_bounds .testH5P_sieve_buf_size .testH5P_elink_file_cache_size @@ -534,14 +530,11 @@ JUnit version 4.11 .testH5Pget_source_datasetname .testH5Pvirtual_storage .testH5Pget_selection_source_dataset -.testH5Pget_virtual_prefix .testH5Pget_source_filename .testH5Pset_get_virtual_printf_gap .testH5Pget_virtual_count -.testH5Pset_virtual_prefix .testH5Pset_get_virtual_view .testH5Pget_mapping_parameters -.testH5Pset_virtual_prefix_null .testH5P_genprop_basic_class .testH5P_genprop_class_iter .testH5P_genprop_basic_class_prop @@ -647,7 +640,7 @@ JUnit version 4.11 Time: XXXX -OK (645 tests) +OK (638 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 9e45e4c..5aafb5b 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -28,7 +28,6 @@ import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -853,7 +852,7 @@ public class TestH5P { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pset_elink_prefix: " + err); + fail("H5Pset_est_link_info: " + err); } assertTrue("H5Pset_elink_prefix", ret_val >= 0); } @@ -1233,54 +1232,4 @@ public class TestH5P { fail("testH5P_file_space_page_size: " + err); } } - - @Test - public void testH5Pset_efile_prefix() { - String prefix = "tmp"; - try { - H5.H5Pset_efile_prefix(lapl_id, prefix); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5Pset_efile_prefix: " + err); - } - } - - @Test(expected = NullPointerException.class) - public void testH5Pset_efile_prefix_null() throws Throwable{ - H5.H5Pset_efile_prefix(lapl_id, null); - } - - @Test - public void testH5Pget_efile_prefix() { - String prefix = "tmp"; - String pre = ""; - - try { - H5.H5Pset_efile_prefix(lapl_id, prefix); - pre = H5.H5Pget_efile_prefix(lapl_id); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5Pget_efile_prefix: " + err); - } - assertTrue("The prefix: ", prefix.equals(pre)); - } - - @Ignore - public void testH5P_chunk_opts() { - int chunk_opts = -1; - - try { - chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); - assertTrue("chunk_opts: "+chunk_opts, chunk_opts == 0); - H5.H5Pset_chunk_opts(ocpl_id, HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); - chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); - assertTrue("chunk_opts: "+chunk_opts, chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5Pget_lchunk_opts: " + err); - } - } } diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index 48a5986..d4a2231 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -1376,18 +1376,4 @@ public class TestH5Pfapl { deleteH5file(); _deleteLogFile(); } - - @Test - public void testH5P_evict_on_close() { - boolean ret_val_id = false; - try { - H5.H5Pset_evict_on_close(fapl_id, true); - ret_val_id = H5.H5Pget_evict_on_close(fapl_id); - assertTrue("H5P_evict_on_close", ret_val_id); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5P_evict_on_close: " + err); - } - } } diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java index ff2e4dc..40cfbac 100644 --- a/java/test/TestH5Pvirtual.java +++ b/java/test/TestH5Pvirtual.java @@ -429,37 +429,4 @@ public class TestH5Pvirtual { try {H5.H5Dclose(H5did);} catch (Exception ex) {} } } - - @Test - public void testH5Pset_virtual_prefix() { - String prefix = "tmp"; - try { - H5.H5Pset_virtual_prefix(H5dapl_id, prefix); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5Pset_virtual_prefix: " + err); - } - } - - @Test(expected = NullPointerException.class) - public void testH5Pset_virtual_prefix_null() throws Throwable{ - H5.H5Pset_virtual_prefix(H5dapl_id, null); - } - - @Test - public void testH5Pget_virtual_prefix() { - String prefix = "tmp"; - String pre = ""; - - try { - H5.H5Pset_virtual_prefix(H5dapl_id, prefix); - pre = H5.H5Pget_virtual_prefix(H5dapl_id); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5Pget_virtual_prefix: " + err); - } - assertTrue("The prefix: ", prefix.equals(pre)); - } } diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index dc4c98e..7498d01 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -58,21 +58,7 @@ New Features Library: -------- - - Add prefix option to VDS files. - - Currently, VDS source files must be in the active directory to be - found by the virtual file. Adding the option of a prefix to be set - on the virtual file, using a data access property list (DAPL), - allows the source files to located at an absolute or relative path - to the virtual file. - - New public APIs: - herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); - ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); - The prefix can also be set with an environment variable, HDF5_VDS_PREFIX. - - (ADB - 2017/12/12, HDFFV-9724) - + - Parallel Library: ----------------- @@ -133,18 +119,6 @@ New Features ------------ - - Java Library: - ---------------- - - Wrappers added for the following APIs: - H5Pset_evict_on_close - H5Pget_evict_on_close - H5Pset_chunk_opts - H5Pget_chunk_opts - H5Pset_efile_prefix - H5Pget_efile_prefix - H5Pset_virtual_prefix - H5Pget_virtual_prefix - Tools: ------ - h5diff @@ -239,7 +213,7 @@ Bug Fixes since HDF5-1.10.1 release CMake implementation for MPI was problematic and would create incorrect MPI library references in the hdf5 libraries. - Reworked the CMake MPI code to properly create CMake targets. Also merged + Reworked the CMake MPI code to properly create CMake targets.Also merged the latest CMake FindMPI.cmake changes to the local copy. This is necessary until HDF changes the CMake minimum to 3.9 or greater. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0552244..b163b8a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -885,7 +885,10 @@ add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HE TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIB_TARGET} PUBLIC ${CMAKE_DL_LIBS}) + target_link_libraries (${HDF5_LIB_TARGET} PUBLIC dl) +endif () +if (H5_HAVE_PARALLEL AND MPI_C_FOUND) + target_include_directories (${HDF5_LIB_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) @@ -926,7 +929,10 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC ${CMAKE_DL_LIBS}) + target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC dl) + endif () + if (H5_HAVE_PARALLEL AND MPI_C_FOUND) + target_include_directories (${HDF5_LIBSH_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) diff --git a/src/H5Dint.c b/src/H5Dint.c index 8b663b8..b6c0341 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -61,8 +61,8 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); -static herr_t H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char * prefix_type, - char **vds_prefix); +static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, + char **extfile_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); @@ -963,25 +963,24 @@ done: } /* end H5D__update_oh_info() */ - /*-------------------------------------------------------------------------- - * Function: H5D_build_file_prefix + * Function: H5D_build_extfile_prefix * - * Purpose: Determine the file prefix to be used and store - * it in file_prefix. Stores an empty string if no prefix + * Purpose: Determine the external file prefix to be used and store + * it in extfile_prefix. Stores an empty string if no prefix * should be used. * * Return: SUCCEED/FAIL *-------------------------------------------------------------------------- */ static herr_t -H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix /*out*/) +H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/) { char *prefix = NULL; /* prefix used to look for the file */ - char *filepath = NULL; /* absolute path of directory the HDF5 file is in */ - size_t filepath_len; /* length of file path */ + char *extpath = NULL; /* absolute path of directory the HDF5 file is in */ + size_t extpath_len; /* length of extpath */ size_t prefix_len; /* length of prefix */ - size_t file_prefix_len; /* length of expanded prefix */ + size_t extfile_prefix_len; /* length of expanded prefix */ H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ @@ -991,25 +990,20 @@ H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, HDassert(dset); HDassert(dset->oloc.file); - filepath = H5F_EXTPATH(dset->oloc.file); - HDassert(filepath); + extpath = H5F_EXTPATH(dset->oloc.file); + HDassert(extpath); /* XXX: Future thread-safety note - getenv is not required * to be reentrant. */ - if (HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) - prefix = HDgetenv("HDF5_VDS_PREFIX"); - else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) - prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); - else - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") + prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); if(prefix == NULL || *prefix == '\0') { - /* Set prefix to value of prefix_type property */ + /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */ if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_peek(plist, prefix_type, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix") + if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") } /* end if */ /* Prefix has to be checked for NULL / empty string again because the @@ -1019,29 +1013,29 @@ H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, /* filename is interpreted as relative to the current directory, * does not need to be expanded */ - if(NULL == (*file_prefix = (char *)H5MM_strdup(""))) + if(NULL == (*extfile_prefix = (char *)H5MM_strdup(""))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ else { if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ - filepath_len = HDstrlen(filepath); + extpath_len = HDstrlen(extpath); prefix_len = HDstrlen(prefix); - file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; + extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; - if(NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len))) + if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") - HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}")); + HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); } /* end if */ else { - if(NULL == (*file_prefix = (char *)H5MM_strdup(prefix))) + if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end else */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_build_file_prefix() */ +} /* H5D_build_extfile_prefix() */ /*------------------------------------------------------------------------- @@ -1223,13 +1217,9 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ - if(H5D_build_file_prefix(new_dset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &new_dset->shared->extfile_prefix) < 0) + if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") - /* Set the vds file prefix */ - if(H5D_build_file_prefix(new_dset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &new_dset->shared->vds_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") - /* Add the dataset to the list of opened objects in the file */ if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") @@ -1275,7 +1265,6 @@ done: if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); - new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; @@ -1362,7 +1351,6 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; char *extfile_prefix = NULL; /* Expanded external file prefix */ - char *vds_prefix = NULL; /* Expanded vds prefix */ H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1383,13 +1371,9 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") /* Get the external file prefix */ - if(H5D_build_file_prefix(dataset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &extfile_prefix) < 0) + if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") - /* Get the vds prefix */ - if(H5D_build_file_prefix(dataset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &vds_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") - /* Check if dataset was already open */ if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ @@ -1415,11 +1399,6 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* Prevent string from being freed during done: */ extfile_prefix = NULL; - /* Set the vds file prefix */ - dataset->shared->vds_prefix = vds_prefix; - /* Prevent string from being freed during done: */ - vds_prefix = NULL; - } /* end if */ else { /* Point to shared info */ @@ -1451,14 +1430,12 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) done: extfile_prefix = (char *)H5MM_xfree(extfile_prefix); - vds_prefix = (char *)H5MM_xfree(vds_prefix); if(ret_value == NULL) { /* Free the location--casting away const*/ if(dataset) { if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); - dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); } @@ -1841,9 +1818,6 @@ H5D_close(H5D_t *dataset) /* Free the external file prefix */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); - /* Free the vds file prefix */ - dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); - /* Release layout, fill-value, efl & pipeline messages */ if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || @@ -3386,10 +3360,6 @@ H5D_get_access_plist(H5D_t *dset) if(H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap") - /* Set the vds prefix option */ - if(H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds prefix") - /* Set the external file prefix option */ if(H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 45f2d3a..542abd0 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -476,7 +476,6 @@ typedef struct H5D_shared_t { H5D_append_flush_t append_flush; /* Append flush property information */ char *extfile_prefix; /* expanded external file prefix */ - char *vds_prefix; /* expanded vds prefix */ } H5D_shared_t; struct H5D_t { @@ -599,7 +598,7 @@ H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id); H5_DLL herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id); /* Internal I/O routines */ -H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, +H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf); H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index ed13467..fb994d8 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -47,13 +47,12 @@ #define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */ /* ======== Dataset access property names ======== */ -#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ -#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ -#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ -#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ +#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ +#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ #define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */ -#define H5D_ACS_VDS_PREFIX_NAME "vds_prefix" /* VDS file prefix */ -#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */ +#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */ #define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */ /* ======== Data transfer properties ======== */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 4882e9f..3be2353 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -731,240 +731,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_delete */ - -/*-------------------------------------------------------------------------- - * Function: H5D__virtual_build_name - * - * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME - * - * Return: Non-negative on success/Negative on failure - *--------------------------------------------------------------------------*/ -static herr_t -H5D__virtual_build_name(char *prefix, char *file_name, char **full_name/*out*/) -{ - size_t prefix_len; /* length of prefix */ - size_t fname_len; /* Length of external link file name */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - prefix_len = HDstrlen(prefix); - fname_len = HDstrlen(file_name); - - /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") - - /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, - (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__virtual_build_name() */ - - -/*-------------------------------------------------------------------------- - * Function: H5D_getenv_prefix_name -- - * - * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, - * which is separated by the environment delimiter. - * env_prefix is modified to point to the remaining pathnames - * in the list. - * - * Return: A pointer to a pathname ---------------------------------------------------------------------------*/ -static char * -H5D_getenv_prefix_name(char **env_prefix/*in,out*/) -{ - char *retptr=NULL; - char *strret=NULL; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - strret = HDstrchr(*env_prefix, H5_COLON_SEPC); - if (strret == NULL) { - retptr = *env_prefix; - *env_prefix = strret; - } else { - retptr = *env_prefix; - *env_prefix = strret + 1; - *strret = '\0'; - } - - FUNC_LEAVE_NOAPI(retptr) -} /* end H5D_getenv_prefix_name() */ - -/*------------------------------------------------------------------------- - * Function: H5D__virtual_open_file - * - * Purpose: Attempts to open a source dataset file. - * - * Return: Non-negative on success/Negative on failure - *------------------------------------------------------------------------- - */ -static H5F_t * -H5D__virtual_open_file(H5P_genplist_t *plist, const H5F_t *vdset_file, - const char *file_name, - hid_t fapl_id, hid_t dxpl_id) -{ - H5F_t *src_file = NULL; /* Source file */ - H5F_t *ret_value = NULL; /* Actual return value */ - char *full_name = NULL; /* File name with prefix */ - char *my_prefix; /* Library's copy of the prefix */ - unsigned intent; /* File access permissions */ - char *actual_file_name = NULL; /* Virtual file's actual name */ - char *temp_file_name = NULL; /* Temporary pointer to file name */ - size_t temp_file_name_len; /* Length of temporary file name */ - - FUNC_ENTER_STATIC - - /* Simplify intent flags for open calls */ - intent = H5F_INTENT(vdset_file); - intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); - - /* Copy the file name to use */ - if(NULL == (temp_file_name = H5MM_strdup(file_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - temp_file_name_len = HDstrlen(temp_file_name); - - /* target file_name is an absolute pathname: see RM for detailed description */ - if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { - /* Try opening file */ - if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { - char *ptr; - - H5E_clear_stack(NULL); - - /* get last component of file_name */ - H5_GET_LAST_DELIMITER(file_name, ptr) - HDassert(ptr); - - /* Increment past delimiter */ - ptr++; - - /* Copy into the temp. file name */ - HDstrncpy(temp_file_name, ptr, temp_file_name_len); - temp_file_name[temp_file_name_len - 1] = '\0'; - } /* end if */ - } /* end if */ - else if(H5_CHECK_ABS_DRIVE(file_name)) { - /* Try opening file */ - if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { - - H5E_clear_stack(NULL); - - /* strip ":" */ - HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len); - temp_file_name[temp_file_name_len - 1] = '\0'; - } /* end if */ - } /* end if */ - - /* try searching from paths set in the environment variable */ - if(src_file == NULL) { - char *env_prefix; - - if(NULL != (env_prefix = HDgetenv("HDF5_VDS_PREFIX"))) { - char *tmp_env_prefix, *saved_env; - - if(NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - while((tmp_env_prefix) && (*tmp_env_prefix)) { - char *out_prefix_name; - - out_prefix_name = H5D_getenv_prefix_name(&tmp_env_prefix/*in,out*/); - if(out_prefix_name && (*out_prefix_name)) { - if(H5D__virtual_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { - saved_env = (char *)H5MM_xfree(saved_env); - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - } /* end if */ - - src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id); - full_name = (char *)H5MM_xfree(full_name); - if(src_file != NULL) - break; - H5E_clear_stack(NULL); - } /* end if */ - } /* end while */ - saved_env = (char *)H5MM_xfree(saved_env); - } /* end if */ - } /* end if */ - - /* try searching from property list */ - if(src_file == NULL) { - size_t size = 0; - if((size = H5Pget_virtual_prefix(plist, NULL, 0)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vds prefix") - /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (my_prefix = (char *)H5MM_malloc(size + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate prefix buffer") - if(H5Pget_virtual_prefix(plist, my_prefix, size+1) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vds prefix") - if(my_prefix) { - if(H5D__virtual_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ - } /* end if */ - - /* try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ - if(src_file == NULL) { - char *vdspath; - - if(NULL != (vdspath = H5F_EXTPATH(vdset_file))) { - if(H5D__virtual_build_name(vdspath, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ - } /* end if */ - - /* try the relative file_name stored in temp_file_name */ - if(src_file == NULL) { - if(NULL == (src_file = H5F_open(temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - } /* end if */ - - /* try the 'resolved' name for the virtual file */ - if(src_file == NULL) { - char *ptr = NULL; - - /* Copy resolved file name */ - if(NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(vdset_file)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string") - - /* get last component of file_name */ - H5_GET_LAST_DELIMITER(actual_file_name, ptr) - if(!ptr) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) - - /* Truncate filename portion from actual file name path */ - *ptr = '\0'; - - /* Build new file name for the external file */ - if(H5D__virtual_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - - /* Try opening with the resolved name */ - if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ - - /* Success */ - ret_value = src_file; -done: - if((NULL == ret_value) && src_file) - if(H5F_try_close(src_file, NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "can't close source file") - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__virtual_open_file() */ - /*------------------------------------------------------------------------- * Function: H5D__virtual_open_source_dset @@ -984,13 +750,9 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_srcdset_t *source_dset, hid_t dxpl_id) { H5F_t *src_file = NULL; /* Source file */ - char *vds_prefix = NULL; /* Source file vds_prefix */ hbool_t src_file_open = FALSE; /* Whether we have opened and need to close src_file */ H5G_loc_t src_root_loc; /* Object location of source file root group */ herr_t ret_value = SUCCEED; /* Return value */ - char *full_name = NULL; /* File name with prefix */ - unsigned intent; /* File access permissions */ - H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER_STATIC @@ -1003,9 +765,8 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, /* Check if we need to open the source file */ if(HDstrcmp(source_dset->file_name, ".")) { - if((plist = H5D_get_access_plist(vdset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist") - if(NULL == (src_file = H5D__virtual_open_file(plist, vdset->oloc.file, source_dset->file_name, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) + /* Open the source file */ + if(NULL == (src_file = H5F_open(source_dset->file_name, H5F_INTENT(vdset->oloc.file) & (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ), H5P_FILE_CREATE_DEFAULT, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ else src_file_open = TRUE; @@ -1646,7 +1407,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") } /* end if */ - /* Update cached values unlim_extent_source and + /* Update cached values unlim_extent_source and * clip_size_virtual */ storage->list[i].unlim_extent_source = curr_dims[storage->list[i].unlim_dim_source]; storage->list[i].clip_size_virtual = clip_size; @@ -1798,7 +1559,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space") /* Mark the space as dirty, for later writing to the file */ - if(H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) + if(H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") } /* end if */ @@ -2485,7 +2246,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space") storage->list[i].sub_dset[j].projected_mem_space = NULL; } /* end if */ - else + else *tot_nelmts += (hsize_t)select_nelmts; } /* end if */ } /* end for */ @@ -2504,7 +2265,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, /* Check if anything is selected */ if(select_nelmts > (hssize_t)0) { /* Open source dataset */ - if(!storage->list[i].source_dset.dset) + if(!storage->list[i].source_dset.dset) /* Try to open dataset */ if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") @@ -2745,7 +2506,7 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection") /* Write fill values to memory buffer */ - if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, + if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, type_info->mem_type, fill_space, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed") diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 96b8e36..daf0a52 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -25,13 +25,13 @@ typedef struct H5F_t H5F_t; #include "H5Fpublic.h" /* Public headers needed by this file */ -#include "H5FDpublic.h" /* File drivers */ +#include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ #ifdef H5_HAVE_PARALLEL -#include "H5Pprivate.h" /* Property lists */ +#include "H5Pprivate.h" /* Property lists */ #endif /* H5_HAVE_PARALLEL */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /**************************/ @@ -43,68 +43,68 @@ typedef struct H5F_t H5F_t; * Currently, all file meta-data is little-endian. */ -# define INT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ +# define INT16ENCODE(p, i) { \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } -# define UINT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ +# define UINT16ENCODE(p, i) { \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } -# define INT32ENCODE(p, i) { \ - *(p) = (uint8_t)( (uint32_t)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); (p)++; \ +# define INT32ENCODE(p, i) { \ + *(p) = (uint8_t)( (uint32_t)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); (p)++; \ } -# define UINT32ENCODE(p, i) { \ - *(p) = (uint8_t)( (i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \ +# define UINT32ENCODE(p, i) { \ + *(p) = (uint8_t)( (i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \ } /* Encode an unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define ENCODE_VAR(p, typ, n, l) { \ - typ _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for(_i = 0; _i < l; _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t*)(p) + l; \ +# define ENCODE_VAR(p, typ, n, l) { \ + typ _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for(_i = 0; _i < l; _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t*)(p) + l; \ } /* Encode a 32-bit unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ # define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l) -# define INT64ENCODE(p, n) { \ - int64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = (n) < 0 ? 0xff : 0; \ - (p) = (uint8_t*)(p)+8; \ +# define INT64ENCODE(p, n) { \ + int64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = (n) < 0 ? 0xff : 0; \ + (p) = (uint8_t*)(p)+8; \ } -# define UINT64ENCODE(p, n) { \ - uint64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = 0; \ - (p) = (uint8_t*)(p) + 8; \ +# define UINT64ENCODE(p, n) { \ + uint64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = 0; \ + (p) = (uint8_t*)(p) + 8; \ } /* Encode a 64-bit unsigned integer into a variable-sized buffer */ @@ -113,31 +113,31 @@ typedef struct H5F_t H5F_t; /* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define UINT64ENCODE_VARLEN(p, n) { \ - uint64_t __n = (uint64_t)(n); \ - unsigned _s = H5VM_limit_enc_size(__n); \ - \ - *(p)++ = (uint8_t)_s; \ - UINT64ENCODE_VAR(p, __n, _s); \ +# define UINT64ENCODE_VARLEN(p, n) { \ + uint64_t __n = (uint64_t)(n); \ + unsigned _s = H5VM_limit_enc_size(__n); \ + \ + *(p)++ = (uint8_t)_s; \ + UINT64ENCODE_VAR(p, __n, _s); \ } -# define H5_ENCODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32ENCODE(p, n) \ +# define H5_ENCODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32ENCODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ -# define H5_ENCODE_DOUBLE(p, n) { \ - uint64_t _n; \ - size_t _u; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - HDmemcpy(&_n, &n, sizeof(double)); \ - for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t *)(p) + 8; \ +# define H5_ENCODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + HDmemcpy(&_n, &n, sizeof(double)); \ + for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t *)(p) + 8; \ } /* DECODE converts little endian bytes pointed by p to integer values and store @@ -148,68 +148,68 @@ typedef struct H5F_t H5F_t; * correctly even if i is actually a 64bit int like in a Cray. */ -# define INT16DECODE(p, i) { \ - (i) = (int16_t)((*(p) & 0xff)); (p)++; \ +# define INT16DECODE(p, i) { \ + (i) = (int16_t)((*(p) & 0xff)); (p)++; \ (i) |= (int16_t)(((*(p) & 0xff) << 8) | \ - ((*(p) & 0x80) ? ~0xffff : 0x0)); (p)++; \ + ((*(p) & 0x80) ? ~0xffff : 0x0)); (p)++; \ } -# define UINT16DECODE(p, i) { \ - (i) = (uint16_t) (*(p) & 0xff); (p)++; \ - (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ +# define UINT16DECODE(p, i) { \ + (i) = (uint16_t) (*(p) & 0xff); (p)++; \ + (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ } -# define INT32DECODE(p, i) { \ - (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ +# define INT32DECODE(p, i) { \ + (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \ } -# define UINT32DECODE(p, i) { \ - (i) = (uint32_t)(*(p) & 0xff); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ +# define UINT32DECODE(p, i) { \ + (i) = (uint32_t)(*(p) & 0xff); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ } /* Decode a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define DECODE_VAR(p, n, l) { \ - size_t _i; \ - \ - n = 0; \ - (p) += l; \ - for (_i = 0; _i < l; _i++) \ - n = (n << 8) | *(--p); \ - (p) += l; \ +# define DECODE_VAR(p, n, l) { \ + size_t _i; \ + \ + n = 0; \ + (p) += l; \ + for (_i = 0; _i < l; _i++) \ + n = (n << 8) | *(--p); \ + (p) += l; \ } /* Decode a variable-sized buffer into a 32-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ # define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) -# define INT64DECODE(p, n) { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(int64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ +# define INT64DECODE(p, n) { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(int64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ } -# define UINT64DECODE(p, n) { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(uint64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ +# define UINT64DECODE(p, n) { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(uint64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ } /* Decode a variable-sized buffer into a 64-bit unsigned integer */ @@ -218,58 +218,58 @@ typedef struct H5F_t H5F_t; /* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define UINT64DECODE_VARLEN(p, n) { \ - unsigned _s = *(p)++; \ - \ - UINT64DECODE_VAR(p, n, _s); \ +# define UINT64DECODE_VARLEN(p, n) { \ + unsigned _s = *(p)++; \ + \ + UINT64DECODE_VAR(p, n, _s); \ } -# define H5_DECODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32DECODE(p, n) \ +# define H5_DECODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32DECODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ -# define H5_DECODE_DOUBLE(p, n) { \ - uint64_t _n; \ - size_t _u; \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - _n = 0; \ - (p) += 8; \ - for(_u = 0; _u < sizeof(uint64_t); _u++) \ - _n = (_n << 8) | *(--p); \ - HDmemcpy(&(n), &_n, sizeof(double)); \ - (p) += 8; \ +# define H5_DECODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + _n = 0; \ + (p) += 8; \ + for(_u = 0; _u < sizeof(uint64_t); _u++) \ + _n = (_n << 8) | *(--p); \ + HDmemcpy(&(n), &_n, sizeof(double)); \ + (p) += 8; \ } /* Address-related macros */ -#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ - HADDR_UNDEF==(X)+(haddr_t)(Z) || \ - (X)+(haddr_t)(Z)<(X)) -#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) +#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ + HADDR_UNDEF==(X)+(haddr_t)(Z) || \ + (X)+(haddr_t)(Z)<(X)) +#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) /* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making * certain that X is not HADDR_UNDEF and then checking that X equals Y */ -#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ - (X)==(Y)) -#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>=(Y)) -#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ - (H5F_addr_lt((X), (Y)) ? -1 : 1)) -#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) +#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ + (X)==(Y)) +#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) +#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<(Y)) +#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<=(Y)) +#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>(Y)) +#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>=(Y)) +#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ + (H5F_addr_lt((X), (Y)) ? -1 : 1)) +#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) #define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \ ((O1) >= (O2) && (O1) < ((O2) + (L2)))) @@ -294,7 +294,7 @@ typedef struct H5F_t H5F_t; #define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr) #define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k) #define H5F_KVALUE(F,T) ((F)->shared->sblock->btree_k[(T)->id]) -#define H5F_NREFS(F) ((F)->shared->nrefs) +#define H5F_NREFS(F) ((F)->shared->nrefs) #define H5F_SIZEOF_ADDR(F) ((F)->shared->sizeof_addr) #define H5F_SIZEOF_SIZE(F) ((F)->shared->sizeof_size) #define H5F_SOHM_ADDR(F) ((F)->shared->sohm_addr) @@ -325,8 +325,8 @@ typedef struct H5F_t H5F_t; #define H5F_USE_MDC_LOGGING(F) ((F)->shared->use_mdc_logging) #define H5F_START_MDC_LOG_ON_ACCESS(F) ((F)->shared->start_mdc_log_on_access) #define H5F_MDC_LOG_LOCATION(F) ((F)->shared->mdc_log_location) -#define H5F_ALIGNMENT(F) ((F)->shared->alignment) -#define H5F_THRESHOLD(F) ((F)->shared->threshold) +#define H5F_ALIGNMENT(F) ((F)->shared->alignment) +#define H5F_THRESHOLD(F) ((F)->shared->threshold) #define H5F_PGEND_META_THRES(F) ((F)->shared->fs.pgend_meta_thres) #define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return) #define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc) @@ -351,7 +351,7 @@ typedef struct H5F_t H5F_t; #define H5F_BASE_ADDR(F) (H5F_get_base_addr(F)) #define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F)) #define H5F_KVALUE(F,T) (H5F_Kvalue(F,T)) -#define H5F_NREFS(F) (H5F_get_nrefs(F)) +#define H5F_NREFS(F) (H5F_get_nrefs(F)) #define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) #define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) #define H5F_SOHM_ADDR(F) (H5F_get_sohm_addr(F)) @@ -382,8 +382,8 @@ typedef struct H5F_t H5F_t; #define H5F_USE_MDC_LOGGING(F) (H5F_use_mdc_logging(F)) #define H5F_START_MDC_LOG_ON_ACCESS(F) (H5F_start_mdc_log_on_access(F)) #define H5F_MDC_LOG_LOCATION(F) (H5F_mdc_log_location(F)) -#define H5F_ALIGNMENT(F) (H5F_get_alignment(F)) -#define H5F_THRESHOLD(F) (H5F_get_threshold(F)) +#define H5F_ALIGNMENT(F) (H5F_get_alignment(F)) +#define H5F_THRESHOLD(F) (H5F_get_threshold(F)) #define H5F_PGEND_META_THRES(F) (H5F_get_pgend_meta_thres(F)) #define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F)) #define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F)) @@ -392,32 +392,32 @@ typedef struct H5F_t H5F_t; /* Macros to encode/decode offset/length's for storing in the file */ -#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ - case 4: UINT32ENCODE(p,o); break; \ - case 8: UINT64ENCODE(p,o); break; \ - case 2: UINT16ENCODE(p,o); break; \ +#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ + case 4: UINT32ENCODE(p,o); break; \ + case 8: UINT64ENCODE(p,o); break; \ + case 2: UINT16ENCODE(p,o); break; \ } -#define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) { \ - case 4: UINT32DECODE(p, o); break; \ - case 8: UINT64DECODE(p, o); break; \ - case 2: UINT16DECODE(p, o); break; \ +#define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) { \ + case 4: UINT32DECODE(p, o); break; \ + case 8: UINT64DECODE(p, o); break; \ + case 2: UINT16DECODE(p, o); break; \ } -#define H5F_ENCODE_LENGTH_LEN(p,l,s) switch(s) { \ - case 4: UINT32ENCODE(p,l); break; \ - case 8: UINT64ENCODE(p,l); break; \ - case 2: UINT16ENCODE(p,l); break; \ - default: HDassert("bad sizeof size" && 0); \ +#define H5F_ENCODE_LENGTH_LEN(p,l,s) switch(s) { \ + case 4: UINT32ENCODE(p,l); break; \ + case 8: UINT64ENCODE(p,l); break; \ + case 2: UINT16ENCODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_ENCODE_LENGTH(f,p,l) H5F_ENCODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) -#define H5F_DECODE_LENGTH_LEN(p,l,s) switch(s) { \ - case 4: UINT32DECODE(p,l); break; \ - case 8: UINT64DECODE(p,l); break; \ - case 2: UINT16DECODE(p,l); break; \ - default: HDassert("bad sizeof size" && 0); \ +#define H5F_DECODE_LENGTH_LEN(p,l,s) switch(s) { \ + case 4: UINT32DECODE(p,l); break; \ + case 8: UINT64DECODE(p,l); break; \ + case 2: UINT16DECODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_DECODE_LENGTH(f,p,l) H5F_DECODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) @@ -427,13 +427,13 @@ typedef struct H5F_t H5F_t; * with. */ #if (H5_SIZEOF_SIZE_T >= H5_SIZEOF_OFF_T) -# define H5F_OVERFLOW_SIZET2OFFT(X) \ +# define H5F_OVERFLOW_SIZET2OFFT(X) \ ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(HDoff_t)-1))) #else # define H5F_OVERFLOW_SIZET2OFFT(X) 0 #endif #if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T) -# define H5F_OVERFLOW_HSIZET2OFFT(X) \ +# define H5F_OVERFLOW_HSIZET2OFFT(X) \ ((hsize_t)(X) >= (hsize_t)((hsize_t)1 << (8 * sizeof(HDoff_t) - 1))) #else # define H5F_OVERFLOW_HSIZET2OFFT(X) 0 @@ -461,14 +461,14 @@ typedef struct H5F_t H5F_t; #define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */ #define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */ #define H5F_CRT_FILE_SPACE_STRATEGY_NAME "file_space_strategy" /* File space handling strategy */ -#define H5F_CRT_FREE_SPACE_PERSIST_NAME "free_space_persist" /* Free-space persisting status */ +#define H5F_CRT_FREE_SPACE_PERSIST_NAME "free_space_persist" /* Free-space persisting status */ #define H5F_CRT_FREE_SPACE_THRESHOLD_NAME "free_space_threshold" /* Free space section threshold */ #define H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME "file_space_page_size" /* File space page size */ /* ========= File Access properties ============ */ -#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ +#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ #define H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ #define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ #define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ @@ -487,7 +487,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_LATEST_FORMAT_NAME "latest_format" /* 'Use latest format version' flag */ #define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */ #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ -#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ +#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ @@ -504,7 +504,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME "page_buffer_min_raw_perc" /* the min raw data percentage for the page buffer cache */ /* ======================== File Mount properties ====================*/ -#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ +#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ #ifdef H5_HAVE_PARALLEL @@ -513,20 +513,20 @@ typedef struct H5F_t H5F_t; #endif /* H5_HAVE_PARALLEL */ /* Define the HDF5 file signature */ -#define H5F_SIGNATURE "\211HDF\r\n\032\n" +#define H5F_SIGNATURE "\211HDF\r\n\032\n" #define H5F_SIGNATURE_LEN 8 /* Version #'s of the major components of the file format */ -#define HDF5_SUPERBLOCK_VERSION_DEF 0 /* The default super block format */ -#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */ -#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_DEF 0 /* The default super block format */ +#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */ +#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 */ -#define HDF5_DRIVERINFO_VERSION_0 0 /* of the Driver Information Block*/ +#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 */ +#define HDF5_DRIVERINFO_VERSION_0 0 /* of the Driver Information Block*/ /* B-tree internal 'K' values */ #define HDF5_BTREE_SNODE_IK_DEF 16 @@ -536,54 +536,54 @@ typedef struct H5F_t H5F_t; if it is changed, the code must compensate. -QAK */ -#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */ - /* See format specification on version 1 B-trees */ +#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */ + /* See format specification on version 1 B-trees */ /* Default file space handling strategy */ -#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR +#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR /* Default free space section threshold used by free-space managers */ -#define H5F_FREE_SPACE_PERSIST_DEF FALSE +#define H5F_FREE_SPACE_PERSIST_DEF FALSE /* Default free space section threshold used by free-space managers */ -#define H5F_FREE_SPACE_THRESHOLD_DEF 1 +#define H5F_FREE_SPACE_THRESHOLD_DEF 1 /* For paged aggregation: default file space page size when not set */ -#define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096 +#define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096 /* For paged aggregation: minimum value for file space page size */ -#define H5F_FILE_SPACE_PAGE_SIZE_MIN 512 +#define H5F_FILE_SPACE_PAGE_SIZE_MIN 512 /* For paged aggregation: maxiumum value for file space page size: 1 gigabyte */ -#define H5F_FILE_SPACE_PAGE_SIZE_MAX 1024*1024*1024 +#define H5F_FILE_SPACE_PAGE_SIZE_MAX 1024*1024*1024 /* For paged aggregation: drop free-space with size <= this threshold for small meta section */ #define H5F_FILE_SPACE_PGEND_META_THRES 0 /* Default for threshold for alignment (can be set via H5Pset_alignment()) */ -#define H5F_ALIGN_DEF 1 +#define H5F_ALIGN_DEF 1 /* Default for alignment (can be set via H5Pset_alignment()) */ -#define H5F_ALIGN_THRHD_DEF 1 +#define H5F_ALIGN_THRHD_DEF 1 /* Default size for meta data aggregation block (can be set via H5Pset_meta_block_size()) */ -#define H5F_META_BLOCK_SIZE_DEF 2048 +#define H5F_META_BLOCK_SIZE_DEF 2048 /* Default size for small data aggregation block (can be set via H5Pset_small_data_block_size()) */ -#define H5F_SDATA_BLOCK_SIZE_DEF 2048 +#define H5F_SDATA_BLOCK_SIZE_DEF 2048 /* Check for file using paged aggregation */ #define H5F_PAGED_AGGR(F) (F->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && F->shared->fs_page_size) /* Metadata read attempt values */ -#define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */ -#define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */ +#define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */ +#define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */ /* Macros to define signatures of all objects in the file */ /* Size of signature information (on disk) */ /* (all on-disk signatures should be this length) */ -#define H5_SIZEOF_MAGIC 4 +#define H5_SIZEOF_MAGIC 4 /* Size of checksum information (on disk) */ /* (all on-disk checksums should be this length) */ -#define H5_SIZEOF_CHKSUM 4 +#define H5_SIZEOF_CHKSUM 4 /* v1 B-tree node signature */ #define H5B_MAGIC "TREE" @@ -704,11 +704,11 @@ typedef enum H5F_fs_state_t { typedef enum H5F_mem_page_t { H5F_MEM_PAGE_DEFAULT = 0, /* Not used */ H5F_MEM_PAGE_SUPER = 1, - H5F_MEM_PAGE_BTREE = 2, - H5F_MEM_PAGE_DRAW = 3, - H5F_MEM_PAGE_GHEAP = 4, - H5F_MEM_PAGE_LHEAP = 5, - H5F_MEM_PAGE_OHDR = 6, + H5F_MEM_PAGE_BTREE = 2, + H5F_MEM_PAGE_DRAW = 3, + H5F_MEM_PAGE_GHEAP = 4, + H5F_MEM_PAGE_LHEAP = 5, + H5F_MEM_PAGE_OHDR = 6, H5F_MEM_PAGE_LARGE_SUPER = 7, H5F_MEM_PAGE_LARGE_BTREE = 8, H5F_MEM_PAGE_LARGE_DRAW = 9, diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 4765d00..61b4183 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -144,7 +144,7 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's location + * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location * when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index da06297..494de3e 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -71,17 +71,6 @@ #define H5D_ACS_VDS_PRINTF_GAP_DEF (hsize_t)0 #define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t #define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t -/* Definitions for VDS file prefix */ -#define H5D_ACS_VDS_PREFIX_SIZE sizeof(char *) -#define H5D_ACS_VDS_PREFIX_DEF NULL /*default is no prefix */ -#define H5D_ACS_VDS_PREFIX_SET H5P__dapl_vds_file_pref_set -#define H5D_ACS_VDS_PREFIX_GET H5P__dapl_vds_file_pref_get -#define H5D_ACS_VDS_PREFIX_ENC H5P__dapl_vds_file_pref_enc -#define H5D_ACS_VDS_PREFIX_DEC H5P__dapl_vds_file_pref_dec -#define H5D_ACS_VDS_PREFIX_DEL H5P__dapl_vds_file_pref_del -#define H5D_ACS_VDS_PREFIX_COPY H5P__dapl_vds_file_pref_copy -#define H5D_ACS_VDS_PREFIX_CMP H5P__dapl_vds_file_pref_cmp -#define H5D_ACS_VDS_PREFIX_CLOSE H5P__dapl_vds_file_pref_close /* Definition for append flush */ #define H5D_ACS_APPEND_FLUSH_SIZE sizeof(H5D_append_flush_t) #define H5D_ACS_APPEND_FLUSH_DEF {0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},NULL,NULL} @@ -123,14 +112,6 @@ static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /* Property list callbacks */ static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); -static herr_t H5P__dapl_vds_file_pref_set(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_vds_file_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P__dapl_vds_file_pref_dec(const void **_pp, void *value); -static herr_t H5P__dapl_vds_file_pref_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_vds_file_pref_copy(const char* name, size_t size, void* value); -static int H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P__dapl_vds_file_pref_close(const char* name, size_t size, void* value); /* Property list callbacks */ static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); @@ -179,7 +160,6 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /* Property value defaults */ static const H5D_append_flush_t H5D_def_append_flush_g = H5D_ACS_APPEND_FLUSH_DEF; /* Default setting for append flush */ static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ -static const char *H5D_def_vds_prefix_g = H5D_ACS_VDS_PREFIX_DEF; /* Default vds prefix string */ /*------------------------------------------------------------------------- @@ -230,12 +210,6 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register property for vds prefix */ - if(H5P_register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, - NULL, H5D_ACS_VDS_PREFIX_SET, H5D_ACS_VDS_PREFIX_GET, H5D_ACS_VDS_PREFIX_ENC, H5D_ACS_VDS_PREFIX_DEC, - H5D_ACS_VDS_PREFIX_DEL, H5D_ACS_VDS_PREFIX_COPY, H5D_ACS_VDS_PREFIX_CMP, H5D_ACS_VDS_PREFIX_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register info for append flush */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, @@ -252,254 +226,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dacc_reg_prop() */ - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_set - * - * Purpose: Copies a vds file prefix property when it's set - * for a property list - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_vds_file_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_STATIC_NOERR - - /* Sanity check */ - HDassert(value); - - /* Copy the prefix */ - *(char **)value = H5MM_xstrdup(*(const char **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_vds_file_pref_set() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_get - * - * Purpose: Copies a vds file prefix property when it's retrieved - * from a property list - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_vds_file_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_STATIC_NOERR - - /* Sanity check */ - HDassert(value); - - /* Copy the prefix */ - *(char **)value = H5MM_xstrdup(*(const char **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_vds_file_pref_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_enc - * - * Purpose: Callback routine which is called whenever the vds file flags - * property in the dataset access property list is - * encoded. - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) -{ - const char *vds_file_pref = *(const char * const *)value; - uint8_t **pp = (uint8_t **)_pp; - size_t len = 0; - uint64_t enc_value; - unsigned enc_size; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - - /* calculate prefix length */ - if(NULL != vds_file_pref) - len = HDstrlen(vds_file_pref); - - enc_value = (uint64_t)len; - enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); - - if(NULL != *pp) { - /* encode the length of the prefix */ - *(*pp)++ = (uint8_t)enc_size; - UINT64ENCODE_VAR(*pp, enc_value, enc_size); - - /* encode the prefix */ - if(NULL != vds_file_pref) { - HDmemcpy(*(char **)pp, vds_file_pref, len); - *pp += len; - } /* end if */ - } /* end if */ - - *size += (1 + enc_size); - if(NULL != vds_file_pref) - *size += len; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_vds_file_pref_enc() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_dec - * - * Purpose: Callback routine which is called whenever the vds file prefix - * property in the dataset access property list is - * decoded. - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) -{ - char **vds_file_pref = (char **)_value; - const uint8_t **pp = (const uint8_t **)_pp; - size_t len; - uint64_t enc_value; /* Decoded property value */ - unsigned enc_size; /* Size of encoded property */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(pp); - HDassert(*pp); - HDassert(vds_file_pref); - HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - - /* Decode the size */ - enc_size = *(*pp)++; - HDassert(enc_size < 256); - - /* Decode the value */ - UINT64DECODE_VAR(*pp, enc_value, enc_size); - len = (size_t)enc_value; - - if(0 != len) { - /* Make a copy of the user's prefix string */ - if(NULL == (*vds_file_pref = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") - HDstrncpy(*vds_file_pref, *(const char **)pp, len); - (*vds_file_pref)[len] = '\0'; - - *pp += len; - } /* end if */ - else - *vds_file_pref = NULL; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dapl_vds_file_pref_dec() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_del - * - * Purpose: Frees memory used to store the vds file prefix string - * - * Return: SUCCEED (Can't fail) - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(value); - - H5MM_xfree(*(void **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_vds_file_pref_del() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_copy - * - * Purpose: Creates a copy of the vds file prefix string - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_vds_file_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(value); - - *(char **)value = H5MM_xstrdup(*(const char **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_vds_file_pref_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_cmp - * - * Purpose: Callback routine which is called whenever the vds file prefix - * property in the dataset creation property list is - * compared. - * - * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. - *------------------------------------------------------------------------- - */ -static int -H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) -{ - const char *pref1 = *(const char * const *)value1; - const char *pref2 = *(const char * const *)value2; - int ret_value = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(NULL == pref1 && NULL != pref2) - HGOTO_DONE(1); - if(NULL != pref1 && NULL == pref2) - HGOTO_DONE(-1); - if(NULL != pref1 && NULL != pref2) - ret_value = HDstrcmp(pref1, pref2); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dapl_vds_file_pref_cmp() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_vds_file_pref_close - * - * Purpose: Frees memory used to store the vds file prefix string - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_vds_file_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(value); - - H5MM_xfree(*(void **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_vds_file_pref_close() */ - /*------------------------------------------------------------------------- * Function: H5P__dapl_efile_pref_set @@ -1494,95 +1220,3 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_efile_prefix() */ - -/*------------------------------------------------------------------------- - * Function: H5Pset_virtual_prefix - * - * Purpose: Set a prefix to be applied to the path of any vds files - * traversed. - * - * If the prefix starts with ${ORIGIN}, this will be replaced by - * the absolute path of the directory of the HDF5 file containing - * the dataset. - * - * If the prefix is ".", no prefix will be applied. - * - * This property can be overwritten by the environment variable - * HDF5_VDS_PREFIX. - * - * Return: Non-negative on success/Negative on failure - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_virtual_prefix(hid_t plist_id, const char *prefix) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*s", plist_id, prefix); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Set prefix */ - if(H5P_set(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_virtual_prefix() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_virtual_prefix - * - * Purpose: Gets the prefix to be applied to any vds file - * traversals made using this property list. - * - * If the pointer is not NULL, it points to a user-allocated - * buffer. - * - * Return: Non-negative on success/Negative on failure - *------------------------------------------------------------------------- - */ -ssize_t -H5Pget_virtual_prefix(hid_t plist_id, char *prefix, size_t size) -{ - H5P_genplist_t *plist; /* Property list pointer */ - char *my_prefix; /* Library's copy of the prefix */ - size_t len; /* Length of prefix string */ - ssize_t ret_value; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "i*sz", plist_id, prefix, size); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get the current prefix */ - if(H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file prefix") - - /* Check for prefix being set */ - if(my_prefix) { - /* Copy to user's buffer, if given */ - len = HDstrlen(my_prefix); - if(prefix) { - HDstrncpy(prefix, my_prefix, MIN(len + 1, size)); - if(len >= size) - prefix[size - 1] = '\0'; - } /* end if */ - } /* end if */ - else - len = 0; - - /* Set return value */ - ret_value = (ssize_t)len; - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_virtual_prefix() */ - diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index ea9bfb4..915aa38 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -13,9 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pfapl.c + * Created: H5Pfapl.c * - * Purpose: File access property list class routines + * Purpose: File access property list class routines * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ #include "H5Ppkg.h" /* Property lists */ /* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ +#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ #include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ @@ -54,10 +54,10 @@ /* ========= File Access properties ============ */ /* Definitions for the initial metadata cache resize configuration */ -#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) -#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG -#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc -#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec +#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG +#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec #define H5F_ACS_META_CACHE_INIT_CONFIG_CMP H5P__facc_cache_config_cmp /* Definitions for size of raw data chunk cache(slots) */ #define H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t) @@ -118,10 +118,10 @@ #define H5F_ACS_FILE_DRV_CMP H5P__facc_file_driver_cmp #define H5F_ACS_FILE_DRV_CLOSE H5P__facc_file_driver_close /* Definition for file close degree */ -#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) -#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT -#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc -#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec +#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) +#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT +#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc +#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec /* Definition for offset position in file for family file driver */ #define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t) #define H5F_ACS_FAMILY_OFFSET_DEF 0 @@ -175,12 +175,12 @@ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t /* Definition for # of metadata read attempts */ -#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned) -#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0 -#define H5F_ACS_METADATA_READ_ATTEMPTS_ENC H5P__encode_unsigned -#define H5F_ACS_METADATA_READ_ATTEMPTS_DEC H5P__decode_unsigned +#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned) +#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0 +#define H5F_ACS_METADATA_READ_ATTEMPTS_ENC H5P__encode_unsigned +#define H5F_ACS_METADATA_READ_ATTEMPTS_DEC H5P__decode_unsigned /* Definition for object flush callback */ -#define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) +#define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) #define H5F_ACS_OBJECT_FLUSH_CB_DEF {NULL, NULL} /* Definition for status_flags in the superblock */ #define H5F_ACS_CLEAR_STATUS_FLAGS_SIZE sizeof(hbool_t) @@ -309,21 +309,21 @@ static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); /* File access property list class library initialization object */ const H5P_libclass_t H5P_CLS_FACC[1] = {{ - "file access", /* Class name for debugging */ + "file access", /* Class name for debugging */ H5P_TYPE_FILE_ACCESS, /* Class type */ - &H5P_CLS_ROOT_g, /* Parent class */ - &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ - &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ - &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P__facc_reg_prop, /* 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 */ + &H5P_CLS_ROOT_g, /* Parent class */ + &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ + &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ + H5P__facc_reg_prop, /* 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 */ }}; @@ -395,149 +395,149 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, - NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, - NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, - NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, - NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, + if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, + NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, - NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, + if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, - NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, + if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, - NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, + NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, - NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, + NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, - NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, + NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, - NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, + if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, + NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ - if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, - NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, + if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, + NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, - NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, + NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of new family file size. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, - NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, + if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, + NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'use the latest version of the format' flag */ - if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g, - NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC, + if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g, + NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, + if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file cache size */ - if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, - NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, + NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, + if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) 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, - NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, + 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, - NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, + 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") /* Register the # of read attempts */ - if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, - NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, + if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, + NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object flush callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, + if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -563,44 +563,44 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the evict on close flag */ - if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, - NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, + if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, + NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, - NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective write flag */ - if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, - NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, + if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ /* Register the initial metadata cache image configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, - NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum metadata size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum raw data size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -610,33 +610,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_alignment + * Function: H5Pset_alignment * - * Purpose: Sets the alignment properties of a file access property list - * so that any file object >= THRESHOLD bytes will be aligned on - * an address which is a multiple of ALIGNMENT. The addresses - * are relative to the end of the user block; the alignment is - * calculated by subtracting the user block size from the - * absolute file address and then adjusting the address to be a - * multiple of ALIGNMENT. + * Purpose: Sets the alignment properties of a file access property list + * so that any file object >= THRESHOLD bytes will be aligned on + * an address which is a multiple of ALIGNMENT. The addresses + * are relative to the end of the user block; the alignment is + * calculated by subtracting the user block size from the + * absolute file address and then adjusting the address to be a + * multiple of ALIGNMENT. * - * Default values for THRESHOLD and ALIGNMENT are one, implying - * no alignment. Generally the default values will result in - * the best performance for single-process access to the file. - * For MPI-IO and other parallel systems, choose an alignment - * which is a multiple of the disk block size. + * Default values for THRESHOLD and ALIGNMENT are one, implying + * no alignment. Generally the default values will result in + * the best performance for single-process access to the file. + * For MPI-IO and other parallel systems, choose an alignment + * which is a multiple of the disk block size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed file access property list mechanism to the new - * generic property list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed file access property list mechanism to the new + * generic property list. *------------------------------------------------------------------------- */ herr_t @@ -668,15 +668,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_alignment + * Function: H5Pget_alignment * - * Purpose: Returns the current settings for alignment properties from a - * file access property list. The THRESHOLD and/or ALIGNMENT - * pointers may be null pointers. + * Purpose: Returns the current settings for alignment properties from a + * file access property list. The THRESHOLD and/or ALIGNMENT + * pointers may be null pointers. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * *------------------------------------------------------------------------- @@ -709,20 +709,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_set_driver + * Function: H5P_set_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -757,20 +757,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_driver + * Function: H5Pset_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -800,20 +800,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_peek_driver + * Function: H5P_peek_driver * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -844,22 +844,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_driver + * Function: H5Pget_driver * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Note: The ID returned should not be closed. + * Note: The ID returned should not be closed. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -867,7 +867,7 @@ hid_t H5Pget_driver(hid_t plist_id) { H5P_genplist_t *plist; /* Property list pointer */ - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", plist_id); @@ -885,20 +885,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_peek_driver_info + * Function: H5P_peek_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -927,20 +927,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_driver_info + * Function: H5Pget_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -973,7 +973,7 @@ done: * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. + * finishes the "deep" part of the copy. * * Return: Success: Non-negative * Failure: Negative @@ -1486,30 +1486,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_cache + * Function: H5Pset_cache * - * Purpose: Set the number of objects in the meta data cache and the - * maximum number of chunks and bytes in the raw data chunk - * cache. + * Purpose: Set the number of objects in the meta data cache and the + * maximum number of chunks and bytes in the raw data chunk + * cache. * - * The RDCC_W0 value should be between 0 and 1 inclusive and - * indicates how much chunks that have been fully read or fully - * written are favored for preemption. A value of zero means - * fully read or written chunks are treated no differently than - * other chunks (the preemption is strictly LRU) while a value - * of one means fully read chunks are always preempted before - * other chunks. + * The RDCC_W0 value should be between 0 and 1 inclusive and + * indicates how much chunks that have been fully read or fully + * written are favored for preemption. A value of zero means + * fully read or written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) while a value + * of one means fully read chunks are always preempted before + * other chunks. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, - size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) + size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ @@ -1540,24 +1540,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_cache + * Function: H5Pget_cache * - * Purpose: Retrieves the maximum possible number of elements in the meta - * data cache and the maximum possible number of elements and - * bytes and the RDCC_W0 value in the raw data chunk cache. Any - * (or all) arguments may be null pointers in which case the - * corresponding datum is not returned. + * Purpose: Retrieves the maximum possible number of elements in the meta + * data cache and the maximum possible number of elements and + * bytes and the RDCC_W0 value in the raw data chunk cache. Any + * (or all) arguments may be null pointers in which case the + * corresponding datum is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, - size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) + size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ @@ -1592,14 +1592,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_image_config + * Function: H5Pset_mdc_image_config * - * Purpose: Set the initial metadata cache image configuration in the - * target FAPL. + * Purpose: Set the initial metadata cache image configuration in the + * target FAPL. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, June 25, 2015 * *------------------------------------------------------------------------- @@ -1636,18 +1636,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_image_config + * Function: H5Pget_mdc_image_config * - * Purpose: Retrieve the metadata cache initial image configuration - * from the target FAPL. + * Purpose: Retrieve the metadata cache initial image configuration + * from the target FAPL. * - * Observe that the function will fail if config_ptr is - * NULL, or if config_ptr->version specifies an unknown - * version of H5AC_cache_image_config_t. + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_image_config_t. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Friday, June 26, 2015 * *------------------------------------------------------------------------- @@ -1687,14 +1687,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_config + * Function: H5Pset_mdc_config * - * Purpose: Set the initial metadata cache resize configuration in the - * target FAPL. + * Purpose: Set the initial metadata cache resize configuration in the + * target FAPL. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, April 7, 2005 * *------------------------------------------------------------------------- @@ -1731,18 +1731,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_config + * Function: H5Pget_mdc_config * - * Purpose: Retrieve the metadata cache initial resize configuration - * from the target FAPL. + * Purpose: Retrieve the metadata cache initial resize configuration + * from the target FAPL. * - * Observe that the function will fail if config_ptr is - * NULL, or if config_ptr->version specifies an unknown - * version of H5AC_cache_config_t. + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_config_t. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, April 7, 2005 * *------------------------------------------------------------------------- @@ -1782,33 +1782,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_gc_references + * Function: H5Pset_gc_references * - * Purpose: Sets the flag for garbage collecting references for the file. - * Dataset region references (and other reference types - * probably) use space in the file heap. If garbage collection - * is on and the user passes in an uninitialized value in a - * reference structure, the heap might get corrupted. When - * garbage collection is off however and the user re-uses a - * reference, the previous heap block will be orphaned and not - * returned to the free heap space. When garbage collection is - * on, the user must initialize the reference structures to 0 or - * risk heap corruption. + * Purpose: Sets the flag for garbage collecting references for the file. + * Dataset region references (and other reference types + * probably) use space in the file heap. If garbage collection + * is on and the user passes in an uninitialized value in a + * reference structure, the heap might get corrupted. When + * garbage collection is off however and the user re-uses a + * reference, the previous heap block will be orphaned and not + * returned to the free heap space. When garbage collection is + * on, the user must initialize the reference structures to 0 or + * risk heap corruption. * - * Default value for garbage collecting references is off, just - * to be on the safe side. + * Default value for garbage collecting references is off, just + * to be on the safe side. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June, 1999 + * Programmer: Quincey Koziol + * June, 1999 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -1835,22 +1835,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_gc_references + * Function: H5Pget_gc_references * - * Purpose: Returns the current setting for the garbage collection - * references property from a file access property list. + * Purpose: Returns the current setting for the garbage collection + * references property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * June, 1999 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -1949,31 +1949,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_meta_block_size + * Function: H5Pset_meta_block_size * - * Purpose: Sets the minimum size of metadata block allocations when + * Purpose: Sets the minimum size of metadata block allocations when * the H5FD_FEAT_AGGREGATE_METADATA is set by a VFL driver. * Each "raw" metadata block is allocated to be this size and then * specific pieces of metadata (object headers, local heaps, B-trees, etc) * are sub-allocated from this block. * - * The default value is set to 2048 (bytes), indicating that metadata + * The default value is set to 2048 (bytes), indicating that metadata * will be attempted to be bunched together in (at least) 2K blocks in * the file. Setting the value to 0 with this API function will * turn off the metadata aggregation, even if the VFL driver attempts to * use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2000,22 +2000,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_meta_block_size + * Function: H5Pget_meta_block_size * - * Purpose: Returns the current settings for the metadata block allocation + * Purpose: Returns the current settings for the metadata block allocation * property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 29, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2044,31 +2044,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_sieve_buf_size + * Function: H5Pset_sieve_buf_size * - * Purpose: Sets the maximum size of the data seive buffer used for file + * Purpose: Sets the maximum size of the data seive buffer used for file * drivers which are capable of using data sieving. The data sieve * buffer is used when performing I/O on datasets in the file. Using a * buffer which is large anough to hold several pieces of the dataset * being read in for hyperslab selections boosts performance by quite a * bit. * - * The default value is set to 64KB, indicating that file I/O for raw data + * The default value is set to 64KB, indicating that file I/O for raw data * reads and writes will occur in at least 64KB blocks. * Setting the value to 0 with this API function will turn off the * data sieving, even if the VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2095,22 +2095,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_sieve_buf_size + * Function: H5Pget_sieve_buf_size * - * Purpose: Returns the current settings for the data sieve buffer size + * Purpose: Returns the current settings for the data sieve buffer size * property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2138,23 +2138,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_small_data_block_size + * Function: H5Pset_small_data_block_size * - * Purpose: Sets the minimum size of "small" raw data block allocations + * Purpose: Sets the minimum size of "small" raw data block allocations * when the H5FD_FEAT_AGGREGATE_SMALLDATA is set by a VFL driver. * Each "small" raw data block is allocated to be this size and then * pieces of raw data which are small enough to fit are sub-allocated from * this block. * - * The default value is set to 2048 (bytes), indicating that raw data + * The default value is set to 2048 (bytes), indicating that raw data * smaller than this value will be attempted to be bunched together in (at * least) 2K blocks in the file. Setting the value to 0 with this API * function will turn off the "small" raw data aggregation, even if the * VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * * Modifications: @@ -2184,14 +2184,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_small_data_block_size + * Function: H5Pget_small_data_block_size * - * Purpose: Returns the current settings for the "small" raw data block + * Purpose: Returns the current settings for the "small" raw data block * allocation property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * * Modifications: @@ -2223,9 +2223,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_libver_bounds + * Function: H5Pset_libver_bounds * - * Purpose: Indicates which versions of the file format the library should + * Purpose: Indicates which versions of the file format the library should * use when creating objects. LOW is the earliest version of the HDF5 * library that is guaranteed to be able to access the objects created * (the format of some objects in an HDF5 file may not have changed between @@ -2301,9 +2301,9 @@ done: * releases and then map down to the previous actual library release which * had a format change. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, December 30, 2007 * *------------------------------------------------------------------------- @@ -2341,14 +2341,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_libver_bounds + * Function: H5Pget_libver_bounds * - * Purpose: Returns the current settings for the library version format bounds + * Purpose: Returns the current settings for the library version format bounds * from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 3, 2008 * *------------------------------------------------------------------------- @@ -2464,9 +2464,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_file_image * - * Purpose: Sets the initial file image. Some file drivers can initialize - * the starting data in a file from a buffer. - * + * Purpose: Sets the initial file image. Some file drivers can initialize + * the starting data in a file from a buffer. + * * Return: Non-negative on success/Negative on failure * * Programmer: Jacob Gruber @@ -2480,22 +2480,22 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) H5P_genplist_t *fapl; /* Property list pointer */ H5FD_file_image_info_t image_info; /* File image info */ herr_t ret_value = SUCCEED; /* Return value */ - + FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*xz", fapl_id, buf_ptr, buf_len); /* validate parameters */ if(!(((buf_ptr == NULL) && (buf_len == 0)) || ((buf_ptr != NULL) && (buf_len > 0)))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistant buf_ptr and buf_len") - + /* Get the plist structure */ if(NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - + /* Get old image info */ if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image pointer") - + /* Release previous buffer, if it exists */ if(image_info.buffer != NULL) { if(image_info.callbacks.image_free) { @@ -2504,8 +2504,8 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) } /* end if */ else H5MM_xfree(image_info.buffer); - } /* end if */ - + } /* end if */ + /* Update struct */ if(buf_ptr) { /* Allocate memory */ @@ -2517,15 +2517,15 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) else if(NULL == (image_info.buffer = H5MM_malloc(buf_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") - + /* Copy data */ if(image_info.callbacks.image_memcpy) { - if(image_info.buffer != image_info.callbacks.image_memcpy(image_info.buffer, - buf_ptr, buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, + if(image_info.buffer != image_info.callbacks.image_memcpy(image_info.buffer, + buf_ptr, buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, image_info.callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(image_info.buffer, buf_ptr, buf_len); } /* end if */ else @@ -2545,24 +2545,24 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_file_image * - * Purpose: If the file image exists and buf_ptr_ptr is not NULL, - * allocate a buffer of the correct size, copy the image into - * the new buffer, and return the buffer to the caller in - * *buf_ptr_ptr. Do this using the file image callbacks - * if defined. + * Purpose: If the file image exists and buf_ptr_ptr is not NULL, + * allocate a buffer of the correct size, copy the image into + * the new buffer, and return the buffer to the caller in + * *buf_ptr_ptr. Do this using the file image callbacks + * if defined. * - * NB: It is the responsibility of the caller to free the - * buffer whose address is returned in *buf_ptr_ptr. Do - * this using free if the file image callbacks are not - * defined, or with whatever method is appropriate if - * the callbacks are defined. + * NB: It is the responsibility of the caller to free the + * buffer whose address is returned in *buf_ptr_ptr. Do + * this using free if the file image callbacks are not + * defined, or with whatever method is appropriate if + * the callbacks are defined. * - * If buf_ptr_ptr is not NULL, and no image exists, set - * *buf_ptr_ptr to NULL. + * If buf_ptr_ptr is not NULL, and no image exists, set + * *buf_ptr_ptr to NULL. * - * If buf_len_ptr is not NULL, set *buf_len_ptr equal - * to the length of the file image if it exists, and - * to 0 if it does not. + * If buf_len_ptr is not NULL, set *buf_len_ptr equal + * to the length of the file image if it exists, and + * to 0 if it does not. * * Return: Non-negative on success/Negative on failure * @@ -2590,7 +2590,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ - HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || + HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || ((image_info.buffer == NULL) && (image_info.size == 0))); /* Set output size */ @@ -2611,15 +2611,15 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) else if(NULL == (copy_ptr = H5MM_malloc(image_info.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate copy") - + /* Copy data */ if(image_info.callbacks.image_memcpy) { if(copy_ptr != image_info.callbacks.image_memcpy(copy_ptr, image_info.buffer, - image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, + image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, image_info.callbacks.udata)) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(copy_ptr, image_info.buffer, image_info.size); } /* end if */ @@ -2636,7 +2636,7 @@ done: * * Purpose: Sets the callbacks for file images. Some file drivers allow * the use of user-defined callbacks for allocating, freeing and - * copying the drivers internal buffer, potentially allowing a + * copying the drivers internal buffer, potentially allowing a * clever user to do optimizations such as avoiding large mallocs * and memcpys or to perform detailed logging. * @@ -2666,7 +2666,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || + HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* Make sure a file image hasn't already been set */ @@ -2675,7 +2675,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* verify that callbacks_ptr is not NULL */ if(NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") /* Make sure udata callbacks are going to be set if udata is going to be set */ if(callbacks_ptr->udata) @@ -2686,7 +2686,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback if(info.callbacks.udata != NULL) { HDassert(info.callbacks.udata_free); if(info.callbacks.udata_free(info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") } /* end if */ /* Update struct */ @@ -2713,7 +2713,7 @@ done: * * Purpose: Sets the callbacks for file images. Some file drivers allow * the use of user-defined callbacks for allocating, freeing and - * copying the drivers internal buffer, potentially allowing a + * copying the drivers internal buffer, potentially allowing a * clever user to do optimizations such as avoiding large mallocs * * Return: Non-negative on success/Negative on failure @@ -2742,12 +2742,12 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || + HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* verify that callbacks_ptr is not NULL */ if(NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") /* Transfer values to parameters */ *callbacks_ptr = info.callbacks; @@ -2768,12 +2768,12 @@ done: * Function: H5P__file_image_info_copy * * Purpose: Copy file image info. The buffer - * and udata may need to be copied, possibly using their + * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. + * finishes the "deep" part of the copy. * * Return: Success: Non-negative * Failure: Negative @@ -2796,7 +2796,7 @@ H5P__file_image_info_copy(void *value) info = (H5FD_file_image_info_t *)value; /* verify file image field consistancy */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || + HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); if(info->buffer && info->size > 0) { @@ -2815,14 +2815,14 @@ H5P__file_image_info_copy(void *value) if(NULL == (info->buffer = H5MM_malloc(info->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ - + /* Copy data to new buffer */ if(info->callbacks.image_memcpy) { - if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, - info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, + info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(info->buffer, old_buffer, info->size); } /* end if */ @@ -2846,8 +2846,8 @@ done: * Function: H5P__file_image_info_free * * Purpose: Free file image info. The buffer and udata may need to be - * freed, possibly using their respective callbacks, so the - * default free won't work. + * freed, possibly using their respective callbacks, so the + * default free won't work. * * Return: Success: Non-negative * Failure: Negative @@ -2868,16 +2868,16 @@ H5P__file_image_info_free(void *value) H5FD_file_image_info_t *info; /* Image info struct */ info = (H5FD_file_image_info_t *)value; - + /* Verify file image field consistancy */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || + HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); /* Free buffer */ - if(info->buffer != NULL && info->size > 0) { + if(info->buffer != NULL && info->size > 0) { if(info->callbacks.image_free) { if((*info->callbacks.image_free)(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") } /* end if */ else H5MM_xfree(info->buffer); @@ -2903,7 +2903,7 @@ done: * Purpose: Compare two cache image configurations. * * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is - * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * * Programmer: John Mainzer * June 26, 2015 @@ -2944,11 +2944,11 @@ done: * Function: H5P__facc_cache_image_config_enc * * Purpose: Callback routine which is called whenever the default - * cache image config property in the file creation - * property list is encoded. + * cache image config property in the file creation + * property list is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: John Mainzer * June 26, 2015 @@ -2990,11 +2990,11 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) * Function: H5P__facc_cache_image_config_dec * * Purpose: Callback routine which is called whenever the default - * cache image config property in the file creation property - * list is decoded. + * cache image config property in the file creation property + * list is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: John Mainzer * June 26, 2015 @@ -3109,7 +3109,7 @@ done: * * Purpose: Delete callback for the file image info property, called * when the property is deleted from the plist. The buffer - * and udata may need to be freed, possibly using their + * and udata may need to be freed, possibly using their * respective callbacks so the default free won't work. * * Return: Non-negative on success/Negative on failure @@ -3139,7 +3139,7 @@ done: * Function: H5P__facc_file_image_info_copy * * Purpose: Copy callback for the file image info property. The buffer - * and udata may need to be copied, possibly using their + * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * * Return: Non-negative on success/Negative on failure @@ -3228,7 +3228,7 @@ done: * Function: H5P__facc_file_image_info_close * * Purpose: Close callback for the file image info property. The buffer - * and udata may need to be freed, possibly using their + * and udata may need to be freed, possibly using their * respective callbacks so the standard free won't work. * * Return: Non-negative on success/Negative on failure @@ -3260,7 +3260,7 @@ done: * Purpose: Compare two cache configurations. * * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is - * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * * Programmer: Mohamad Chaarawi * September 24, 2012 @@ -3373,8 +3373,8 @@ done: * cache config property in the file creation property list is * encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * August 09, 2012 @@ -3518,8 +3518,8 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) * cache config property in the file creation property list is * decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * August 09, 2012 @@ -3653,8 +3653,8 @@ done: * degree property in the file access property list * is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3691,8 +3691,8 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) * degree property in the file access property list * is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3726,8 +3726,8 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) * memory type property in the file access property list * is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3764,8 +3764,8 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) * memory type property in the file access property list * is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3793,12 +3793,12 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) /*------------------------------------------------------------------------- - * Function: H5Pset_core_write_tracking + * Function: H5Pset_core_write_tracking * - * Purpose: Enables/disables core VFD write tracking and page + * Purpose: Enables/disables core VFD write tracking and page * aggregation size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Dana Robinson * Tuesday, April 8, 2014 @@ -3834,12 +3834,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_core_write_tracking + * Function: H5Pget_core_write_tracking * - * Purpose: Gets information about core VFD write tracking and page + * Purpose: Gets information about core VFD write tracking and page * aggregation size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Dana Robinson * Tuesday, April 8, 2014 @@ -3876,19 +3876,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_metadata_read_attempts - * - * Purpose: Sets the # of read attempts in the file access property list - * when reading metadata with checksum. - * The # of read attempts set via this routine will only apply - * when opening a file with SWMR access. - * The # of read attempts set via this routine does not have - * any effect when opening a file with non-SWMR access; for this - * case, the # of read attempts will be always be 1. + * Function: H5Pset_metadata_read_attempts * - * Return: Non-negative on success/Negative on failure + * Purpose: Sets the # of read attempts in the file access property list + * when reading metadata with checksum. + * The # of read attempts set via this routine will only apply + * when opening a file with SWMR access. + * The # of read attempts set via this routine does not have + * any effect when opening a file with non-SWMR access; for this + * case, the # of read attempts will be always be 1. + * + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 + * Programmer: Vailin Choi; Sept 2013 * *------------------------------------------------------------------------- */ @@ -3919,13 +3919,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_metadata_read_attempts + * Function: H5Pget_metadata_read_attempts * - * Purpose: Returns the # of metadata read attempts set in the file access property list. + * Purpose: Returns the # of metadata read attempts set in the file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 + * Programmer: Vailin Choi; Sept 2013 * *------------------------------------------------------------------------- */ @@ -3945,13 +3945,13 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts/*out*/) if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Get the # of read attempts set */ + /* Get the # of read attempts set */ if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, attempts) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get the number of metadata read attempts") - /* If not set, return the default value */ - if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ - *attempts = H5F_METADATA_READ_ATTEMPTS; + /* If not set, return the default value */ + if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ + *attempts = H5F_METADATA_READ_ATTEMPTS; } /* end if */ done: @@ -3960,14 +3960,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_obj_flush_cb + * Function: H5Pset_obj_flush_cb * - * Purpose: Sets the callback function to invoke and the user data when an - * object flush occurs in the file. + * Purpose: Sets the callback function to invoke and the user data when an + * object flush occurs in the file. + * + * Return: Non-negative on success/Negative on failure * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi; Dec 2013 + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ @@ -4004,14 +4004,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_obj_flush_cb - * - * Purpose: Retrieves the callback function and user data set in the - * property list for an object flush. + * Function: H5Pget_obj_flush_cb * - * Return: Non-negative on success/Negative on failure + * Purpose: Retrieves the callback function and user data set in the + * property list for an object flush. + * + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Dec 2013 + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ @@ -4035,9 +4035,9 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata) /* Assign return value */ if(func) - *func = flush_info.func; + *func = flush_info.func; if(udata) - *udata = flush_info.udata; + *udata = flush_info.udata; done: FUNC_LEAVE_API(ret_value) @@ -4045,11 +4045,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_log_options + * Function: H5Pset_mdc_log_options * - * Purpose: Set metadata cache log options. + * Purpose: Set metadata cache log options. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -4097,11 +4097,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_log_options + * Function: H5Pget_mdc_log_options * - * Purpose: Get metadata cache log options. + * Purpose: Get metadata cache log options. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -4455,8 +4455,8 @@ done: * * Purpose: Generic encoding callback routine for 'coll_md_read_flag' properties. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 @@ -4493,8 +4493,8 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) * * Purpose: Generic decoding callback routine for 'coll_md_read_flag' properties. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 @@ -4523,22 +4523,22 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) /*------------------------------------------------------------------------- - * Function: H5Pset_all_coll_metadata_ops + * Function: H5Pset_all_coll_metadata_ops * - * Purpose: Tell the library whether the metadata read operations will - * be done collectively (1) or not (0). Default is independent. - * With collective mode, the library will optimize access to - * metadata operations on the file. + * Purpose: Tell the library whether the metadata read operations will + * be done collectively (1) or not (0). Default is independent. + * With collective mode, the library will optimize access to + * metadata operations on the file. * - * Note: This routine accepts file access property lists, link - * access property lists, attribute access property lists, - * dataset access property lists, group access property lists, - * named datatype access property lists, - * and dataset transfer property lists. + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4582,19 +4582,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_all_coll_metadata_ops + * Function: H5Pget_all_coll_metadata_ops * - * Purpose: Gets information about collective metadata read mode. + * Purpose: Gets information about collective metadata read mode. * - * Note: This routine accepts file access property lists, link - * access property lists, attribute access property lists, - * dataset access property lists, group access property lists, - * named datatype access property lists, - * and dataset transfer property lists. + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4640,14 +4640,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_coll_metadata_write + * Function: H5Pset_coll_metadata_write * - * Purpose: Tell the library whether the metadata write operations will - * be done collectively (1) or not (0). Default is collective. + * Purpose: Tell the library whether the metadata write operations will + * be done collectively (1) or not (0). Default is collective. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4679,13 +4679,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_coll_metadata_write + * Function: H5Pget_coll_metadata_write * - * Purpose: Gets information about collective metadata write mode. + * Purpose: Gets information about collective metadata write mode. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4717,15 +4717,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_page_buffer_size + * Function: H5Pset_page_buffer_size * * Purpose: Set the maximum page buffering size. This has to be a * multiple of the page allocation size which must be enabled; * otherwise file create/open will fail. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * June 2015 * *------------------------------------------------------------------------- @@ -4765,13 +4765,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_page_buffer_size + * Function: H5Pget_page_buffer_size * - * Purpose: Retrieves the maximum page buffer size. + * Purpose: Retrieves the maximum page buffer size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * June 2015 * *------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index a2c0418..493a322 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -420,8 +420,6 @@ H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view); H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view); H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size); H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size); -H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); -H5_DLL ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); H5_DLL herr_t H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t boundary[], H5D_append_cb_t func, void *udata); H5_DLL herr_t H5Pget_append_flush(hid_t plist_id, unsigned dims, diff --git a/src/H5system.c b/src/H5system.c index 719b7e0..a8726c2 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1043,7 +1043,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) * Unix: does not apply */ if(H5_CHECK_ABS_DRIVE(name)) { - drive = HDtoupper(name[0]) - 'A' + 1; + drive = name[0] - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); HDstrncpy(new_name, &name[2], name_len); } /* end if */ diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index fca2f27..973d389 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -452,6 +452,7 @@ set (test_CLEANFILES extlinks19B00026.h5 extlinks19B00027.h5 extlinks19B00028.h5 + tmp big.data big*.h5 stdio.h5 @@ -581,7 +582,6 @@ set (test_CLEANFILES cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 - tmp/vds_src_2.h5 ) # Remove any output file left over from previous test run @@ -839,28 +839,21 @@ add_test (NAME H5TEST-clear-error_test-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -if (HDF5_USE_16_API_DEFAULT) - add_test ( - NAME H5TEST-error_test-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" - ) -else () - add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-error_test PROPERTIES - DEPENDS H5TEST-clear-error_test-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) -endif () +add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" +) +set_tests_properties (H5TEST-error_test PROPERTIES + DEPENDS H5TEST-clear-error_test-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) #-- Adding test for links_env add_test (NAME H5TEST-clear-links_env-objects @@ -966,28 +959,21 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - if (HDF5_USE_16_API_DEFAULT) - add_test ( - NAME H5TEST-shared-error_test-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" - ) - else () - add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-error_test PROPERTIES - DEPENDS H5TEST-shared-clear-error_test-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () + add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-shared-error_test PROPERTIES + DEPENDS H5TEST-shared-clear-error_test-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) #-- Adding test for links_env add_test (NAME H5TEST-shared-clear-links_env-objects diff --git a/test/vds.c b/test/vds.c index eca26bc..c9b7a1b 100644 --- a/test/vds.c +++ b/test/vds.c @@ -36,12 +36,6 @@ const char *FILENAME[] = { "vds_src_1", "vds%%_src", "vds_dapl", - "vds_virt_2", - "vds_virt_3", - "vds_src_2", - "vds_src_3", - "vds%%_src2", - "vds_dapl2", NULL }; @@ -55,8 +49,6 @@ const char *FILENAME[] = { #define FILENAME_BUF_SIZE 1024 -#define TMPDIR "tmp/" - /*------------------------------------------------------------------------- * Function: vds_select_equal @@ -65,7 +57,14 @@ const char *FILENAME[] = { * provided dataspaces are the same. * * Return: Success: 0 + * * Failure: -1 + * + * Programmer: Neil Fortner + * Monday, March 2, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static htri_t @@ -131,7 +130,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } + } /* end if */ /* Free buffers */ HDfree(buf1); @@ -181,7 +180,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } + } /* end if */ /* Free buffers */ HDfree(buf1); @@ -218,7 +217,14 @@ error: * parameters. * * Return: Success: 0 + * * Failure: -1 + * + * Programmer: Neil Fortner + * Monday, March 2, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -292,7 +298,8 @@ vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, error: H5E_BEGIN_TRY { - H5Sclose(space_out); + if(space_out >= 0) + (void)H5Sclose(space_out); } H5E_END_TRY return -1; @@ -305,7 +312,14 @@ error: * Purpose: Tests API functions related to virtual datasets. * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Monday, February 16, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ /* Helper function to get DCPL for examination depending on config */ @@ -356,12 +370,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, file = -1; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ /* Open dataset */ if((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get DCPL from dataset */ if((*ex_dcpl = H5Dget_create_plist(dset)) < 0) @@ -380,8 +394,8 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(oinfo.meta_size.obj.heap_size != exp_meta_size) { printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR - } - } + } /* end if */ + } /* end if */ else if((oinfo.meta_size.obj.heap_size != exp_meta_size) && (oinfo.meta_size.obj.heap_size != (hsize_t)0)) @@ -410,12 +424,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(H5Fclose(file) < 0) TEST_ERROR file = -1; - } + } /* end if */ else if(config == TEST_API_COPY_PLIST) { /* Copy property list */ if((*ex_dcpl = H5Pcopy(dcpl)) < 0) TEST_ERROR - } + } /* end if */ else if(config == TEST_API_ENCDEC_PLIST) { size_t plist_buf_size; @@ -434,14 +448,14 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, /* Free plist_buf */ HDfree(plist_buf); plist_buf = NULL; - } + } /* end if */ else { /* Simply copy the id to ex_dcpl and increment the ref count so ex_dcpl * can be closed */ if(H5Iinc_ref(dcpl) < 0) TEST_ERROR *ex_dcpl = dcpl; - } + } /* end else */ /* Verify examination DCPL is equal to original DCPL. Do not compare the * plist to itself, and do not do the comparison if we reopened the file, @@ -452,14 +466,16 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(!tri_ret) TEST_ERROR - } + } /* end if */ return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); - H5Dclose(dset); + if(file >= 0) + (void)H5Fclose(file); + if(dset >= 0) + (void)H5Dclose(dset); } H5E_END_TRY; if(plist_buf) HDfree(plist_buf); @@ -516,7 +532,7 @@ test_api(test_api_config_t config, hid_t fapl) case TEST_API_NTESTS: default: TEST_ERROR - } + } /* end switch */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -802,7 +818,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Create virtual dataspace */ if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - } + } /* end for */ /* Select all (should not be necessary, but just to be sure) */ if(H5Sselect_all(srcspace[0]) < 0) @@ -916,7 +932,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } + } /* end for */ if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1022,7 +1038,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Add virtual layout mapping */ if(H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0) TEST_ERROR - } + } /* end if */ /* Get examination DCPL */ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)697) < 0) @@ -1047,7 +1063,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Check that the mapping in the DCPL is correct */ if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0) TEST_ERROR - } + } /* end if */ /* Close */ if(H5Sclose(srcspace[0]) < 0) @@ -1057,7 +1073,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } + } /* end for */ if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1107,459 +1123,23 @@ test_api(test_api_config_t config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Pclose(dcpl); - H5Pclose(ex_dcpl); + for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if(srcspace[i] >= 0) + (void)H5Sclose(srcspace[i]); + } /* end for */ + for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(dcpl >= 0) + (void)H5Pclose(dcpl); + if(ex_dcpl >= 0) + (void)H5Pclose(ex_dcpl); } H5E_END_TRY; return 1; } /* end test_api() */ -/*------------------------------------------------------------------------- - * Function: vds_link_prefix - * - * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp" - * Should be able to access the target source files in tmp directory via the prefix set - * by H5Pset_virtual_prefix() - * - * Return: Success: 0 - * Failure: -1 - *------------------------------------------------------------------------- - */ -static int -test_vds_prefix(unsigned config, hid_t fapl) -{ - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char vfilename2[FILENAME_BUF_SIZE]; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; - const char *srcfilenamepct_map_orig = "vds%%%%_src"; - hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ - hid_t vfile = -1; /* File with virtual dset */ - hid_t vfile2 = -1; /* File with copied virtual dset */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dapl = -1; /* Dataset access property list */ - hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ - hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ - hid_t memspace = -1; /* Memory dataspace */ - hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ - hid_t vdset = -1; /* Virtual dataset */ - hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ - hsize_t start[4]; /* Hyperslab start */ - hsize_t stride[4]; /* Hyperslab stride */ - hsize_t count[4]; /* Hyperslab count */ - hsize_t block[4]; /* Hyperslab block */ - hssize_t offset[2] = {0, 0}; /* Selection offset */ - int buf[10][26]; /* Write and expected read buffer */ - int rbuf[10][26]; /* Read buffer */ - int rbuf99[9][9]; /* 9x9 Read buffer */ - int evbuf[10][26]; /* Expected VDS "buffer" */ - int erbuf[10][26]; /* Expected read buffer */ - int fill = -1; /* Fill value */ - herr_t ret; /* Generic return value */ - int i, j; - char buffer[1024]; /* buffer to read vds_prefix */ - - TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()") - - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2); - h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); - - /* create tmp directory and get current working directory path */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - - /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR - - /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) - TEST_ERROR - - /* Initialize VDS prefix items */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - TEST_ERROR - - if(H5Pset_virtual_prefix(dapl, TMPDIR) < 0) - TEST_ERROR - if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) - TEST_ERROR - - if(HDstrcmp(buffer, TMPDIR) != 0) - FAIL_PUTS_ERROR("vds prefix not set correctly"); - - /* - * Test 1: All - all selection - */ - /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) - TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) - TEST_ERROR - - /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) - TEST_ERROR - - /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - else { - srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) - TEST_ERROR - } - - /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR - - /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; - - /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - } - } - - /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) - TEST_ERROR - } - - /* Read data through virtual dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) { - TEST_ERROR - } - } - - /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); - - /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Reopen srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) - TEST_ERROR - } - - /* Read data directly from source dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) - TEST_ERROR - - /* Close */ - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if(H5Sclose(srcspace[0]) < 0) - TEST_ERROR - srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) - TEST_ERROR - vspace[0] = -1; - if(H5Pclose(dapl) < 0) - TEST_ERROR - dapl = -1; - if(H5Pclose(dcpl) < 0) - TEST_ERROR - dcpl = -1; - - /* - * Test 2: All - all selection with ENV prefix - */ - if(HDsetenv("HDF5_VDS_PREFIX", "${ORIGIN}/tmp", 1)) - TEST_ERROR - - /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR - - /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) - TEST_ERROR - - /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - TEST_ERROR - - if(H5Pset_virtual_prefix(dapl, "someprefix") < 0) - TEST_ERROR - if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) - TEST_ERROR - - if(HDstrcmp(buffer, "someprefix") != 0) - FAIL_PUTS_ERROR("vds prefix not set correctly"); - - /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) - TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) - TEST_ERROR - - /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) - TEST_ERROR - - /* Create virtual file */ - if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - else { - srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) - TEST_ERROR - } - - /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR - - /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; - - /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - } - } - - /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) - TEST_ERROR - } - - /* Read data through virtual dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) { - TEST_ERROR - } - } - - /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); - - /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Reopen srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) - TEST_ERROR - } - - /* Read data directly from source dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) - TEST_ERROR - - /* Close */ - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if(H5Sclose(srcspace[0]) < 0) - TEST_ERROR - srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) - TEST_ERROR - vspace[0] = -1; - if(H5Pclose(dapl) < 0) - TEST_ERROR - dapl = -1; - if(H5Pclose(dcpl) < 0) - TEST_ERROR - dcpl = -1; - - if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) - TEST_ERROR - - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) - H5Fclose(srcfile[i]); - H5Fclose(vfile); - H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(memspace); - H5Pclose(dcpl); - } H5E_END_TRY; - - if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) - TEST_ERROR - - return 1; -} /* end vds_link_prefix() */ - /*------------------------------------------------------------------------- * Function: test_basic_io @@ -1568,7 +1148,14 @@ test_vds_prefix(unsigned config, hid_t fapl) * pattern-matching file/dataset strings * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Tuesday, March 3, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -1651,12 +1238,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1685,8 +1272,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1700,7 +1287,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1729,7 +1316,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1813,12 +1400,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1854,8 +1441,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1869,7 +1456,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1900,7 +1487,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1949,8 +1536,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1959,7 +1546,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ /* Open v_dset2 */ if((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0) @@ -1985,7 +1572,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Only copy to a different file if the source datasets are in a different * file */ @@ -2027,8 +1614,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen copied virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2037,7 +1624,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile2 = -1; if((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ /* Open v_dset3 */ if((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0) @@ -2063,13 +1650,13 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Close copied virtual file */ if(H5Fclose(vfile2) < 0) TEST_ERROR vfile2 = -1; - } + } /* end if */ /* Close */ if(H5Dclose(srcdset[0]) < 0) @@ -2148,12 +1735,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2195,8 +1782,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2210,7 +1797,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2241,7 +1828,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2336,12 +1923,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2377,8 +1964,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2392,7 +1979,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read first source dataset through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2445,7 +2032,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2544,12 +2131,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2577,7 +2164,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i][j] = buf[2 * i][j]; for(/* j = 13 */; j < 26; j++) evbuf[i][j] = buf[2 * i + 1][j - 13]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2594,7 +2181,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i + 5][j] = buf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) evbuf[i + 5][j] = buf[2 * i + 1][j]; - } + } /* end for */ /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2609,8 +2196,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2624,7 +2211,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -2640,7 +2227,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i][j] = evbuf[2 * i][j]; for(/* j = 13 */; j < 26; j++) erbuf[i][j] = evbuf[2 * i + 1][j - 13]; - } + } /* end for */ /* Read second slice */ if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2652,7 +2239,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i + 5][j] = evbuf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) erbuf[i + 5][j] = evbuf[2 * i + 1][j]; - } + } /* end for */ /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2676,7 +2263,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j] = buf[i][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j - 13] = buf[i][j]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2693,7 +2280,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j + 13] = buf[i + 5][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j] = buf[i + 5][j]; - } + } /* end for */ /* Reopen srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2704,7 +2291,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ /* Reset rbuf */ @@ -2720,7 +2307,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j] = evbuf[i][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j - 13] = evbuf[i][j]; - } + } /* end for */ /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2732,7 +2319,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j + 13] = evbuf[i + 5][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j] = evbuf[i + 5][j]; - } + } /* end for */ /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2852,12 +2439,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2911,8 +2498,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2926,7 +2513,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -2951,7 +2538,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } + } /* end for */ /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2997,7 +2584,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ /* Reset rbuf */ @@ -3018,7 +2605,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } + } /* end for */ /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) @@ -3193,12 +2780,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -3235,8 +2822,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3250,7 +2837,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ /* Reset rbuf */ @@ -3356,7 +2943,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 3) && (j < 6)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -3409,7 +2996,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 6) && (j < 9)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -3627,7 +3214,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source dataset */ /* Select hyperslab in memory space */ @@ -3702,19 +3289,32 @@ test_basic_io(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) - H5Fclose(srcfile[i]); - H5Fclose(vfile); - H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(memspace); - H5Pclose(dcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { + if(srcdset[i] >= 0) + (void)H5Dclose(srcdset[i]); + } /* end for */ + if(vdset >= 0) + (void)H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { + if(srcfile[i] >= 0) + (void)H5Fclose(srcfile[i]); + } /* end for */ + if(vfile >= 0) + (void)H5Fclose(vfile); + if(vfile2 >= 0) + (void)H5Fclose(vfile2); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if(srcspace[i] >= 0) + (void)H5Sclose(srcspace[i]); + } /* end for */ + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(memspace >= 0) + (void)H5Sclose(memspace); + if(dcpl >= 0) + (void)H5Pclose(dcpl); } H5E_END_TRY; return 1; @@ -3727,7 +3327,14 @@ error: * Purpose: Tests VDS with unlimited selections * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Thursday, April 30, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -3840,12 +3447,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -3910,8 +3517,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3925,7 +3532,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -3970,11 +3577,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Test H5Pget_virtual_view() */ if(H5Pget_virtual_view(dapl, &virtual_view) < 0) @@ -3994,7 +3601,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4042,11 +3649,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4055,7 +3662,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[0] = 5; @@ -4092,8 +3699,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4107,7 +3714,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4154,11 +3761,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -4172,7 +3779,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4225,11 +3832,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4238,7 +3845,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 5; @@ -4280,8 +3887,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4295,7 +3902,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4357,7 +3964,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -4422,11 +4029,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Shrink to 15 */ dims[1] = 15; @@ -4453,12 +4060,12 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end if */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4472,7 +4079,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4520,11 +4127,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -4559,11 +4166,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try setting extent manually */ /* Grow to 18 */ @@ -4591,11 +4198,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Grow to 20 */ dims[1] = 20; @@ -4621,7 +4228,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < (int)mdims[1]; j++) if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -4634,12 +4241,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -4715,12 +4322,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -4785,8 +4392,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4800,7 +4407,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4844,11 +4451,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4862,7 +4469,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4904,11 +4511,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4917,7 +4524,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[1] = 7; @@ -4959,8 +4566,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4974,7 +4581,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5020,11 +4627,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5038,7 +4645,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5089,11 +4696,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5102,7 +4709,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[1] = 10; @@ -5144,8 +4751,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5159,7 +4766,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5221,7 +4828,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -5238,7 +4845,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5290,11 +4897,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -5307,12 +4914,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -5407,12 +5014,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -5452,7 +5059,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][6 * j] = buf[i][2 * j]; erbuf[i][(6 * j) + 1] = buf[i][(2 * j) + 1]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5468,7 +5075,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][(6 * j) + 2] = buf[i][2 * j]; erbuf[i][(6 * j) + 3] = buf[i][(2 * j) + 1]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5489,7 +5096,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][4] = buf[i][0]; erbuf[i][5] = buf[i][1]; - } + } /* end for */ /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5507,8 +5114,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5522,7 +5129,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5566,11 +5173,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -5584,7 +5191,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5626,11 +5233,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5639,7 +5246,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[1] = 7; @@ -5676,8 +5283,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5691,7 +5298,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5736,11 +5343,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5754,7 +5361,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5764,7 +5371,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][12] = buf[i][0]; erbuf[i][13] = buf[i][1]; erbuf[i][18] = buf[i][2]; - } + } /* end for */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5808,11 +5415,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5821,7 +5428,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[2] */ dims[1] = 5; @@ -5853,7 +5460,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][10] = buf[i][0]; erbuf[i][11] = buf[i][1]; erbuf[i][16] = buf[i][2]; - } + } /* end for */ /* Close srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5865,8 +5472,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5880,7 +5487,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5925,11 +5532,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -5943,7 +5550,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5989,11 +5596,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6002,7 +5609,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[1] = 6; @@ -6033,7 +5640,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][14] = buf[i][0]; erbuf[i][15] = buf[i][1]; - } + } /* end for */ /* Close srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6045,8 +5652,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6060,7 +5667,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6104,11 +5711,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -6122,7 +5729,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6164,11 +5771,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now just read middle 2 rows */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -6194,11 +5801,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -6217,12 +5824,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -6303,12 +5910,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -6361,8 +5968,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6376,7 +5983,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6422,11 +6029,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -6440,7 +6047,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6482,11 +6089,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6495,7 +6102,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[0] = 5; @@ -6533,8 +6140,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6548,7 +6155,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6594,11 +6201,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -6612,7 +6219,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6660,11 +6267,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -6677,12 +6284,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -6725,23 +6332,23 @@ error: for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { if(srcdset[i] >= 0) (void)H5Dclose(srcdset[i]); - } + } /* end for */ if(vdset >= 0) (void)H5Dclose(vdset); for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { if(srcfile[i] >= 0) (void)H5Fclose(srcfile[i]); - } + } /* end for */ if(vfile >= 0) (void)H5Fclose(vfile); for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { if(srcspace[i] >= 0) (void)H5Sclose(srcspace[i]); - } + } /* end for */ for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { if(vspace[i] >= 0) (void)H5Sclose(vspace[i]); - } + } /* end for */ if(filespace >= 0) (void)H5Sclose(filespace); if(memspace >= 0) @@ -6878,12 +6485,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -6895,7 +6502,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6909,7 +6516,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6995,8 +6602,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7010,7 +6617,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7054,11 +6661,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -7095,8 +6702,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7110,7 +6717,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7150,11 +6757,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try with different selections */ count[0] = 10; @@ -7181,12 +6788,12 @@ test_printf(unsigned config, hid_t fapl) if((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end for */ start[1] = 0; /* Now try writing through VDS */ @@ -7222,7 +6829,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read srcdset[0] */ count[0] = 10; @@ -7324,12 +6931,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -7341,7 +6948,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7355,7 +6962,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7493,14 +7100,14 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7514,7 +7121,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7558,11 +7165,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Test H5Pget_virtual_printf_gap() */ if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) @@ -7582,7 +7189,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7634,11 +7241,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 2, reopen file as well if * config option specified */ @@ -7652,7 +7259,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7704,11 +7311,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 3, reopen file as well if * config option specified */ @@ -7722,7 +7329,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7774,11 +7381,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 4, reopen file as well if * config option specified */ @@ -7792,7 +7399,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7844,11 +7451,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -7862,7 +7469,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7908,11 +7515,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -7926,16 +7533,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8008,7 +7615,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8074,7 +7681,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8088,7 +7695,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8132,11 +7739,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -8171,7 +7778,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8185,7 +7792,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8229,11 +7836,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -8249,7 +7856,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8319,7 +7926,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8385,7 +7992,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8399,7 +8006,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8443,11 +8050,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -8482,7 +8089,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8496,7 +8103,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8540,11 +8147,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -8560,7 +8167,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8573,7 +8180,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - } + } /* end if */ /* @@ -8631,12 +8238,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -8648,7 +8255,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8662,7 +8269,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8748,8 +8355,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8763,7 +8370,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8807,11 +8414,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -8847,8 +8454,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8862,7 +8469,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8906,11 +8513,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -8924,7 +8531,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -8971,11 +8578,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9011,8 +8618,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9026,7 +8633,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9070,11 +8677,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -9088,7 +8695,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9135,11 +8742,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf_gap set to 1, reopen file as well if * config option specified */ @@ -9153,7 +8760,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9200,11 +8807,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -9218,16 +8825,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -9303,12 +8910,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -9320,7 +8927,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9334,7 +8941,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9430,8 +9037,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9445,7 +9052,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9489,11 +9096,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -9507,7 +9114,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9554,11 +9161,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9598,8 +9205,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9613,7 +9220,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9657,11 +9264,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -9675,7 +9282,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9721,11 +9328,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9762,8 +9369,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9777,7 +9384,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9821,11 +9428,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -9859,11 +9466,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try setting extent manually */ /* Shrink to 12 */ @@ -9889,11 +9496,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Shrink to 10 */ dims[1] = 12; @@ -9918,12 +9525,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end if */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -9937,7 +9544,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9983,11 +9590,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -10021,11 +9628,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try setting extent manually */ /* Grow to 12 */ @@ -10051,11 +9658,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Grow to 15 */ dims[1] = 15; @@ -10080,12 +9687,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end if */ /* Reset dapl */ if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) @@ -10097,16 +9704,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -10163,12 +9770,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -10180,7 +9787,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10194,7 +9801,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10260,8 +9867,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10275,7 +9882,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10319,11 +9926,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 127, reopen file as well if * config option specified */ @@ -10337,7 +9944,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -10383,11 +9990,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -10401,12 +10008,12 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -10437,19 +10044,32 @@ test_printf(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) - H5Fclose(srcfile[i]); - H5Fclose(vfile); - H5Sclose(srcspace); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(filespace); - H5Sclose(memspace); - H5Pclose(dcpl); - H5Pclose(dapl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { + if(srcdset[i] >= 0) + (void)H5Dclose(srcdset[i]); + } /* end for */ + if(vdset >= 0) + (void)H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { + if(srcfile[i] >= 0) + (void)H5Fclose(srcfile[i]); + } /* end for */ + if(vfile >= 0) + (void)H5Fclose(vfile); + if(srcspace >= 0) + (void)H5Sclose(srcspace); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(filespace >= 0) + (void)H5Sclose(filespace); + if(memspace >= 0) + (void)H5Sclose(memspace); + if(dcpl >= 0) + (void)H5Pclose(dcpl); + if(dapl >= 0) + (void)H5Pclose(dapl); } H5E_END_TRY; return 1; @@ -10463,7 +10083,14 @@ error: * VDS * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Friday, August 14, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -10585,12 +10212,12 @@ test_all(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile = vfile; if(H5Iinc_ref(srcfile) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -10602,7 +10229,7 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10616,7 +10243,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10687,14 +10314,14 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10708,7 +10335,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10754,11 +10381,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10767,7 +10394,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 2; @@ -10802,8 +10429,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10817,7 +10444,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10863,11 +10490,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -10907,8 +10534,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10922,7 +10549,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10968,11 +10595,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10981,7 +10608,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 3; @@ -11025,8 +10652,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11040,7 +10667,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11086,11 +10713,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -11130,8 +10757,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11145,7 +10772,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11191,11 +10818,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -11204,7 +10831,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 7; @@ -11249,8 +10876,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11264,7 +10891,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11310,11 +10937,11 @@ test_all(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -11354,8 +10981,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11369,7 +10996,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11421,16 +11048,16 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -11441,12 +11068,12 @@ test_all(unsigned config, hid_t fapl) if(H5Sclose(srcspace[i]) < 0) TEST_ERROR srcspace[i] = -1; - } + } /* end for */ for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } + } /* end for */ if(H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; @@ -11462,19 +11089,32 @@ test_all(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - H5Fclose(srcfile); - H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(filespace); - H5Sclose(memspace); - H5Pclose(dcpl); - H5Pclose(srcdcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { + if(srcdset[i] >= 0) + (void)H5Dclose(srcdset[i]); + } /* end for */ + if(vdset >= 0) + (void)H5Dclose(vdset); + if(srcfile >= 0) + (void)H5Fclose(srcfile); + if(vfile >= 0) + (void)H5Fclose(vfile); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if(srcspace[i] >= 0) + (void)H5Sclose(srcspace[i]); + } /* end for */ + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(filespace >= 0) + (void)H5Sclose(filespace); + if(memspace >= 0) + (void)H5Sclose(memspace); + if(dcpl >= 0) + (void)H5Pclose(dcpl); + if(srcdcpl >= 0) + (void)H5Pclose(srcdcpl); } H5E_END_TRY; return 1; @@ -11488,6 +11128,10 @@ error: * * Return: Success: 0 * Failure: 1 + * + * Programmer: Dana Robinson + * March 2016 + * *------------------------------------------------------------------------- */ static int @@ -11629,6 +11273,10 @@ test_dapl_values(hid_t fapl_id) * Purpose: Tests datasets with virtual layout * * Return: EXIT_SUCCESS/EXIT_FAILURE + * + * Programmer: Neil Fortner + * Tuesday, February 17, 2015 + * *------------------------------------------------------------------------- */ int @@ -11651,11 +11299,10 @@ main(void) for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, fapl); - nerrors += test_vds_prefix(bit_config, fapl); nerrors += test_unlim(bit_config, fapl); nerrors += test_printf(bit_config, fapl); nerrors += test_all(bit_config, fapl); - } + } /* end for */ nerrors += test_dapl_values(fapl); diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 368471c..3addecf 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -72,14 +72,6 @@ f-3.h5 vds-eiger.h5 ) - set (HDF5_REFERENCE_PREFIX_VDS - 1_vds.h5 - 2_vds.h5 - 4_vds.h5 - 5_vds.h5 - vds-percival-unlim-maxmin.h5 - vds-eiger.h5 - ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -88,21 +80,12 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () - foreach (vds_h5_file ${HDF5_REFERENCE_PREFIX_VDS}) - get_filename_component(fname "${vds_h5_file}" NAME) - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") - endforeach () foreach (ddl_vds ${HDF5_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () - foreach (ddl_vds ${HDF5_REFERENCE_VDS}) - get_filename_component(fname "${ddl_vds}" NAME) - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") - endforeach () - foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") @@ -151,44 +134,6 @@ endif () endmacro () - macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) - set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") - if (NOT "${resultcode}" STREQUAL "0") - set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") - endif () - if (NOT "${last_vds_test}" STREQUAL "") - set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) - endif () - else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_PREFIX-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") - add_test ( - NAME H5DUMP_PREFIX-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}.ddl" - -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" - -D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/testfiles/vds/" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS H5DUMP_PREFIX-${resultfile}-clear-objects) - endif () - endmacro () - macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) @@ -316,15 +261,3 @@ 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 () - - # Data read with prefix - if (USE_FILTER_DEFLATE) - ADD_H5_VDS_PREFIX_TEST (tvds-1 0 --enable-error-stack 1_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-2 0 --enable-error-stack 2_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) - ADD_H5_VDS_PREFIX_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) - ADD_H5_VDS_PREFIX_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) - ADD_H5_VDS_PREFIX_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) - endif () - diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index f25bd98..5df61bb 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -61,17 +61,6 @@ get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5ls_vds_files") endforeach () - - foreach (listfiles ${LIST_HDF5_TEST_FILES}) - get_filename_component(fname "${listfiles}" NAME) - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") - endforeach () - - foreach (listfiles ${LIST_OTHER_TEST_FILES}) - get_filename_component(fname "${listfiles}" NAME) - HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5LS_SOURCE_DIR}/vds_prefix/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") - endforeach () - add_custom_target(h5ls_vds_files ALL COMMENT "Copying files needed by h5ls_vds tests" DEPENDS ${h5ls_vds_files_list}) ############################################################################## @@ -115,43 +104,6 @@ endif () endmacro () - macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") - if ("${resultcode}" STREQUAL "1") - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - add_test ( - NAME H5LS_PREFIX-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") - add_test ( - NAME H5LS_PREFIX-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=vds/prefix/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=vds/prefix/${resultfile}.ls" - -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" - -D "TEST_ENV_VALUE=\${ORIGIN}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS H5LS_PREFIX-${resultfile}-clear-objects) - endif () - endmacro () - ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -203,10 +155,3 @@ ADD_H5_VDS_TEST (tvds-4 0 -w80 -v -S 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 -w80 -v -S 5_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-1 0 -w80 -v -S vds/prefix/1_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-2 0 -w80 -v -S vds/prefix/2_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-3_1 0 -w80 -v -S vds/prefix/3_1_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-3_2 0 -w80 -v -S vds/prefix/3_2_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-4 0 -w80 -v -S vds/prefix/4_vds.h5) - ADD_H5_VDS_PREFIX_TEST (tvds-5 0 -w80 -v -S vds/prefix/5_vds.h5) - diff --git a/tools/test/h5ls/vds_prefix/tvds-1.ls b/tools/test/h5ls/vds_prefix/tvds-1.ls deleted file mode 100644 index 2830d1a..0000000 --- a/tools/test/h5ls/vds_prefix/tvds-1.ls +++ /dev/null @@ -1,14 +0,0 @@ -Opened "vds/prefix/1_vds.h5" with sec2 driver. -vds_dset Dataset {5/Inf, 18/18, 8/8} - Location: 1:800 - Links: 1 - Maps: {6} Source { - 1_a.h5 /source_dset - 1_b.h5 /source_dset - 1_c.h5 /source_dset - 1_d.h5 /source_dset - 1_e.h5 /source_dset - 1_f.h5 /source_dset - } - Storage: 2880 logical bytes, 0 allocated bytes - Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-2.ls b/tools/test/h5ls/vds_prefix/tvds-2.ls deleted file mode 100644 index 5c6f9d3..0000000 --- a/tools/test/h5ls/vds_prefix/tvds-2.ls +++ /dev/null @@ -1,13 +0,0 @@ -Opened "vds/prefix/2_vds.h5" with sec2 driver. -vds_dset Dataset {6/Inf, 8/8, 14/14} - Location: 1:800 - Links: 1 - Maps: {5} Source { - 2_a.h5 /source_dset - 2_b.h5 /source_dset - 2_c.h5 /source_dset - 2_d.h5 /source_dset - 2_e.h5 /source_dset - } - Storage: 2688 logical bytes, 0 allocated bytes - Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_1.ls b/tools/test/h5ls/vds_prefix/tvds-3_1.ls deleted file mode 100644 index f4c8e78..0000000 --- a/tools/test/h5ls/vds_prefix/tvds-3_1.ls +++ /dev/null @@ -1,14 +0,0 @@ -Opened "vds/prefix/3_1_vds.h5" with sec2 driver. -vds_dset Dataset {5/Inf, 25/25, 8/8} - Location: 1:800 - Links: 1 - Maps: {6} Source { - 1_a.h5 /source_dset - 1_b.h5 /source_dset - 1_c.h5 /source_dset - 1_d.h5 /source_dset - 1_e.h5 /source_dset - 1_f.h5 /source_dset - } - Storage: 4000 logical bytes, 0 allocated bytes - Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_2.ls b/tools/test/h5ls/vds_prefix/tvds-3_2.ls deleted file mode 100644 index 5a7e2d8..0000000 --- a/tools/test/h5ls/vds_prefix/tvds-3_2.ls +++ /dev/null @@ -1,13 +0,0 @@ -Opened "vds/prefix/3_2_vds.h5" with sec2 driver. -vds_dset Dataset {6/Inf, 13/13, 19/19} - Location: 1:800 - Links: 1 - Maps: {5} Source { - 2_a.h5 /source_dset - 2_b.h5 /source_dset - 2_c.h5 /source_dset - 2_d.h5 /source_dset - 2_e.h5 /source_dset - } - Storage: 5928 logical bytes, 0 allocated bytes - Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-4.ls b/tools/test/h5ls/vds_prefix/tvds-4.ls deleted file mode 100644 index c22d3a4..0000000 --- a/tools/test/h5ls/vds_prefix/tvds-4.ls +++ /dev/null @@ -1,9 +0,0 @@ -Opened "vds/prefix/4_vds.h5" with sec2 driver. -vds_dset Dataset {9/Inf, 4/4, 4/4} - Location: 1:800 - Links: 1 - Maps: {1} Source { - 4_%b.h5 /source_dset - } - Storage: 576 logical bytes, 0 allocated bytes - Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-5.ls b/tools/test/h5ls/vds_prefix/tvds-5.ls deleted file mode 100644 index efba8dc..0000000 --- a/tools/test/h5ls/vds_prefix/tvds-5.ls +++ /dev/null @@ -1,11 +0,0 @@ -Opened "vds/prefix/5_vds.h5" with sec2 driver. -vds_dset Dataset {9/Inf, 4/4, 4/4} - Location: 1:800 - Links: 1 - Maps: {3} Source { - 5_a.h5 /source_dset - 5_b.h5 /source_dset - 5_c.h5 /source_dset - } - Storage: 576 logical bytes, 0 allocated bytes - Type: 32-bit little-endian integer -- cgit v0.12 From 718006f8606f784ab7795ce5e50281fe318abadc Mon Sep 17 00:00:00 2001 From: lrknox Date: Sat, 23 Dec 2017 20:46:01 -0600 Subject: Increase maximum number of retries for h5watch tests. --- hl/tools/h5watch/testh5watch.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in index 05e66bf..7514281 100644 --- a/hl/tools/h5watch/testh5watch.sh.in +++ b/hl/tools/h5watch/testh5watch.sh.in @@ -44,7 +44,7 @@ GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests -TRY_MAX=10 # Try running the test again +TRY_MAX=20 # Try running the test again # # These 3 defines should be the same as the defines in ./extend_dset.c WRITER_MESSAGE=writer_message # The message file created by the "extend" process -- cgit v0.12 From 732074d47e02c2e01fe794351c681d64b93a5f47 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Dec 2017 17:00:24 -0600 Subject: Add library INTERFACE and MPI to tools --- c++/src/CMakeLists.txt | 4 ++-- hl/c++/src/CMakeLists.txt | 12 ++---------- hl/fortran/src/CMakeLists.txt | 8 ++++---- hl/src/CMakeLists.txt | 4 ++-- java/src/jni/CMakeLists.txt | 2 +- test/CMakeLists.txt | 18 ++++++++++-------- testpar/CMakeLists.txt | 10 ++++++++-- tools/lib/CMakeLists.txt | 10 ++++++++-- 8 files changed, 37 insertions(+), 31 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index b147cfa..3b9a0c3 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -82,7 +82,7 @@ set (CPP_HDRS add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC) set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES @@ -94,7 +94,7 @@ set (install_targets ${HDF5_CPP_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS}) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED ${HDF5_CXX_PACKAGE_SOVERSION}) set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 38604cd..70f0a79 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -12,11 +12,7 @@ set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC " " " ") -target_link_libraries ( - ${HDF5_HL_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_LIB_TARGET} -) +target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC) set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES @@ -28,11 +24,7 @@ set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES}) TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIBSH_TARGET} SHARED " " " ") - target_link_libraries ( - ${HDF5_HL_CPP_LIBSH_TARGET} - ${HDF5_HL_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - ) + target_link_libraries (${HDF5_HL_CPP_LIBSH_TARGET} PUBLIC ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED ${HDF5_HL_CXX_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_CPP_LIBSH_TARGET} PROPERTIES diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index c870aed..3fc66c4 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -77,7 +77,7 @@ set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) +target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC) set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES @@ -90,7 +90,7 @@ set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) + target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_F90_C_LIBSH_TARGET} PROPERTIES @@ -170,7 +170,7 @@ endif () add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC) set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES @@ -194,7 +194,7 @@ if (BUILD_SHARED_LIBS) set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") endif () TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) - target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) + target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} PUBLIC ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 86472fb..3dd6ce8 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -31,7 +31,7 @@ set (HL_HEADERS add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC) set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl @@ -43,7 +43,7 @@ set (install_targets ${HDF5_HL_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (${HDF5_HL_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED ${HDF5_HL_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 9e6c099..10d1b6d 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -51,7 +51,7 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) ########### JNI libraries always must be built shared ############### add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED " " " ") -target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED ${HDF5_JAVA_PACKAGE_SOVERSION}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fca864b..6e8fd78 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,12 +32,13 @@ set (TEST_LIB_HEADERS add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC " " " ") if (MSVC) - target_link_libraries (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") + target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "ws2_32.lib") endif () if (MINGW) - target_link_libraries (${HDF5_TEST_LIB_TARGET} "wsock32.lib") + target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") endif () -target_link_libraries (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_LIBS}) +target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE ${LINK_LIBS}) +target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC) set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test @@ -48,12 +49,13 @@ if (BUILD_SHARED_LIBS) add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED " " " ") if (MSVC) - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "ws2_32.lib") + target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "ws2_32.lib") endif () if (MINGW) - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "wsock32.lib") + target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "wsock32.lib") endif () - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_LIBS}) + target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE ${LINK_LIBS}) + target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test @@ -97,7 +99,7 @@ endif () add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) @@ -123,7 +125,7 @@ endif () add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index b116d66..997d1a1 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -30,14 +30,20 @@ set (testphdf5_SOURCES add_executable (testphdf5 ${testphdf5_SOURCES}) TARGET_NAMING (testphdf5 STATIC) TARGET_C_PROPERTIES (testphdf5 STATIC " " " ") -target_link_libraries (testphdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (testphdf5 ${HDF5_TEST_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) +if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (testphdf5 PRIVATE ${MPI_C_LIBRARIES}) +endif () set_target_properties (testphdf5 PROPERTIES FOLDER test/par) MACRO (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) TARGET_NAMING (${file} STATIC) TARGET_C_PROPERTIES (${file} STATIC " " " ") - target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (${file} PRIVATE ${MPI_C_LIBRARIES}) + endif () set_target_properties (${file} PROPERTIES FOLDER test/par) ENDMACRO (ADD_H5P_EXE file) diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index ade7671..0fc1981 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -39,7 +39,10 @@ set (H5_TOOLS_LIB_HDRS add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_TOOLS_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) +if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (${HDF5_TOOLS_LIB_TARGET} PRIVATE ${MPI_C_LIBRARIES}) +endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC) set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES @@ -52,7 +55,10 @@ set (install_targets ${HDF5_TOOLS_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} PRIVATE ${MPI_C_LIBRARIES}) + endif () 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 ${HDF5_TOOLS_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TOOLS_LIBSH_TARGET} PROPERTIES -- cgit v0.12 From bd34c9e455988ab1d4e550ff16c0410b5624298a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 28 Dec 2017 16:49:50 -0600 Subject: HDFFV-9724 Corrected files and verified tests --- CMakeLists.txt | 4 +- MANIFEST | 6 + config/cmake_ext_mod/FindMPI.cmake | 287 +++--- config/cmake_ext_mod/runTest.cmake | 1 + examples/CMakeLists.txt | 4 +- java/src/hdf/hdf5lib/H5.java | 197 +++- java/src/hdf/hdf5lib/HDF5Constants.java | 3 + java/src/hdf/overview.html | 6 +- java/src/jni/h5Constants.c | 2 + java/src/jni/h5pImp.c | 211 +++++ java/src/jni/h5pImp.h | 73 +- java/test/JUnit-interface.txt | 9 +- java/test/TestH5P.java | 53 +- java/test/TestH5Pfapl.java | 14 + java/test/TestH5Pvirtual.java | 33 + release_docs/RELEASE.txt | 32 +- src/CMakeLists.txt | 10 +- src/H5Dint.c | 78 +- src/H5Dpkg.h | 3 +- src/H5Dprivate.h | 11 +- src/H5Dvirtual.c | 271 +++++- src/H5Fprivate.h | 420 ++++----- src/H5Fquery.c | 2 +- src/H5Pdapl.c | 366 ++++++++ src/H5Pfapl.c | 938 +++++++++---------- src/H5Ppublic.h | 2 + src/H5system.c | 2 +- test/CMakeLists.txt | 12 +- test/CMakeTests.cmake | 76 +- test/vds.c | 1538 +++++++++++++++++++------------ tools/test/h5dump/CMakeTestsVDS.cmake | 67 ++ tools/test/h5ls/CMakeTestsVDS.cmake | 55 ++ tools/test/h5ls/vds_prefix/tvds-1.ls | 14 + tools/test/h5ls/vds_prefix/tvds-2.ls | 13 + tools/test/h5ls/vds_prefix/tvds-3_1.ls | 14 + tools/test/h5ls/vds_prefix/tvds-3_2.ls | 13 + tools/test/h5ls/vds_prefix/tvds-4.ls | 9 + tools/test/h5ls/vds_prefix/tvds-5.ls | 11 + 38 files changed, 3347 insertions(+), 1513 deletions(-) create mode 100644 tools/test/h5ls/vds_prefix/tvds-1.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-2.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-3_1.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-3_2.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-4.ls create mode 100644 tools/test/h5ls/vds_prefix/tvds-5.ls diff --git a/CMakeLists.txt b/CMakeLists.txt index e22ac2e..d4e6300 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -631,6 +631,7 @@ if (HDF5_ENABLE_PARALLEL) # Used by Fortran + MPI CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) + INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_DIRS}) else () message (STATUS "Parallel libraries not found") endif () @@ -639,7 +640,6 @@ endif () # Parallel IO usage requires MPI to be Linked and Included if (H5_HAVE_PARALLEL) set (LINK_LIBS ${LINK_LIBS} ${MPI_C_LIBRARIES}) - set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${MPI_C_LIBRARIES}) if (MPI_C_LINK_FLAGS) set (CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") endif () @@ -864,7 +864,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake) set (LINK_Fortran_LIBS ${LINK_LIBS}) - set (LINK_Fortran_SHARED_LIBS ${LINK_SHARED_LIBS}) if (HDF5_ENABLE_F2003) if (NOT FORTRAN_HAVE_ISO_C_BINDING) @@ -875,7 +874,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for # Parallel IO usage requires MPI to be Linked and Included if (H5_HAVE_PARALLEL) set (LINK_Fortran_LIBS ${LINK_Fortran_LIBS} ${MPI_Fortran_LIBRARIES}) - set (LINK_Fortran_SHARED_LIBS ${LINK_Fortran_SHARED_LIBS} ${MPI_Fortran_LIBRARIES}) if (MPI_Fortran_LINK_FLAGS) set (CMAKE_Fortran_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") endif () diff --git a/MANIFEST b/MANIFEST index 9b91c78..c6c7b3c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1430,6 +1430,12 @@ ./tools/test/h5ls/h5ls_plugin.sh.in ./tools/test/h5ls/testh5ls.sh.in ./tools/test/h5ls/testh5lsvds.sh.in +./tools/test/h5ls/vds_prefix/tvds-1.ls +./tools/test/h5ls/vds_prefix/tvds-2.ls +./tools/test/h5ls/vds_prefix/tvds-3_1.ls +./tools/test/h5ls/vds_prefix/tvds-3_2.ls +./tools/test/h5ls/vds_prefix/tvds-4.ls +./tools/test/h5ls/vds_prefix/tvds-5.ls # h5copy sources ./tools/src/h5copy/Makefile.am diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake index 8084472..d01dd35 100644 --- a/config/cmake_ext_mod/FindMPI.cmake +++ b/config/cmake_ext_mod/FindMPI.cmake @@ -347,7 +347,7 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) # library that has invalid or missing version information there would be warning # messages emitted by ld.so in the compiler output. In either case, we'll treat # the output as invalid. - if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") + if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found") set(WRAPPER_RETURN 255) endif() # Ensure that no error output might be passed upwards. @@ -615,6 +615,16 @@ function (_MPI_interrogate_compiler lang) endif() endif() + if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") + endif() + if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_EXTRA_LIB_NAMES) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") + endif() + # If we found MPI, set up all of the appropriate cache entries if(NOT MPI_${LANG}_COMPILE_OPTIONS) set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) @@ -823,33 +833,43 @@ endfunction() macro(_MPI_assemble_libraries LANG) set(MPI_${LANG}_LIBRARIES "") - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() + # Only for libraries do we need to check whether the compiler's linking stage is separate. + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() + endif() endmacro() macro(_MPI_assemble_include_dirs LANG) - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_${LANG}_INCLUDE_DIRS "") + else() + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + endif() endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") + endforeach() endif() endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}") - endforeach() - endif() endmacro() function(_MPI_split_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + return() + endif() # Backwards compatibility: Search INCLUDE_PATH if given. if(MPI_${LANG}_INCLUDE_PATH) list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") @@ -885,6 +905,13 @@ function(_MPI_split_include_dirs LANG) endif() mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) endif() + # Remove duplicates and default system directories from the list. + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) + endforeach() + endif() set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) endfunction() @@ -1014,7 +1041,7 @@ elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") # FreeBSD ships mpich under the normal system paths - but available openmpi implementations # will be found in /usr/local/mpi/ - MPI_search_mpi_prefix_folder("/usr/local/mpi/") + MPI_search_mpi_prefix_folder("/usr/local/mpi") endif() # Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. @@ -1050,48 +1077,54 @@ mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXE # # Once we find the new variables, we translate them back into their old # equivalents below. -foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Chop the old compile flags into options and definitions - if(MPI_${LANG}_COMPILE_FLAGS) - unset(MPI_${LANG}_COMPILE_OPTIONS) - unset(MPI_${LANG}_COMPILE_DEFINITIONS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}") +if(NOT MPI_IGNORE_LEGACY_VARIABLES) + foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") endif() endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - # If a list of libraries was given, we'll split it into new-style cache variables - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - endif() -endforeach() + # Chop the old compile flags into options and definitions + + unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + if(MPI_${LANG}_COMPILE_FLAGS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") + endif() + endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() + + # If a list of libraries was given, we'll split it into new-style cache variables + unset(MPI_${LANG}_EXTRA_LIB_NAMES) + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + if(_MPI_LIB) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endif() + endforeach() + endif() + endforeach() +endif() #============================================================================= unset(MPI_VERSION) @@ -1100,6 +1133,11 @@ unset(MPI_VERSION_MINOR) unset(_MPI_MIN_VERSION) +# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. +if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) +endif() + # This loop finds the compilers and sends them off for interrogation. foreach(LANG IN ITEMS C CXX Fortran) if(CMAKE_${LANG}_COMPILER_LOADED) @@ -1121,6 +1159,8 @@ foreach(LANG IN ITEMS C CXX Fortran) mark_as_advanced(MPI_CXX_SKIP_MPICXX) endif() if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) + set(MPI_${LANG}_TRIED_IMPLICIT FALSE) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. # Cray PrgEnv. @@ -1130,80 +1170,90 @@ foreach(LANG IN ITEMS C CXX Fortran) # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. if(MPI_${LANG}_WORKS) set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) endif() + set(MPI_${LANG}_TRIED_IMPLICIT TRUE) endif() - # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. - if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) - endif() - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) + endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + endif() + + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH + DOC "MPI compiler for ${LANG}" + ) endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - else() - set(MPI_PINNED_COMPILER FALSE) - endif() - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. find_program(MPI_${LANG}_COMPILER NAMES ${_MPI_${LANG}_COMPILER_NAMES} PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH DOC "MPI compiler for ${LANG}" ) - endif() - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - DOC "MPI compiler for ${LANG}" - ) - - if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_SKIP_GUESSING TRUE) - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_PINNED_COMPILER TRUE) + + # If we haven't made the implicit compiler test yet, perform it now. + if(NOT MPI_${LANG}_TRIED_IMPLICIT) + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + endif() + + # Should the MPI compiler not work implicitly for MPI, still interrogate it. + # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used + # directly during linkage instead of CMAKE__COMPILER will not work. + if(NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + endif() endif() - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - endif() - if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - set(MPI_${LANG}_WRAPPER_FOUND TRUE) - elseif(NOT MPI_SKIP_GUESSING) - _MPI_guess_settings(${LANG}) + if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + else() + _MPI_guess_settings(${LANG}) + endif() endif() endif() endif() _MPI_split_include_dirs(${LANG}) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - endif() + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + _MPI_adjust_compile_definitions(${LANG}) # We always create imported targets even if they're empty _MPI_create_imported_target(${LANG}) @@ -1217,7 +1267,9 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + endif() mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) @@ -1337,7 +1389,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) unset(MPI_${LANG}_REQUIRED_VARS) - if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND) + if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") endforeach() @@ -1448,6 +1500,7 @@ if (MPI_NUMLIBS GREATER 1) else() set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") endif() +set(MPI_IGNORE_LEGACY_VARIABLES TRUE) #============================================================================= # unset these vars to cleanup namespace diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 2479728..5569a73 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -55,6 +55,7 @@ endif () if (TEST_ENV_VAR) set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") + #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") endif () if (NOT TEST_INPUT) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d8eb1a2..04a99ce 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -63,13 +63,13 @@ if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) TARGET_NAMING (ph5example STATIC) TARGET_C_PROPERTIES (ph5example STATIC " " " ") - target_link_libraries (ph5example ${HDF5_LIB_TARGET}) + target_link_libraries (ph5example ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example PROPERTIES FOLDER examples) if (BUILD_SHARED_LIBS) add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) TARGET_NAMING (ph5example-shared SHARED) TARGET_C_PROPERTIES (ph5example-shared SHARED " " " ") - target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET}) + target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example-shared PROPERTIES FOLDER examples) endif () endif () diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 7b5b5c9..78ebbe2 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -4451,7 +4451,7 @@ public class H5 implements java.io.Serializable { // // // //////////////////////////////////////////////////////////// - // Generic property list routines + // /////// Generic property list routines /////// /** * H5Pget_class_name retrieves the name of a generic property list class @@ -4767,7 +4767,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, H5P_iterate_t op_data) throws HDF5LibraryException; - // Object creation property list (OCPL) routines + // /////// Object creation property list (OCPL) routines /////// /** * H5Pget_attr_phase_change retrieves attribute storage phase change thresholds. @@ -5071,7 +5071,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException, NullPointerException; - // File creation property list (FCPL) routines + // /////// File creation property list (FCPL) routines /////// /** * H5Pget_userblock retrieves the size of a user block in a file creation property list. @@ -5480,7 +5480,7 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, IllegalArgumentException; - // File access property list (FAPL) routines + // /////// File access property list (FAPL) routines /////// /** * H5Pget_alignment retrieves the current settings for alignment properties from a file access property list. @@ -5860,6 +5860,37 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_metadata_read_attempts(long plist_id, long attempts) throws HDF5LibraryException; + /** + * H5Pget_evict_on_close retrieves the file access property list setting that determines whether an HDF5 object + * will be evicted from the library's metadata cache when it is closed. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return indication if the object will be evicted on close. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_evict_on_close(long fapl_id) + throws HDF5LibraryException; + + /** + * H5Pset_evict_on_close controls the library's behavior of evicting metadata associated with a closed object. + * + * @param fapl_id + * IN: File access property list identifier + * @param evict_on_close + * IN: Whether the HDF5 object should be evicted on close. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close) + throws HDF5LibraryException; + // Dataset creation property list (DCPL) routines // /** @@ -6066,6 +6097,36 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; +// ///// unimplemented ///// +// /** +// * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache. +// * +// * @param fapl_id +// * IN: File access property list identifier +// * +// * @return VDS link open file cache size in number of files. +// * +// * @exception HDF5LibraryException +// * - Error from the HDF-5 Library. +// * +// **/ +// public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException; +// +// /** +// * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache. +// * +// * @param fapl_id +// * IN: File access property list identifier +// * @param efc_size +// * IN: VDS link open file cache size in number of files. +// * +// * @exception HDF5LibraryException +// * - Error from the HDF-5 Library. +// * +// **/ +// public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size) +// throws HDF5LibraryException; + /** * H5Pget_external returns information about an external file. * @@ -6285,7 +6346,37 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException, NullPointerException; - // Dataset access property list (DAPL) routines // + // /////// Dataset creation property list (DCPL) routines /////// + + /** + * H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list. + * + * @param dcpl_id + * IN: Dataset creation property list identifier + * @param opts + * IN: Edge chunk option flag. Valid values are: + * H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS - filters are not applied to partial edge chunks. + * 0 - Disables option; partial edge chunks will be compressed. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native void H5Pset_chunk_opts(long dcpl_id, int opts) throws HDF5LibraryException; + + /** + * H5Pget_chunk_opts retrieves the edge chunk option setting stored in the dataset creation property list . + * + * @param dcpl_id + * IN: Dataset creation property list + + * @return The edge chunk option setting. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException; + + // /////// Dataset access property list (DAPL) routines /////// /** * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes @@ -6388,12 +6479,76 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException; + /** + * H5Pget_virtual_prefix Retrieves prefix applied to virtual file paths. + * + * @param dapl_id + * IN: Link access property list identifier + * + * @return the prefix to be applied to virtual file paths. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native String H5Pget_virtual_prefix(long dapl_id) + throws HDF5LibraryException; + + /** + * H5Pset_virtual_prefix Sets prefix to be applied to virtual file paths. + * + * @param dapl_id + * IN: Dataset access property list identifier + * @param prefix + * IN: Prefix to be applied to virtual file paths + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native void H5Pset_virtual_prefix(long dapl_id, String prefix) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_efile_prefix Retrieves prefix applied to external file paths. + * + * @param dapl_id + * IN: Link access property list identifier + * + * @return the prefix to be applied to external file paths. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native String H5Pget_efile_prefix(long dapl_id) + throws HDF5LibraryException; + + /** + * H5Pset_efile_prefix Sets prefix to be applied to external file paths. + * + * @param dapl_id + * IN: Dataset access property list identifier + * @param prefix + * IN: Prefix to be applied to external file paths + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native void H5Pset_efile_prefix(long dapl_id, String prefix) + throws HDF5LibraryException, NullPointerException; + // public synchronized static native void H5Pset_append_flush(long plist_id, int ndims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; // public synchronized static native void H5Pget_append_flush(long plist_id, int dims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; - // Dataset xfer property list (DXPL) routines // + // /////// Dataset xfer property list (DXPL) routines /////// /** * H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property @@ -6544,7 +6699,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size) throws HDF5LibraryException, NullPointerException; - // Link creation property list (LCPL) routines // + // /////// Link creation property list (LCPL) routines /////// /** * H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate @@ -6579,7 +6734,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group) throws HDF5LibraryException; - // Group creation property list (GCPL) routines // + // /////// Group creation property list (GCPL) routines /////// /** * H5Pget_local_heap_size_hint Retrieves the anticipated size of the local heap for original-style groups. @@ -6736,14 +6891,14 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags) throws HDF5LibraryException; - // String creation property list (STRCPL) routines // + // /////// String creation property list (STRCPL) routines /////// public synchronized static native int H5Pget_char_encoding(long plist_id) throws HDF5LibraryException; public synchronized static native void H5Pset_char_encoding(long plist_id, int encoding) throws HDF5LibraryException; - // Link access property list (LAPL) routines // + // /////// Link access property list (LAPL) routines /////// /** * H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the @@ -6896,7 +7051,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException, IllegalArgumentException; - // Object copy property list (OCPYPL) routines // + // /////// Object copy property list (OCPYPL) routines /////// /** * H5Pget_copy_object retrieves the properties to be used when an object is copied. @@ -6927,7 +7082,7 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options) throws HDF5LibraryException; - // Other/Older property list routines // + // /////// Other/Older property list routines /////// /** * H5Pget_version retrieves the version information of various objects for a file creation property list. @@ -6955,7 +7110,7 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; - // file drivers property list routines // + // /////// file drivers property list routines /////// public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store) throws HDF5LibraryException, NullPointerException; @@ -7102,20 +7257,28 @@ public class H5 implements java.io.Serializable { // File creation property list (FCPL) routines // // File access property list (FAPL) routines // - // herr_t H5Pset_driver( hid_t plist_id, hid_t new_driver_id, const void *new_driver_info ) - // const void *H5Pget_driver_info( hid_t plist_id ) - // herr_t H5Pget_multi_type ( hid_t fapl_id, H5FD_mem_t *type ) - // herr_t H5Pset_multi_type ( hid_t fapl_id, H5FD_mem_t type ) + // herr_t H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info) + // const void *H5Pget_driver_info(hid_t plist_id) + // herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type) + // herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) // herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); // herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); // herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); // herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); // herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); // herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); + // herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective); + // herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective); + // herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective); + // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc); + // herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data); + // herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data); // Dataset creation property list (DCPL) routines // // Dataset access property list (DAPL) routines // + // herr_t H5Pset_append_flush (hid_t dapl_id, int ndims, const hsize_t boundary[], H5D_append_cb_t func, void *user_data); + // herr_t H5Pget_append_flush(hid_t dapl_id, int ndims, hsize_t boundary[], H5D_append_cb_t *func, void **user_data) // Dataset xfer property list (DXPL) routines // // herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 8a3d6c8..3e43ba2 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -88,6 +88,7 @@ public class HDF5Constants { public static final int H5D_VDS_ERROR = H5D_VDS_ERROR(); public static final int H5D_VDS_FIRST_MISSING = H5D_VDS_FIRST_MISSING(); public static final int H5D_VDS_LAST_AVAILABLE = H5D_VDS_LAST_AVAILABLE(); + public static final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS = H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS(); public static final int H5E_MAJOR = H5E_MAJOR(); public static final int H5E_MINOR = H5E_MINOR(); @@ -768,6 +769,8 @@ public class HDF5Constants { private static native final int H5D_VDS_LAST_AVAILABLE(); + private static native final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS(); + private static native final long H5E_ALIGNMENT(); private static native final long H5E_ALREADYEXISTS(); diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index 39d75b7..9c19442 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -47,20 +47,20 @@ which has a method: The native method is implemented in C using the Java Native Method Interface (JNI). This is written something like the following: -
JNIEXPORT jint
+
JNIEXPORT jlong
 JNICALL Java_hdf_hdf5lib_H5_H5Fopen
 (
  JNIEnv *env,
  jclass class,
  jstring hdfFile,
  jint flags,
- jint access)
+ jlong access)
  {
 
  /* ...convert Java String to (char *) */
 
  /* call the HDF library */
- retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access );
+ retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access);
 
  /* ... */
 }
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index f6f8bfa..5a4b53e 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -140,6 +140,8 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1DONT_1FILTER_1PARTIAL_1CHUNKS(JNIEnv *env, jclass cls) { return H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; } diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index dcfcd82..cf27341 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -5733,6 +5733,217 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts } /* end else */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) +{ + herr_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(prefix, aName); + if (aName != NULL) { + retVal = H5Pset_virtual_prefix((hid_t)dapl_id, aName); + + UNPIN_JAVA_STRING(prefix, aName); + + if(retVal < 0) + h5libraryError(env); + } +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id) +{ + size_t size = 0; + char *pre; + jlong prefix_size = -1; + jstring str = NULL; + + prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)NULL, size); + if(prefix_size < 0) { + h5libraryError(env); + } /* end if */ + else { + size = (size_t)prefix_size + 1;/* add extra space for the null terminator */ + pre = (char*)HDmalloc(sizeof(char)*size); + if (pre == NULL) { + h5outOfMemory(env, "H5Pget_virtual_prefix: malloc failed "); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)pre, size); + + if (prefix_size >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR pre); + HDfree(pre); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_virtual_prefix: return string not allocated"); + } /* end if */ + else { + HDfree(pre); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_efile_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix) +{ + herr_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(prefix, aName); + if (aName != NULL) { + retVal = H5Pset_efile_prefix((hid_t)dapl_id, aName); + + UNPIN_JAVA_STRING(prefix, aName); + + if(retVal < 0) + h5libraryError(env); + } +} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_efile_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix + (JNIEnv *env, jclass clss, jlong dapl_id) +{ + size_t size = 0; + char *pre; + jlong prefix_size = -1; + jstring str = NULL; + + prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)NULL, size); + if(prefix_size < 0) { + h5libraryError(env); + } /* end if */ + else { + size = (size_t)prefix_size + 1;/* add extra space for the null terminator */ + pre = (char*)HDmalloc(sizeof(char)*size); + if (pre == NULL) { + h5outOfMemory(env, "H5Pget_efile_prefix: malloc failed "); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)pre, size); + + if (prefix_size >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR pre); + HDfree(pre); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_efile_prefix: return string not allocated"); + } /* end if */ + else { + HDfree(pre); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_evict_on_close + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close + (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close) +{ + herr_t retVal = -1; + hbool_t evict_on_close_val; + + if (evict_on_close == JNI_TRUE) + evict_on_close_val = TRUE; + else + evict_on_close_val = FALSE; + + retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val); + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_evict_on_close + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close + (JNIEnv *env, jclass clss, jlong fapl_id) +{ + hbool_t evict_on_close_val = FALSE; + jboolean bval = JNI_FALSE; + + if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0) { + h5libraryError(env); + } /* end if */ + else { + if (evict_on_close_val == TRUE) + bval = JNI_TRUE; + } /* end else */ + + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_opts + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts + (JNIEnv *env, jclass clss, jlong dcpl_id, jint opts) +{ + herr_t retVal = -1; + + retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts); + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_opts + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts + (JNIEnv *env, jclass clss, jlong dcpl_id) +{ + unsigned opts = 0; + + if (H5Pget_chunk_opts((hid_t)dcpl_id, opts) < 0) + h5libraryError(env); + + return (jint)opts; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */ + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index d413f69..1d12e3d 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -1533,7 +1533,6 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts (JNIEnv *, jclass, jlong); - /* * Class: hdf_hdf5lib_H5 * Method: H5Pset_metadata_read_attempts @@ -1543,6 +1542,78 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts (JNIEnv *, jclass, jlong, jlong); +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_efile_prefix + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_efile_prefix + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_evict_on_close + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_evict_on_close + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_opts + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_opts + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts +(JNIEnv *, jclass, jlong); + #ifdef __cplusplus } /* end extern "C" */ diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt index ab2f3b1..91ea286 100644 --- a/java/test/JUnit-interface.txt +++ b/java/test/JUnit-interface.txt @@ -415,6 +415,7 @@ JUnit version 4.11 .testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue .testH5P_layout .testH5Pget_link_creation_order +.testH5Pget_efile_prefix .testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes .testH5P_file_space_page_size .testH5Pget_shared_mesg_index_Invalid_indexnum @@ -444,6 +445,7 @@ JUnit version 4.11 .testH5Pset_est_link_info_InvalidValues .testH5Pset_local_heap_size_hint .testH5Pget_est_link_info +.testH5Pset_efile_prefix_null .testH5Pset_scaleoffset .testH5Pset_create_intermediate_group_invalidobject .testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue @@ -466,6 +468,7 @@ JUnit version 4.11 .testH5Pget_sym_k_null .testH5Pset_nlinks .testH5P_obj_track_times +.testH5Pset_efile_prefix .testH5P_userblock .testH5Pget_local_heap_size_hint .testH5Pset_shared_mesg_index_Invalid_indexnum @@ -504,6 +507,7 @@ JUnit version 4.11 .testH5Pset_mdc_config .testH5P_small_data_block_size .testH5Pset_fapl_log +.testH5P_evict_on_close .testH5Pset_libver_bounds .testH5P_sieve_buf_size .testH5P_elink_file_cache_size @@ -530,11 +534,14 @@ JUnit version 4.11 .testH5Pget_source_datasetname .testH5Pvirtual_storage .testH5Pget_selection_source_dataset +.testH5Pget_virtual_prefix .testH5Pget_source_filename .testH5Pset_get_virtual_printf_gap .testH5Pget_virtual_count +.testH5Pset_virtual_prefix .testH5Pset_get_virtual_view .testH5Pget_mapping_parameters +.testH5Pset_virtual_prefix_null .testH5P_genprop_basic_class .testH5P_genprop_class_iter .testH5P_genprop_basic_class_prop @@ -640,7 +647,7 @@ JUnit version 4.11 Time: XXXX -OK (638 tests) +OK (645 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 5aafb5b..9e45e4c 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -28,6 +28,7 @@ import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -852,7 +853,7 @@ public class TestH5P { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pset_est_link_info: " + err); + fail("H5Pset_elink_prefix: " + err); } assertTrue("H5Pset_elink_prefix", ret_val >= 0); } @@ -1232,4 +1233,54 @@ public class TestH5P { fail("testH5P_file_space_page_size: " + err); } } + + @Test + public void testH5Pset_efile_prefix() { + String prefix = "tmp"; + try { + H5.H5Pset_efile_prefix(lapl_id, prefix); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_efile_prefix: " + err); + } + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_efile_prefix_null() throws Throwable{ + H5.H5Pset_efile_prefix(lapl_id, null); + } + + @Test + public void testH5Pget_efile_prefix() { + String prefix = "tmp"; + String pre = ""; + + try { + H5.H5Pset_efile_prefix(lapl_id, prefix); + pre = H5.H5Pget_efile_prefix(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_efile_prefix: " + err); + } + assertTrue("The prefix: ", prefix.equals(pre)); + } + + @Ignore + public void testH5P_chunk_opts() { + int chunk_opts = -1; + + try { + chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); + assertTrue("chunk_opts: "+chunk_opts, chunk_opts == 0); + H5.H5Pset_chunk_opts(ocpl_id, HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); + chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); + assertTrue("chunk_opts: "+chunk_opts, chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_lchunk_opts: " + err); + } + } } diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index d4a2231..48a5986 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -1376,4 +1376,18 @@ public class TestH5Pfapl { deleteH5file(); _deleteLogFile(); } + + @Test + public void testH5P_evict_on_close() { + boolean ret_val_id = false; + try { + H5.H5Pset_evict_on_close(fapl_id, true); + ret_val_id = H5.H5Pget_evict_on_close(fapl_id); + assertTrue("H5P_evict_on_close", ret_val_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_evict_on_close: " + err); + } + } } diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java index 40cfbac..ff2e4dc 100644 --- a/java/test/TestH5Pvirtual.java +++ b/java/test/TestH5Pvirtual.java @@ -429,4 +429,37 @@ public class TestH5Pvirtual { try {H5.H5Dclose(H5did);} catch (Exception ex) {} } } + + @Test + public void testH5Pset_virtual_prefix() { + String prefix = "tmp"; + try { + H5.H5Pset_virtual_prefix(H5dapl_id, prefix); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_virtual_prefix: " + err); + } + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_virtual_prefix_null() throws Throwable{ + H5.H5Pset_virtual_prefix(H5dapl_id, null); + } + + @Test + public void testH5Pget_virtual_prefix() { + String prefix = "tmp"; + String pre = ""; + + try { + H5.H5Pset_virtual_prefix(H5dapl_id, prefix); + pre = H5.H5Pget_virtual_prefix(H5dapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_virtual_prefix: " + err); + } + assertTrue("The prefix: ", prefix.equals(pre)); + } } diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7498d01..3882c4c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -58,7 +58,21 @@ New Features Library: -------- - - + - Add prefix option to VDS files. + + Currently, VDS source files must be in the active directory to be + found by the virtual file. Adding the option of a prefix to be set + on the virtual file, using a data access property list (DAPL), + allows the source files to located at an absolute or relative path + to the virtual file. + + New public APIs: + herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); + ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); + The prefix can also be set with an environment variable, HDF5_VDS_PREFIX. + + (ADB - 2017/12/12, HDFFV-9724) + Parallel Library: ----------------- @@ -119,6 +133,20 @@ New Features ------------ - + Java Library: + ---------------- + - Wrappers added for the following APIs: + H5Pset_evict_on_close + H5Pget_evict_on_close + H5Pset_chunk_opts + H5Pget_chunk_opts + H5Pset_efile_prefix + H5Pget_efile_prefix + H5Pset_virtual_prefix + H5Pget_virtual_prefix + + (ADB - 2017/12/20) + Tools: ------ - h5diff @@ -213,7 +241,7 @@ Bug Fixes since HDF5-1.10.1 release CMake implementation for MPI was problematic and would create incorrect MPI library references in the hdf5 libraries. - Reworked the CMake MPI code to properly create CMake targets.Also merged + Reworked the CMake MPI code to properly create CMake targets. Also merged the latest CMake FindMPI.cmake changes to the local copy. This is necessary until HDF changes the CMake minimum to 3.9 or greater. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b163b8a..0552244 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -885,10 +885,7 @@ add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HE TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIB_TARGET} PUBLIC dl) -endif () -if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_include_directories (${HDF5_LIB_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) + target_link_libraries (${HDF5_LIB_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) @@ -929,10 +926,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC dl) - endif () - if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_include_directories (${HDF5_LIBSH_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS}) + target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) diff --git a/src/H5Dint.c b/src/H5Dint.c index b6c0341..bfe1497 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -61,8 +61,8 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); -static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, - char **extfile_prefix); +static herr_t H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char * prefix_type, + char **file_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); @@ -963,24 +963,25 @@ done: } /* end H5D__update_oh_info() */ + /*-------------------------------------------------------------------------- - * Function: H5D_build_extfile_prefix + * Function: H5D_build_file_prefix * - * Purpose: Determine the external file prefix to be used and store - * it in extfile_prefix. Stores an empty string if no prefix + * Purpose: Determine the file prefix to be used and store + * it in file_prefix. Stores an empty string if no prefix * should be used. * * Return: SUCCEED/FAIL *-------------------------------------------------------------------------- */ static herr_t -H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/) +H5D_build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix /*out*/) { char *prefix = NULL; /* prefix used to look for the file */ - char *extpath = NULL; /* absolute path of directory the HDF5 file is in */ - size_t extpath_len; /* length of extpath */ + char *filepath = NULL; /* absolute path of directory the HDF5 file is in */ + size_t filepath_len; /* length of file path */ size_t prefix_len; /* length of prefix */ - size_t extfile_prefix_len; /* length of expanded prefix */ + size_t file_prefix_len; /* length of expanded prefix */ H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ @@ -990,20 +991,25 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix HDassert(dset); HDassert(dset->oloc.file); - extpath = H5F_EXTPATH(dset->oloc.file); - HDassert(extpath); + filepath = H5F_EXTPATH(dset->oloc.file); + HDassert(filepath); /* XXX: Future thread-safety note - getenv is not required * to be reentrant. */ - prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); + if (HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) + prefix = HDgetenv("HDF5_VDS_PREFIX"); + else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) + prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); + else + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") if(prefix == NULL || *prefix == '\0') { - /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */ + /* Set prefix to value of prefix_type property */ if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") + if(H5P_peek(plist, prefix_type, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix") } /* end if */ /* Prefix has to be checked for NULL / empty string again because the @@ -1013,29 +1019,29 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /* filename is interpreted as relative to the current directory, * does not need to be expanded */ - if(NULL == (*extfile_prefix = (char *)H5MM_strdup(""))) + if(NULL == (*file_prefix = (char *)H5MM_strdup(""))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ else { if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ - extpath_len = HDstrlen(extpath); + filepath_len = HDstrlen(filepath); prefix_len = HDstrlen(prefix); - extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; + file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; - if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) + if(NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") - HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); + HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}")); } /* end if */ else { - if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix))) + if(NULL == (*file_prefix = (char *)H5MM_strdup(prefix))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end else */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_build_extfile_prefix() */ +} /* H5D_build_file_prefix() */ /*------------------------------------------------------------------------- @@ -1217,9 +1223,13 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ - if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) + if(H5D_build_file_prefix(new_dset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &new_dset->shared->extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Set the vds file prefix */ + if(H5D_build_file_prefix(new_dset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &new_dset->shared->vds_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") + /* Add the dataset to the list of opened objects in the file */ if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") @@ -1265,6 +1275,7 @@ done: if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); + new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; @@ -1351,6 +1362,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; char *extfile_prefix = NULL; /* Expanded external file prefix */ + char *vds_prefix = NULL; /* Expanded vds prefix */ H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1371,9 +1383,13 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") /* Get the external file prefix */ - if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0) + if(H5D_build_file_prefix(dataset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Get the vds prefix */ + if(H5D_build_file_prefix(dataset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &vds_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize vds prefix") + /* Check if dataset was already open */ if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ @@ -1399,6 +1415,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* Prevent string from being freed during done: */ extfile_prefix = NULL; + /* Set the vds file prefix */ + dataset->shared->vds_prefix = vds_prefix; + /* Prevent string from being freed during done: */ + vds_prefix = NULL; + } /* end if */ else { /* Point to shared info */ @@ -1430,12 +1451,14 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) done: extfile_prefix = (char *)H5MM_xfree(extfile_prefix); + vds_prefix = (char *)H5MM_xfree(vds_prefix); if(ret_value == NULL) { /* Free the location--casting away const*/ if(dataset) { if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); + dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); } @@ -1818,6 +1841,9 @@ H5D_close(H5D_t *dataset) /* Free the external file prefix */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); + /* Free the vds file prefix */ + dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); + /* Release layout, fill-value, efl & pipeline messages */ if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || @@ -3360,6 +3386,10 @@ H5D_get_access_plist(H5D_t *dset) if(H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap") + /* Set the vds prefix option */ + if(H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds prefix") + /* Set the external file prefix option */ if(H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 542abd0..45f2d3a 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -476,6 +476,7 @@ typedef struct H5D_shared_t { H5D_append_flush_t append_flush; /* Append flush property information */ char *extfile_prefix; /* expanded external file prefix */ + char *vds_prefix; /* expanded vds prefix */ } H5D_shared_t; struct H5D_t { @@ -598,7 +599,7 @@ H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id); H5_DLL herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id); /* Internal I/O routines */ -H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, +H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf); H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index fb994d8..ed13467 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -47,12 +47,13 @@ #define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */ /* ======== Dataset access property names ======== */ -#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ -#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ -#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ -#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ +#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ +#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ #define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */ -#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */ +#define H5D_ACS_VDS_PREFIX_NAME "vds_prefix" /* VDS file prefix */ +#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */ #define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */ /* ======== Data transfer properties ======== */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 3be2353..8d861c9 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -55,6 +55,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ +#include "H5Pprivate.h" /* Property Lists */ #include "H5Sprivate.h" /* Dataspaces */ @@ -731,6 +732,255 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_delete */ + +/*-------------------------------------------------------------------------- + * Function: H5D__virtual_build_name + * + * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME + * + * Return: Non-negative on success/Negative on failure + *--------------------------------------------------------------------------*/ +static herr_t +H5D__virtual_build_name(char *prefix, char *file_name, char **full_name/*out*/) +{ + size_t prefix_len; /* length of prefix */ + size_t fname_len; /* Length of external link file name */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + prefix_len = HDstrlen(prefix); + fname_len = HDstrlen(file_name); + + /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") + + /* Compose the full file name */ + HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, + (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__virtual_build_name() */ + + +/*-------------------------------------------------------------------------- + * Function: H5D_getenv_prefix_name -- + * + * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, + * which is separated by the environment delimiter. + * env_prefix is modified to point to the remaining pathnames + * in the list. + * + * Return: A pointer to a pathname +--------------------------------------------------------------------------*/ +static char * +H5D_getenv_prefix_name(char **env_prefix/*in,out*/) +{ + char *retptr=NULL; + char *strret=NULL; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + strret = HDstrchr(*env_prefix, H5_COLON_SEPC); + if (strret == NULL) { + retptr = *env_prefix; + *env_prefix = strret; + } else { + retptr = *env_prefix; + *env_prefix = strret + 1; + *strret = '\0'; + } + + FUNC_LEAVE_NOAPI(retptr) +} /* end H5D_getenv_prefix_name() */ + +/*------------------------------------------------------------------------- + * Function: H5D__virtual_open_file + * + * Purpose: Attempts to open a source dataset file. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +static H5F_t * +H5D__virtual_open_file(hid_t plist_id, const H5F_t *vdset_file, + const char *file_name, + hid_t fapl_id, hid_t dxpl_id) +{ + H5F_t *src_file = NULL; /* Source file */ + H5F_t *ret_value = NULL; /* Actual return value */ + char *full_name = NULL; /* File name with prefix */ + char *my_prefix; /* Library's copy of the prefix */ + unsigned intent; /* File access permissions */ + char *actual_file_name = NULL; /* Virtual file's actual name */ + char *temp_file_name = NULL; /* Temporary pointer to file name */ + size_t temp_file_name_len; /* Length of temporary file name */ + + FUNC_ENTER_STATIC + + /* Simplify intent flags for open calls */ + intent = H5F_INTENT(vdset_file); + intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); + + /* Copy the file name to use */ + if(NULL == (temp_file_name = H5MM_strdup(file_name))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + temp_file_name_len = HDstrlen(temp_file_name); + + /* target file_name is an absolute pathname: see RM for detailed description */ + if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { + /* Try opening file */ + if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { + char *ptr; + + H5E_clear_stack(NULL); + + /* get last component of file_name */ + H5_GET_LAST_DELIMITER(file_name, ptr) + HDassert(ptr); + + /* Increment past delimiter */ + ptr++; + + /* Copy into the temp. file name */ + HDstrncpy(temp_file_name, ptr, temp_file_name_len); + temp_file_name[temp_file_name_len - 1] = '\0'; + } /* end if */ + } /* end if */ + else if(H5_CHECK_ABS_DRIVE(file_name)) { + /* Try opening file */ + if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { + + H5E_clear_stack(NULL); + + /* strip ":" */ + HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len); + temp_file_name[temp_file_name_len - 1] = '\0'; + } /* end if */ + } /* end if */ + + /* try searching from paths set in the environment variable */ + if(src_file == NULL) { + char *env_prefix; + + if(NULL != (env_prefix = HDgetenv("HDF5_VDS_PREFIX"))) { + char *tmp_env_prefix, *saved_env; + + if(NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + while((tmp_env_prefix) && (*tmp_env_prefix)) { + char *out_prefix_name; + + out_prefix_name = H5D_getenv_prefix_name(&tmp_env_prefix/*in,out*/); + if(out_prefix_name && (*out_prefix_name)) { + if(H5D__virtual_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { + saved_env = (char *)H5MM_xfree(saved_env); + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + } /* end if */ + + src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id); + full_name = (char *)H5MM_xfree(full_name); + if(src_file != NULL) + break; + H5E_clear_stack(NULL); + } /* end if */ + } /* end while */ + saved_env = (char *)H5MM_xfree(saved_env); + } /* end if */ + } /* end if */ + + /* try searching from property list */ + if(src_file == NULL) { + size_t size = 0; + H5E_BEGIN_TRY { + size = H5Pget_virtual_prefix(plist_id, NULL, 0); + } H5E_END_TRY; + if(size < 0) + my_prefix = NULL; + else { + /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ + if(NULL == (my_prefix = (char *)H5MM_malloc(size + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate prefix buffer") + if(H5Pget_virtual_prefix(plist_id, my_prefix, size+1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vds prefix") + if(my_prefix) { + if(H5D__virtual_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + my_prefix = (char *)H5MM_xfree(my_prefix); + if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + full_name = (char *)H5MM_xfree(full_name); + } + } /* end if */ + } /* end if */ + + /* try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ + if(src_file == NULL) { + char *vdspath; + + if(NULL != (vdspath = H5F_EXTPATH(vdset_file))) { + if(H5D__virtual_build_name(vdspath, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + full_name = (char *)H5MM_xfree(full_name); + } /* end if */ + } /* end if */ + + /* try the relative file_name stored in temp_file_name */ + if(src_file == NULL) { + if(NULL == (src_file = H5F_open(temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + } /* end if */ + + /* try the 'resolved' name for the virtual file */ + if(src_file == NULL) { + char *ptr = NULL; + + /* Copy resolved file name */ + if(NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(vdset_file)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string") + + /* get last component of file_name */ + H5_GET_LAST_DELIMITER(actual_file_name, ptr) + if(!ptr) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) + + /* Truncate filename portion from actual file name path */ + *ptr = '\0'; + + /* Build new file name for the external file */ + if(H5D__virtual_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") + actual_file_name = (char *)H5MM_xfree(actual_file_name); + + /* Try opening with the resolved name */ + if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) + full_name = (char *)H5MM_xfree(full_name); + } /* end if */ + + /* Success */ + ret_value = src_file; +done: + if((NULL == ret_value) && src_file) + if(H5F_try_close(src_file, NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, NULL, "can't close source file") + if(my_prefix) + my_prefix = (char *)H5MM_xfree(my_prefix); + if(full_name) + full_name = (char *)H5MM_xfree(full_name); + if(temp_file_name) + temp_file_name = (char *)H5MM_xfree(temp_file_name); + if(actual_file_name) + actual_file_name = (char *)H5MM_xfree(actual_file_name); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__virtual_open_file() */ + /*------------------------------------------------------------------------- * Function: H5D__virtual_open_source_dset @@ -750,9 +1000,13 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_srcdset_t *source_dset, hid_t dxpl_id) { H5F_t *src_file = NULL; /* Source file */ + char *vds_prefix = NULL; /* Source file vds_prefix */ hbool_t src_file_open = FALSE; /* Whether we have opened and need to close src_file */ H5G_loc_t src_root_loc; /* Object location of source file root group */ herr_t ret_value = SUCCEED; /* Return value */ + char *full_name = NULL; /* File name with prefix */ + unsigned intent; /* File access permissions */ + hid_t plist_id = -1; /* Property list pointer */ FUNC_ENTER_STATIC @@ -765,8 +1019,9 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, /* Check if we need to open the source file */ if(HDstrcmp(source_dset->file_name, ".")) { - /* Open the source file */ - if(NULL == (src_file = H5F_open(source_dset->file_name, H5F_INTENT(vdset->oloc.file) & (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ), H5P_FILE_CREATE_DEFAULT, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) + if((plist_id = H5D_get_access_plist(vdset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist") + if(NULL == (src_file = H5D__virtual_open_file(plist_id, vdset->oloc.file, source_dset->file_name, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ else src_file_open = TRUE; @@ -803,6 +1058,8 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, } /* end if */ done: + if(plist_id >= 0) + H5Pclose(plist_id); /* Close source file */ if(src_file_open) if(H5F_try_close(src_file, NULL) < 0) @@ -1407,7 +1664,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") } /* end if */ - /* Update cached values unlim_extent_source and + /* Update cached values unlim_extent_source and * clip_size_virtual */ storage->list[i].unlim_extent_source = curr_dims[storage->list[i].unlim_dim_source]; storage->list[i].clip_size_virtual = clip_size; @@ -1559,7 +1816,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space") /* Mark the space as dirty, for later writing to the file */ - if(H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) + if(H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") } /* end if */ @@ -2246,7 +2503,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space") storage->list[i].sub_dset[j].projected_mem_space = NULL; } /* end if */ - else + else *tot_nelmts += (hsize_t)select_nelmts; } /* end if */ } /* end for */ @@ -2265,7 +2522,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, /* Check if anything is selected */ if(select_nelmts > (hssize_t)0) { /* Open source dataset */ - if(!storage->list[i].source_dset.dset) + if(!storage->list[i].source_dset.dset) /* Try to open dataset */ if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") @@ -2506,7 +2763,7 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection") /* Write fill values to memory buffer */ - if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, + if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, type_info->mem_type, fill_space, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed") diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index daf0a52..96b8e36 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -25,13 +25,13 @@ typedef struct H5F_t H5F_t; #include "H5Fpublic.h" /* Public headers needed by this file */ -#include "H5FDpublic.h" /* File drivers */ +#include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ #ifdef H5_HAVE_PARALLEL -#include "H5Pprivate.h" /* Property lists */ +#include "H5Pprivate.h" /* Property lists */ #endif /* H5_HAVE_PARALLEL */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /**************************/ @@ -43,68 +43,68 @@ typedef struct H5F_t H5F_t; * Currently, all file meta-data is little-endian. */ -# define INT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ +# define INT16ENCODE(p, i) { \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } -# define UINT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ +# define UINT16ENCODE(p, i) { \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } -# define INT32ENCODE(p, i) { \ - *(p) = (uint8_t)( (uint32_t)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); (p)++; \ +# define INT32ENCODE(p, i) { \ + *(p) = (uint8_t)( (uint32_t)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); (p)++; \ } -# define UINT32ENCODE(p, i) { \ - *(p) = (uint8_t)( (i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 8) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 16) & 0xff); (p)++; \ - *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \ +# define UINT32ENCODE(p, i) { \ + *(p) = (uint8_t)( (i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 16) & 0xff); (p)++; \ + *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \ } /* Encode an unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define ENCODE_VAR(p, typ, n, l) { \ - typ _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for(_i = 0; _i < l; _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t*)(p) + l; \ +# define ENCODE_VAR(p, typ, n, l) { \ + typ _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for(_i = 0; _i < l; _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t*)(p) + l; \ } /* Encode a 32-bit unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ # define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l) -# define INT64ENCODE(p, n) { \ - int64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = (n) < 0 ? 0xff : 0; \ - (p) = (uint8_t*)(p)+8; \ +# define INT64ENCODE(p, n) { \ + int64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = (n) < 0 ? 0xff : 0; \ + (p) = (uint8_t*)(p)+8; \ } -# define UINT64ENCODE(p, n) { \ - uint64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = 0; \ - (p) = (uint8_t*)(p) + 8; \ +# define UINT64ENCODE(p, n) { \ + uint64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = 0; \ + (p) = (uint8_t*)(p) + 8; \ } /* Encode a 64-bit unsigned integer into a variable-sized buffer */ @@ -113,31 +113,31 @@ typedef struct H5F_t H5F_t; /* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define UINT64ENCODE_VARLEN(p, n) { \ - uint64_t __n = (uint64_t)(n); \ - unsigned _s = H5VM_limit_enc_size(__n); \ - \ - *(p)++ = (uint8_t)_s; \ - UINT64ENCODE_VAR(p, __n, _s); \ +# define UINT64ENCODE_VARLEN(p, n) { \ + uint64_t __n = (uint64_t)(n); \ + unsigned _s = H5VM_limit_enc_size(__n); \ + \ + *(p)++ = (uint8_t)_s; \ + UINT64ENCODE_VAR(p, __n, _s); \ } -# define H5_ENCODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32ENCODE(p, n) \ +# define H5_ENCODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32ENCODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ -# define H5_ENCODE_DOUBLE(p, n) { \ - uint64_t _n; \ - size_t _u; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - HDmemcpy(&_n, &n, sizeof(double)); \ - for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t *)(p) + 8; \ +# define H5_ENCODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + HDmemcpy(&_n, &n, sizeof(double)); \ + for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t *)(p) + 8; \ } /* DECODE converts little endian bytes pointed by p to integer values and store @@ -148,68 +148,68 @@ typedef struct H5F_t H5F_t; * correctly even if i is actually a 64bit int like in a Cray. */ -# define INT16DECODE(p, i) { \ - (i) = (int16_t)((*(p) & 0xff)); (p)++; \ +# define INT16DECODE(p, i) { \ + (i) = (int16_t)((*(p) & 0xff)); (p)++; \ (i) |= (int16_t)(((*(p) & 0xff) << 8) | \ - ((*(p) & 0x80) ? ~0xffff : 0x0)); (p)++; \ + ((*(p) & 0x80) ? ~0xffff : 0x0)); (p)++; \ } -# define UINT16DECODE(p, i) { \ - (i) = (uint16_t) (*(p) & 0xff); (p)++; \ - (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ +# define UINT16DECODE(p, i) { \ + (i) = (uint16_t) (*(p) & 0xff); (p)++; \ + (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ } -# define INT32DECODE(p, i) { \ - (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ +# define INT32DECODE(p, i) { \ + (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \ } -# define UINT32DECODE(p, i) { \ - (i) = (uint32_t)(*(p) & 0xff); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ +# define UINT32DECODE(p, i) { \ + (i) = (uint32_t)(*(p) & 0xff); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ } /* Decode a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define DECODE_VAR(p, n, l) { \ - size_t _i; \ - \ - n = 0; \ - (p) += l; \ - for (_i = 0; _i < l; _i++) \ - n = (n << 8) | *(--p); \ - (p) += l; \ +# define DECODE_VAR(p, n, l) { \ + size_t _i; \ + \ + n = 0; \ + (p) += l; \ + for (_i = 0; _i < l; _i++) \ + n = (n << 8) | *(--p); \ + (p) += l; \ } /* Decode a variable-sized buffer into a 32-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ # define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) -# define INT64DECODE(p, n) { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(int64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ +# define INT64DECODE(p, n) { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(int64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ } -# define UINT64DECODE(p, n) { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(uint64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ +# define UINT64DECODE(p, n) { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(uint64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ } /* Decode a variable-sized buffer into a 64-bit unsigned integer */ @@ -218,58 +218,58 @@ typedef struct H5F_t H5F_t; /* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define UINT64DECODE_VARLEN(p, n) { \ - unsigned _s = *(p)++; \ - \ - UINT64DECODE_VAR(p, n, _s); \ +# define UINT64DECODE_VARLEN(p, n) { \ + unsigned _s = *(p)++; \ + \ + UINT64DECODE_VAR(p, n, _s); \ } -# define H5_DECODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32DECODE(p, n) \ +# define H5_DECODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32DECODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ -# define H5_DECODE_DOUBLE(p, n) { \ - uint64_t _n; \ - size_t _u; \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - _n = 0; \ - (p) += 8; \ - for(_u = 0; _u < sizeof(uint64_t); _u++) \ - _n = (_n << 8) | *(--p); \ - HDmemcpy(&(n), &_n, sizeof(double)); \ - (p) += 8; \ +# define H5_DECODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + _n = 0; \ + (p) += 8; \ + for(_u = 0; _u < sizeof(uint64_t); _u++) \ + _n = (_n << 8) | *(--p); \ + HDmemcpy(&(n), &_n, sizeof(double)); \ + (p) += 8; \ } /* Address-related macros */ -#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ - HADDR_UNDEF==(X)+(haddr_t)(Z) || \ - (X)+(haddr_t)(Z)<(X)) -#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) +#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ + HADDR_UNDEF==(X)+(haddr_t)(Z) || \ + (X)+(haddr_t)(Z)<(X)) +#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) /* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making * certain that X is not HADDR_UNDEF and then checking that X equals Y */ -#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ - (X)==(Y)) -#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>=(Y)) -#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ - (H5F_addr_lt((X), (Y)) ? -1 : 1)) -#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) +#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ + (X)==(Y)) +#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) +#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<(Y)) +#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)<=(Y)) +#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>(Y)) +#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ + (X)>=(Y)) +#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ + (H5F_addr_lt((X), (Y)) ? -1 : 1)) +#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) #define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \ ((O1) >= (O2) && (O1) < ((O2) + (L2)))) @@ -294,7 +294,7 @@ typedef struct H5F_t H5F_t; #define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr) #define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k) #define H5F_KVALUE(F,T) ((F)->shared->sblock->btree_k[(T)->id]) -#define H5F_NREFS(F) ((F)->shared->nrefs) +#define H5F_NREFS(F) ((F)->shared->nrefs) #define H5F_SIZEOF_ADDR(F) ((F)->shared->sizeof_addr) #define H5F_SIZEOF_SIZE(F) ((F)->shared->sizeof_size) #define H5F_SOHM_ADDR(F) ((F)->shared->sohm_addr) @@ -325,8 +325,8 @@ typedef struct H5F_t H5F_t; #define H5F_USE_MDC_LOGGING(F) ((F)->shared->use_mdc_logging) #define H5F_START_MDC_LOG_ON_ACCESS(F) ((F)->shared->start_mdc_log_on_access) #define H5F_MDC_LOG_LOCATION(F) ((F)->shared->mdc_log_location) -#define H5F_ALIGNMENT(F) ((F)->shared->alignment) -#define H5F_THRESHOLD(F) ((F)->shared->threshold) +#define H5F_ALIGNMENT(F) ((F)->shared->alignment) +#define H5F_THRESHOLD(F) ((F)->shared->threshold) #define H5F_PGEND_META_THRES(F) ((F)->shared->fs.pgend_meta_thres) #define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return) #define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc) @@ -351,7 +351,7 @@ typedef struct H5F_t H5F_t; #define H5F_BASE_ADDR(F) (H5F_get_base_addr(F)) #define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F)) #define H5F_KVALUE(F,T) (H5F_Kvalue(F,T)) -#define H5F_NREFS(F) (H5F_get_nrefs(F)) +#define H5F_NREFS(F) (H5F_get_nrefs(F)) #define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) #define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) #define H5F_SOHM_ADDR(F) (H5F_get_sohm_addr(F)) @@ -382,8 +382,8 @@ typedef struct H5F_t H5F_t; #define H5F_USE_MDC_LOGGING(F) (H5F_use_mdc_logging(F)) #define H5F_START_MDC_LOG_ON_ACCESS(F) (H5F_start_mdc_log_on_access(F)) #define H5F_MDC_LOG_LOCATION(F) (H5F_mdc_log_location(F)) -#define H5F_ALIGNMENT(F) (H5F_get_alignment(F)) -#define H5F_THRESHOLD(F) (H5F_get_threshold(F)) +#define H5F_ALIGNMENT(F) (H5F_get_alignment(F)) +#define H5F_THRESHOLD(F) (H5F_get_threshold(F)) #define H5F_PGEND_META_THRES(F) (H5F_get_pgend_meta_thres(F)) #define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F)) #define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F)) @@ -392,32 +392,32 @@ typedef struct H5F_t H5F_t; /* Macros to encode/decode offset/length's for storing in the file */ -#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ - case 4: UINT32ENCODE(p,o); break; \ - case 8: UINT64ENCODE(p,o); break; \ - case 2: UINT16ENCODE(p,o); break; \ +#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { \ + case 4: UINT32ENCODE(p,o); break; \ + case 8: UINT64ENCODE(p,o); break; \ + case 2: UINT16ENCODE(p,o); break; \ } -#define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) { \ - case 4: UINT32DECODE(p, o); break; \ - case 8: UINT64DECODE(p, o); break; \ - case 2: UINT16DECODE(p, o); break; \ +#define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) { \ + case 4: UINT32DECODE(p, o); break; \ + case 8: UINT64DECODE(p, o); break; \ + case 2: UINT16DECODE(p, o); break; \ } -#define H5F_ENCODE_LENGTH_LEN(p,l,s) switch(s) { \ - case 4: UINT32ENCODE(p,l); break; \ - case 8: UINT64ENCODE(p,l); break; \ - case 2: UINT16ENCODE(p,l); break; \ - default: HDassert("bad sizeof size" && 0); \ +#define H5F_ENCODE_LENGTH_LEN(p,l,s) switch(s) { \ + case 4: UINT32ENCODE(p,l); break; \ + case 8: UINT64ENCODE(p,l); break; \ + case 2: UINT16ENCODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_ENCODE_LENGTH(f,p,l) H5F_ENCODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) -#define H5F_DECODE_LENGTH_LEN(p,l,s) switch(s) { \ - case 4: UINT32DECODE(p,l); break; \ - case 8: UINT64DECODE(p,l); break; \ - case 2: UINT16DECODE(p,l); break; \ - default: HDassert("bad sizeof size" && 0); \ +#define H5F_DECODE_LENGTH_LEN(p,l,s) switch(s) { \ + case 4: UINT32DECODE(p,l); break; \ + case 8: UINT64DECODE(p,l); break; \ + case 2: UINT16DECODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_DECODE_LENGTH(f,p,l) H5F_DECODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) @@ -427,13 +427,13 @@ typedef struct H5F_t H5F_t; * with. */ #if (H5_SIZEOF_SIZE_T >= H5_SIZEOF_OFF_T) -# define H5F_OVERFLOW_SIZET2OFFT(X) \ +# define H5F_OVERFLOW_SIZET2OFFT(X) \ ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(HDoff_t)-1))) #else # define H5F_OVERFLOW_SIZET2OFFT(X) 0 #endif #if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T) -# define H5F_OVERFLOW_HSIZET2OFFT(X) \ +# define H5F_OVERFLOW_HSIZET2OFFT(X) \ ((hsize_t)(X) >= (hsize_t)((hsize_t)1 << (8 * sizeof(HDoff_t) - 1))) #else # define H5F_OVERFLOW_HSIZET2OFFT(X) 0 @@ -461,14 +461,14 @@ typedef struct H5F_t H5F_t; #define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */ #define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */ #define H5F_CRT_FILE_SPACE_STRATEGY_NAME "file_space_strategy" /* File space handling strategy */ -#define H5F_CRT_FREE_SPACE_PERSIST_NAME "free_space_persist" /* Free-space persisting status */ +#define H5F_CRT_FREE_SPACE_PERSIST_NAME "free_space_persist" /* Free-space persisting status */ #define H5F_CRT_FREE_SPACE_THRESHOLD_NAME "free_space_threshold" /* Free space section threshold */ #define H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME "file_space_page_size" /* File space page size */ /* ========= File Access properties ============ */ -#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ +#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ #define H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */ #define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ #define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ @@ -487,7 +487,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_LATEST_FORMAT_NAME "latest_format" /* 'Use latest format version' flag */ #define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */ #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ -#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ +#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ @@ -504,7 +504,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME "page_buffer_min_raw_perc" /* the min raw data percentage for the page buffer cache */ /* ======================== File Mount properties ====================*/ -#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ +#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ #ifdef H5_HAVE_PARALLEL @@ -513,20 +513,20 @@ typedef struct H5F_t H5F_t; #endif /* H5_HAVE_PARALLEL */ /* Define the HDF5 file signature */ -#define H5F_SIGNATURE "\211HDF\r\n\032\n" +#define H5F_SIGNATURE "\211HDF\r\n\032\n" #define H5F_SIGNATURE_LEN 8 /* Version #'s of the major components of the file format */ -#define HDF5_SUPERBLOCK_VERSION_DEF 0 /* The default super block format */ -#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */ -#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_DEF 0 /* The default super block format */ +#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */ +#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 */ -#define HDF5_DRIVERINFO_VERSION_0 0 /* of the Driver Information Block*/ +#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 */ +#define HDF5_DRIVERINFO_VERSION_0 0 /* of the Driver Information Block*/ /* B-tree internal 'K' values */ #define HDF5_BTREE_SNODE_IK_DEF 16 @@ -536,54 +536,54 @@ typedef struct H5F_t H5F_t; if it is changed, the code must compensate. -QAK */ -#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */ - /* See format specification on version 1 B-trees */ +#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */ + /* See format specification on version 1 B-trees */ /* Default file space handling strategy */ -#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR +#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR /* Default free space section threshold used by free-space managers */ -#define H5F_FREE_SPACE_PERSIST_DEF FALSE +#define H5F_FREE_SPACE_PERSIST_DEF FALSE /* Default free space section threshold used by free-space managers */ -#define H5F_FREE_SPACE_THRESHOLD_DEF 1 +#define H5F_FREE_SPACE_THRESHOLD_DEF 1 /* For paged aggregation: default file space page size when not set */ -#define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096 +#define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096 /* For paged aggregation: minimum value for file space page size */ -#define H5F_FILE_SPACE_PAGE_SIZE_MIN 512 +#define H5F_FILE_SPACE_PAGE_SIZE_MIN 512 /* For paged aggregation: maxiumum value for file space page size: 1 gigabyte */ -#define H5F_FILE_SPACE_PAGE_SIZE_MAX 1024*1024*1024 +#define H5F_FILE_SPACE_PAGE_SIZE_MAX 1024*1024*1024 /* For paged aggregation: drop free-space with size <= this threshold for small meta section */ #define H5F_FILE_SPACE_PGEND_META_THRES 0 /* Default for threshold for alignment (can be set via H5Pset_alignment()) */ -#define H5F_ALIGN_DEF 1 +#define H5F_ALIGN_DEF 1 /* Default for alignment (can be set via H5Pset_alignment()) */ -#define H5F_ALIGN_THRHD_DEF 1 +#define H5F_ALIGN_THRHD_DEF 1 /* Default size for meta data aggregation block (can be set via H5Pset_meta_block_size()) */ -#define H5F_META_BLOCK_SIZE_DEF 2048 +#define H5F_META_BLOCK_SIZE_DEF 2048 /* Default size for small data aggregation block (can be set via H5Pset_small_data_block_size()) */ -#define H5F_SDATA_BLOCK_SIZE_DEF 2048 +#define H5F_SDATA_BLOCK_SIZE_DEF 2048 /* Check for file using paged aggregation */ #define H5F_PAGED_AGGR(F) (F->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && F->shared->fs_page_size) /* Metadata read attempt values */ -#define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */ -#define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */ +#define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */ +#define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */ /* Macros to define signatures of all objects in the file */ /* Size of signature information (on disk) */ /* (all on-disk signatures should be this length) */ -#define H5_SIZEOF_MAGIC 4 +#define H5_SIZEOF_MAGIC 4 /* Size of checksum information (on disk) */ /* (all on-disk checksums should be this length) */ -#define H5_SIZEOF_CHKSUM 4 +#define H5_SIZEOF_CHKSUM 4 /* v1 B-tree node signature */ #define H5B_MAGIC "TREE" @@ -704,11 +704,11 @@ typedef enum H5F_fs_state_t { typedef enum H5F_mem_page_t { H5F_MEM_PAGE_DEFAULT = 0, /* Not used */ H5F_MEM_PAGE_SUPER = 1, - H5F_MEM_PAGE_BTREE = 2, - H5F_MEM_PAGE_DRAW = 3, - H5F_MEM_PAGE_GHEAP = 4, - H5F_MEM_PAGE_LHEAP = 5, - H5F_MEM_PAGE_OHDR = 6, + H5F_MEM_PAGE_BTREE = 2, + H5F_MEM_PAGE_DRAW = 3, + H5F_MEM_PAGE_GHEAP = 4, + H5F_MEM_PAGE_LHEAP = 5, + H5F_MEM_PAGE_OHDR = 6, H5F_MEM_PAGE_LARGE_SUPER = 7, H5F_MEM_PAGE_LARGE_BTREE = 8, H5F_MEM_PAGE_LARGE_DRAW = 9, diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 61b4183..4765d00 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -144,7 +144,7 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location + * This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's location * when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 494de3e..da06297 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -71,6 +71,17 @@ #define H5D_ACS_VDS_PRINTF_GAP_DEF (hsize_t)0 #define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t #define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t +/* Definitions for VDS file prefix */ +#define H5D_ACS_VDS_PREFIX_SIZE sizeof(char *) +#define H5D_ACS_VDS_PREFIX_DEF NULL /*default is no prefix */ +#define H5D_ACS_VDS_PREFIX_SET H5P__dapl_vds_file_pref_set +#define H5D_ACS_VDS_PREFIX_GET H5P__dapl_vds_file_pref_get +#define H5D_ACS_VDS_PREFIX_ENC H5P__dapl_vds_file_pref_enc +#define H5D_ACS_VDS_PREFIX_DEC H5P__dapl_vds_file_pref_dec +#define H5D_ACS_VDS_PREFIX_DEL H5P__dapl_vds_file_pref_del +#define H5D_ACS_VDS_PREFIX_COPY H5P__dapl_vds_file_pref_copy +#define H5D_ACS_VDS_PREFIX_CMP H5P__dapl_vds_file_pref_cmp +#define H5D_ACS_VDS_PREFIX_CLOSE H5P__dapl_vds_file_pref_close /* Definition for append flush */ #define H5D_ACS_APPEND_FLUSH_SIZE sizeof(H5D_append_flush_t) #define H5D_ACS_APPEND_FLUSH_DEF {0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},NULL,NULL} @@ -112,6 +123,14 @@ static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /* Property list callbacks */ static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); +static herr_t H5P__dapl_vds_file_pref_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_vds_file_pref_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__dapl_vds_file_pref_dec(const void **_pp, void *value); +static herr_t H5P__dapl_vds_file_pref_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_vds_file_pref_copy(const char* name, size_t size, void* value); +static int H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__dapl_vds_file_pref_close(const char* name, size_t size, void* value); /* Property list callbacks */ static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); @@ -160,6 +179,7 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /* Property value defaults */ static const H5D_append_flush_t H5D_def_append_flush_g = H5D_ACS_APPEND_FLUSH_DEF; /* Default setting for append flush */ static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ +static const char *H5D_def_vds_prefix_g = H5D_ACS_VDS_PREFIX_DEF; /* Default vds prefix string */ /*------------------------------------------------------------------------- @@ -210,6 +230,12 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register property for vds prefix */ + if(H5P_register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, + NULL, H5D_ACS_VDS_PREFIX_SET, H5D_ACS_VDS_PREFIX_GET, H5D_ACS_VDS_PREFIX_ENC, H5D_ACS_VDS_PREFIX_DEC, + H5D_ACS_VDS_PREFIX_DEL, H5D_ACS_VDS_PREFIX_COPY, H5D_ACS_VDS_PREFIX_CMP, H5D_ACS_VDS_PREFIX_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register info for append flush */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, @@ -226,6 +252,254 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dacc_reg_prop() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_set + * + * Purpose: Copies a vds file prefix property when it's set + * for a property list + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_get + * + * Purpose: Copies a vds file prefix property when it's retrieved + * from a property list + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_enc + * + * Purpose: Callback routine which is called whenever the vds file flags + * property in the dataset access property list is + * encoded. + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) +{ + const char *vds_file_pref = *(const char * const *)value; + uint8_t **pp = (uint8_t **)_pp; + size_t len = 0; + uint64_t enc_value; + unsigned enc_size; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* calculate prefix length */ + if(NULL != vds_file_pref) + len = HDstrlen(vds_file_pref); + + enc_value = (uint64_t)len; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* encode the length of the prefix */ + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode the prefix */ + if(NULL != vds_file_pref) { + HDmemcpy(*(char **)pp, vds_file_pref, len); + *pp += len; + } /* end if */ + } /* end if */ + + *size += (1 + enc_size); + if(NULL != vds_file_pref) + *size += len; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_dec + * + * Purpose: Callback routine which is called whenever the vds file prefix + * property in the dataset access property list is + * decoded. + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) +{ + char **vds_file_pref = (char **)_value; + const uint8_t **pp = (const uint8_t **)_pp; + size_t len; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(pp); + HDassert(*pp); + HDassert(vds_file_pref); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + len = (size_t)enc_value; + + if(0 != len) { + /* Make a copy of the user's prefix string */ + if(NULL == (*vds_file_pref = (char *)H5MM_malloc(len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HDstrncpy(*vds_file_pref, *(const char **)pp, len); + (*vds_file_pref)[len] = '\0'; + + *pp += len; + } /* end if */ + else + *vds_file_pref = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_vds_file_pref_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_del + * + * Purpose: Frees memory used to store the vds file prefix string + * + * Return: SUCCEED (Can't fail) + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_copy + * + * Purpose: Creates a copy of the vds file prefix string + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_cmp + * + * Purpose: Callback routine which is called whenever the vds file prefix + * property in the dataset creation property list is + * compared. + * + * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. + *------------------------------------------------------------------------- + */ +static int +H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +{ + const char *pref1 = *(const char * const *)value1; + const char *pref2 = *(const char * const *)value2; + int ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(NULL == pref1 && NULL != pref2) + HGOTO_DONE(1); + if(NULL != pref1 && NULL == pref2) + HGOTO_DONE(-1); + if(NULL != pref1 && NULL != pref2) + ret_value = HDstrcmp(pref1, pref2); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_vds_file_pref_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_vds_file_pref_close + * + * Purpose: Frees memory used to store the vds file prefix string + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_vds_file_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_vds_file_pref_close() */ + /*------------------------------------------------------------------------- * Function: H5P__dapl_efile_pref_set @@ -1220,3 +1494,95 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_efile_prefix() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_virtual_prefix + * + * Purpose: Set a prefix to be applied to the path of any vds files + * traversed. + * + * If the prefix starts with ${ORIGIN}, this will be replaced by + * the absolute path of the directory of the HDF5 file containing + * the dataset. + * + * If the prefix is ".", no prefix will be applied. + * + * This property can be overwritten by the environment variable + * HDF5_VDS_PREFIX. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_virtual_prefix(hid_t plist_id, const char *prefix) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*s", plist_id, prefix); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set prefix */ + if(H5P_set(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_virtual_prefix() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_virtual_prefix + * + * Purpose: Gets the prefix to be applied to any vds file + * traversals made using this property list. + * + * If the pointer is not NULL, it points to a user-allocated + * buffer. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +ssize_t +H5Pget_virtual_prefix(hid_t plist_id, char *prefix, size_t size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + char *my_prefix; /* Library's copy of the prefix */ + size_t len; /* Length of prefix string */ + ssize_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("Zs", "i*sz", plist_id, prefix, size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Get the current prefix */ + if(H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &my_prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file prefix") + + /* Check for prefix being set */ + if(my_prefix) { + /* Copy to user's buffer, if given */ + len = HDstrlen(my_prefix); + if(prefix) { + HDstrncpy(prefix, my_prefix, MIN(len + 1, size)); + if(len >= size) + prefix[size - 1] = '\0'; + } /* end if */ + } /* end if */ + else + len = 0; + + /* Set return value */ + ret_value = (ssize_t)len; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_virtual_prefix() */ + diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 915aa38..ea9bfb4 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -13,9 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pfapl.c + * Created: H5Pfapl.c * - * Purpose: File access property list class routines + * Purpose: File access property list class routines * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ #include "H5Ppkg.h" /* Property lists */ /* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ +#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ #include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ @@ -54,10 +54,10 @@ /* ========= File Access properties ============ */ /* Definitions for the initial metadata cache resize configuration */ -#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) -#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG -#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc -#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec +#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG +#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec #define H5F_ACS_META_CACHE_INIT_CONFIG_CMP H5P__facc_cache_config_cmp /* Definitions for size of raw data chunk cache(slots) */ #define H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t) @@ -118,10 +118,10 @@ #define H5F_ACS_FILE_DRV_CMP H5P__facc_file_driver_cmp #define H5F_ACS_FILE_DRV_CLOSE H5P__facc_file_driver_close /* Definition for file close degree */ -#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) -#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT -#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc -#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec +#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) +#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT +#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc +#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec /* Definition for offset position in file for family file driver */ #define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t) #define H5F_ACS_FAMILY_OFFSET_DEF 0 @@ -175,12 +175,12 @@ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t /* Definition for # of metadata read attempts */ -#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned) -#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0 -#define H5F_ACS_METADATA_READ_ATTEMPTS_ENC H5P__encode_unsigned -#define H5F_ACS_METADATA_READ_ATTEMPTS_DEC H5P__decode_unsigned +#define H5F_ACS_METADATA_READ_ATTEMPTS_SIZE sizeof(unsigned) +#define H5F_ACS_METADATA_READ_ATTEMPTS_DEF 0 +#define H5F_ACS_METADATA_READ_ATTEMPTS_ENC H5P__encode_unsigned +#define H5F_ACS_METADATA_READ_ATTEMPTS_DEC H5P__decode_unsigned /* Definition for object flush callback */ -#define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) +#define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) #define H5F_ACS_OBJECT_FLUSH_CB_DEF {NULL, NULL} /* Definition for status_flags in the superblock */ #define H5F_ACS_CLEAR_STATUS_FLAGS_SIZE sizeof(hbool_t) @@ -309,21 +309,21 @@ static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); /* File access property list class library initialization object */ const H5P_libclass_t H5P_CLS_FACC[1] = {{ - "file access", /* Class name for debugging */ + "file access", /* Class name for debugging */ H5P_TYPE_FILE_ACCESS, /* Class type */ - &H5P_CLS_ROOT_g, /* Parent class */ - &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ - &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ - &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P__facc_reg_prop, /* 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 */ + &H5P_CLS_ROOT_g, /* Parent class */ + &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ + &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ + H5P__facc_reg_prop, /* 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 */ }}; @@ -395,149 +395,149 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, - NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, - NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, - NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, - NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, + if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, + NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, - NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, + if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, - NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, + if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, - NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, + NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, - NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, + NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, - NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, + NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, - NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, + if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, + NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ - if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, - NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, + if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, + NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, - NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, + NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of new family file size. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, - NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, + if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, + NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'use the latest version of the format' flag */ - if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g, - NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC, + if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g, + NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, + if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file cache size */ - if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, - NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, + NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, + if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) 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, - NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, + 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, - NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, + 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") /* Register the # of read attempts */ - if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, - NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, + if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, + NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object flush callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, + if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -563,44 +563,44 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the evict on close flag */ - if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, - NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, + if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, + NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, - NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective write flag */ - if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, - NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, + if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ /* Register the initial metadata cache image configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, - NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum metadata size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum raw data size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, - NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, + if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, + NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -610,33 +610,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_alignment + * Function: H5Pset_alignment * - * Purpose: Sets the alignment properties of a file access property list - * so that any file object >= THRESHOLD bytes will be aligned on - * an address which is a multiple of ALIGNMENT. The addresses - * are relative to the end of the user block; the alignment is - * calculated by subtracting the user block size from the - * absolute file address and then adjusting the address to be a - * multiple of ALIGNMENT. + * Purpose: Sets the alignment properties of a file access property list + * so that any file object >= THRESHOLD bytes will be aligned on + * an address which is a multiple of ALIGNMENT. The addresses + * are relative to the end of the user block; the alignment is + * calculated by subtracting the user block size from the + * absolute file address and then adjusting the address to be a + * multiple of ALIGNMENT. * - * Default values for THRESHOLD and ALIGNMENT are one, implying - * no alignment. Generally the default values will result in - * the best performance for single-process access to the file. - * For MPI-IO and other parallel systems, choose an alignment - * which is a multiple of the disk block size. + * Default values for THRESHOLD and ALIGNMENT are one, implying + * no alignment. Generally the default values will result in + * the best performance for single-process access to the file. + * For MPI-IO and other parallel systems, choose an alignment + * which is a multiple of the disk block size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed file access property list mechanism to the new - * generic property list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed file access property list mechanism to the new + * generic property list. *------------------------------------------------------------------------- */ herr_t @@ -668,15 +668,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_alignment + * Function: H5Pget_alignment * - * Purpose: Returns the current settings for alignment properties from a - * file access property list. The THRESHOLD and/or ALIGNMENT - * pointers may be null pointers. + * Purpose: Returns the current settings for alignment properties from a + * file access property list. The THRESHOLD and/or ALIGNMENT + * pointers may be null pointers. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * *------------------------------------------------------------------------- @@ -709,20 +709,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_set_driver + * Function: H5P_set_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -757,20 +757,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_driver + * Function: H5Pset_driver * - * Purpose: Set the file driver (DRIVER_ID) for a file access - * property list (PLIST_ID) and supply an optional - * struct containing the driver-specific properites - * (DRIVER_INFO). The driver properties will be copied into the - * property list and the reference count on the driver will be - * incremented, allowing the caller to close the driver ID but - * still use the property list. + * Purpose: Set the file driver (DRIVER_ID) for a file access + * property list (PLIST_ID) and supply an optional + * struct containing the driver-specific properites + * (DRIVER_INFO). The driver properties will be copied into the + * property list and the reference count on the driver will be + * incremented, allowing the caller to close the driver ID but + * still use the property list. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 3, 1999 * *------------------------------------------------------------------------- @@ -800,20 +800,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_peek_driver + * Function: H5P_peek_driver * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -844,22 +844,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_driver + * Function: H5Pget_driver * - * Purpose: Return the ID of the low-level file driver. PLIST_ID should - * be a file access property list. + * Purpose: Return the ID of the low-level file driver. PLIST_ID should + * be a file access property list. * - * Note: The ID returned should not be closed. + * Note: The ID returned should not be closed. * - * Return: Success: A low-level driver ID which is the same ID - * used when the driver was set for the property - * list. The driver ID is only valid as long as - * the file driver remains registered. + * Return: Success: A low-level driver ID which is the same ID + * used when the driver was set for the property + * list. The driver ID is only valid as long as + * the file driver remains registered. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -867,7 +867,7 @@ hid_t H5Pget_driver(hid_t plist_id) { H5P_genplist_t *plist; /* Property list pointer */ - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", plist_id); @@ -885,20 +885,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_peek_driver_info + * Function: H5P_peek_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -927,20 +927,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_driver_info + * Function: H5Pget_driver_info * - * Purpose: Returns a pointer directly to the file driver-specific - * information of a file access. + * Purpose: Returns a pointer directly to the file driver-specific + * information of a file access. * - * Return: Success: Ptr to *uncopied* driver specific data - * structure if any. + * Return: Success: Ptr to *uncopied* driver specific data + * structure if any. * - * Failure: NULL. Null is also returned if the driver has - * not registered any driver-specific properties - * although no error is pushed on the stack in - * this case. + * Failure: NULL. Null is also returned if the driver has + * not registered any driver-specific properties + * although no error is pushed on the stack in + * this case. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -973,7 +973,7 @@ done: * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. + * finishes the "deep" part of the copy. * * Return: Success: Non-negative * Failure: Negative @@ -1486,30 +1486,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_cache + * Function: H5Pset_cache * - * Purpose: Set the number of objects in the meta data cache and the - * maximum number of chunks and bytes in the raw data chunk - * cache. + * Purpose: Set the number of objects in the meta data cache and the + * maximum number of chunks and bytes in the raw data chunk + * cache. * - * The RDCC_W0 value should be between 0 and 1 inclusive and - * indicates how much chunks that have been fully read or fully - * written are favored for preemption. A value of zero means - * fully read or written chunks are treated no differently than - * other chunks (the preemption is strictly LRU) while a value - * of one means fully read chunks are always preempted before - * other chunks. + * The RDCC_W0 value should be between 0 and 1 inclusive and + * indicates how much chunks that have been fully read or fully + * written are favored for preemption. A value of zero means + * fully read or written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) while a value + * of one means fully read chunks are always preempted before + * other chunks. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, - size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) + size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ @@ -1540,24 +1540,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_cache + * Function: H5Pget_cache * - * Purpose: Retrieves the maximum possible number of elements in the meta - * data cache and the maximum possible number of elements and - * bytes and the RDCC_W0 value in the raw data chunk cache. Any - * (or all) arguments may be null pointers in which case the - * corresponding datum is not returned. + * Purpose: Retrieves the maximum possible number of elements in the meta + * data cache and the maximum possible number of elements and + * bytes and the RDCC_W0 value in the raw data chunk cache. Any + * (or all) arguments may be null pointers in which case the + * corresponding datum is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, May 19, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, - size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) + size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ @@ -1592,14 +1592,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_image_config + * Function: H5Pset_mdc_image_config * - * Purpose: Set the initial metadata cache image configuration in the - * target FAPL. + * Purpose: Set the initial metadata cache image configuration in the + * target FAPL. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, June 25, 2015 * *------------------------------------------------------------------------- @@ -1636,18 +1636,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_image_config + * Function: H5Pget_mdc_image_config * - * Purpose: Retrieve the metadata cache initial image configuration - * from the target FAPL. + * Purpose: Retrieve the metadata cache initial image configuration + * from the target FAPL. * - * Observe that the function will fail if config_ptr is - * NULL, or if config_ptr->version specifies an unknown - * version of H5AC_cache_image_config_t. + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_image_config_t. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Friday, June 26, 2015 * *------------------------------------------------------------------------- @@ -1687,14 +1687,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_config + * Function: H5Pset_mdc_config * - * Purpose: Set the initial metadata cache resize configuration in the - * target FAPL. + * Purpose: Set the initial metadata cache resize configuration in the + * target FAPL. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, April 7, 2005 * *------------------------------------------------------------------------- @@ -1731,18 +1731,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_config + * Function: H5Pget_mdc_config * - * Purpose: Retrieve the metadata cache initial resize configuration - * from the target FAPL. + * Purpose: Retrieve the metadata cache initial resize configuration + * from the target FAPL. * - * Observe that the function will fail if config_ptr is - * NULL, or if config_ptr->version specifies an unknown - * version of H5AC_cache_config_t. + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_cache_config_t. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer + * Programmer: J. Mainzer * Thursday, April 7, 2005 * *------------------------------------------------------------------------- @@ -1782,33 +1782,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_gc_references + * Function: H5Pset_gc_references * - * Purpose: Sets the flag for garbage collecting references for the file. - * Dataset region references (and other reference types - * probably) use space in the file heap. If garbage collection - * is on and the user passes in an uninitialized value in a - * reference structure, the heap might get corrupted. When - * garbage collection is off however and the user re-uses a - * reference, the previous heap block will be orphaned and not - * returned to the free heap space. When garbage collection is - * on, the user must initialize the reference structures to 0 or - * risk heap corruption. + * Purpose: Sets the flag for garbage collecting references for the file. + * Dataset region references (and other reference types + * probably) use space in the file heap. If garbage collection + * is on and the user passes in an uninitialized value in a + * reference structure, the heap might get corrupted. When + * garbage collection is off however and the user re-uses a + * reference, the previous heap block will be orphaned and not + * returned to the free heap space. When garbage collection is + * on, the user must initialize the reference structures to 0 or + * risk heap corruption. * - * Default value for garbage collecting references is off, just - * to be on the safe side. + * Default value for garbage collecting references is off, just + * to be on the safe side. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June, 1999 + * Programmer: Quincey Koziol + * June, 1999 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -1835,22 +1835,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_gc_references + * Function: H5Pget_gc_references * - * Purpose: Returns the current setting for the garbage collection - * references property from a file access property list. + * Purpose: Returns the current setting for the garbage collection + * references property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * June, 1999 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -1949,31 +1949,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_meta_block_size + * Function: H5Pset_meta_block_size * - * Purpose: Sets the minimum size of metadata block allocations when + * Purpose: Sets the minimum size of metadata block allocations when * the H5FD_FEAT_AGGREGATE_METADATA is set by a VFL driver. * Each "raw" metadata block is allocated to be this size and then * specific pieces of metadata (object headers, local heaps, B-trees, etc) * are sub-allocated from this block. * - * The default value is set to 2048 (bytes), indicating that metadata + * The default value is set to 2048 (bytes), indicating that metadata * will be attempted to be bunched together in (at least) 2K blocks in * the file. Setting the value to 0 with this API function will * turn off the metadata aggregation, even if the VFL driver attempts to * use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2000,22 +2000,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_meta_block_size + * Function: H5Pget_meta_block_size * - * Purpose: Returns the current settings for the metadata block allocation + * Purpose: Returns the current settings for the metadata block allocation * property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 29, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2044,31 +2044,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_sieve_buf_size + * Function: H5Pset_sieve_buf_size * - * Purpose: Sets the maximum size of the data seive buffer used for file + * Purpose: Sets the maximum size of the data seive buffer used for file * drivers which are capable of using data sieving. The data sieve * buffer is used when performing I/O on datasets in the file. Using a * buffer which is large anough to hold several pieces of the dataset * being read in for hyperslab selections boosts performance by quite a * bit. * - * The default value is set to 64KB, indicating that file I/O for raw data + * The default value is set to 64KB, indicating that file I/O for raw data * reads and writes will occur in at least 64KB blocks. * Setting the value to 0 with this API function will turn off the * data sieving, even if the VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2095,22 +2095,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_sieve_buf_size + * Function: H5Pget_sieve_buf_size * - * Purpose: Returns the current settings for the data sieve buffer size + * Purpose: Returns the current settings for the data sieve buffer size * property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 21, 2000 * * Modifications: * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. + * Raymond Lu + * Tuesday, Oct 23, 2001 + * Changed the file access list to the new generic property + * list. * *------------------------------------------------------------------------- */ @@ -2138,23 +2138,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_small_data_block_size + * Function: H5Pset_small_data_block_size * - * Purpose: Sets the minimum size of "small" raw data block allocations + * Purpose: Sets the minimum size of "small" raw data block allocations * when the H5FD_FEAT_AGGREGATE_SMALLDATA is set by a VFL driver. * Each "small" raw data block is allocated to be this size and then * pieces of raw data which are small enough to fit are sub-allocated from * this block. * - * The default value is set to 2048 (bytes), indicating that raw data + * The default value is set to 2048 (bytes), indicating that raw data * smaller than this value will be attempted to be bunched together in (at * least) 2K blocks in the file. Setting the value to 0 with this API * function will turn off the "small" raw data aggregation, even if the * VFL driver attempts to use that strategy. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * * Modifications: @@ -2184,14 +2184,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_small_data_block_size + * Function: H5Pget_small_data_block_size * - * Purpose: Returns the current settings for the "small" raw data block + * Purpose: Returns the current settings for the "small" raw data block * allocation property from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * * Modifications: @@ -2223,9 +2223,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_libver_bounds + * Function: H5Pset_libver_bounds * - * Purpose: Indicates which versions of the file format the library should + * Purpose: Indicates which versions of the file format the library should * use when creating objects. LOW is the earliest version of the HDF5 * library that is guaranteed to be able to access the objects created * (the format of some objects in an HDF5 file may not have changed between @@ -2301,9 +2301,9 @@ done: * releases and then map down to the previous actual library release which * had a format change. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, December 30, 2007 * *------------------------------------------------------------------------- @@ -2341,14 +2341,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_libver_bounds + * Function: H5Pget_libver_bounds * - * Purpose: Returns the current settings for the library version format bounds + * Purpose: Returns the current settings for the library version format bounds * from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 3, 2008 * *------------------------------------------------------------------------- @@ -2464,9 +2464,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_file_image * - * Purpose: Sets the initial file image. Some file drivers can initialize - * the starting data in a file from a buffer. - * + * Purpose: Sets the initial file image. Some file drivers can initialize + * the starting data in a file from a buffer. + * * Return: Non-negative on success/Negative on failure * * Programmer: Jacob Gruber @@ -2480,22 +2480,22 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) H5P_genplist_t *fapl; /* Property list pointer */ H5FD_file_image_info_t image_info; /* File image info */ herr_t ret_value = SUCCEED; /* Return value */ - + FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*xz", fapl_id, buf_ptr, buf_len); /* validate parameters */ if(!(((buf_ptr == NULL) && (buf_len == 0)) || ((buf_ptr != NULL) && (buf_len > 0)))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistant buf_ptr and buf_len") - + /* Get the plist structure */ if(NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - + /* Get old image info */ if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image pointer") - + /* Release previous buffer, if it exists */ if(image_info.buffer != NULL) { if(image_info.callbacks.image_free) { @@ -2504,8 +2504,8 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) } /* end if */ else H5MM_xfree(image_info.buffer); - } /* end if */ - + } /* end if */ + /* Update struct */ if(buf_ptr) { /* Allocate memory */ @@ -2517,15 +2517,15 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) else if(NULL == (image_info.buffer = H5MM_malloc(buf_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") - + /* Copy data */ if(image_info.callbacks.image_memcpy) { - if(image_info.buffer != image_info.callbacks.image_memcpy(image_info.buffer, - buf_ptr, buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, + if(image_info.buffer != image_info.callbacks.image_memcpy(image_info.buffer, + buf_ptr, buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, image_info.callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(image_info.buffer, buf_ptr, buf_len); } /* end if */ else @@ -2545,24 +2545,24 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_file_image * - * Purpose: If the file image exists and buf_ptr_ptr is not NULL, - * allocate a buffer of the correct size, copy the image into - * the new buffer, and return the buffer to the caller in - * *buf_ptr_ptr. Do this using the file image callbacks - * if defined. + * Purpose: If the file image exists and buf_ptr_ptr is not NULL, + * allocate a buffer of the correct size, copy the image into + * the new buffer, and return the buffer to the caller in + * *buf_ptr_ptr. Do this using the file image callbacks + * if defined. * - * NB: It is the responsibility of the caller to free the - * buffer whose address is returned in *buf_ptr_ptr. Do - * this using free if the file image callbacks are not - * defined, or with whatever method is appropriate if - * the callbacks are defined. + * NB: It is the responsibility of the caller to free the + * buffer whose address is returned in *buf_ptr_ptr. Do + * this using free if the file image callbacks are not + * defined, or with whatever method is appropriate if + * the callbacks are defined. * - * If buf_ptr_ptr is not NULL, and no image exists, set - * *buf_ptr_ptr to NULL. + * If buf_ptr_ptr is not NULL, and no image exists, set + * *buf_ptr_ptr to NULL. * - * If buf_len_ptr is not NULL, set *buf_len_ptr equal - * to the length of the file image if it exists, and - * to 0 if it does not. + * If buf_len_ptr is not NULL, set *buf_len_ptr equal + * to the length of the file image if it exists, and + * to 0 if it does not. * * Return: Non-negative on success/Negative on failure * @@ -2590,7 +2590,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ - HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || + HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || ((image_info.buffer == NULL) && (image_info.size == 0))); /* Set output size */ @@ -2611,15 +2611,15 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) else if(NULL == (copy_ptr = H5MM_malloc(image_info.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate copy") - + /* Copy data */ if(image_info.callbacks.image_memcpy) { if(copy_ptr != image_info.callbacks.image_memcpy(copy_ptr, image_info.buffer, - image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, + image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, image_info.callbacks.udata)) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(copy_ptr, image_info.buffer, image_info.size); } /* end if */ @@ -2636,7 +2636,7 @@ done: * * Purpose: Sets the callbacks for file images. Some file drivers allow * the use of user-defined callbacks for allocating, freeing and - * copying the drivers internal buffer, potentially allowing a + * copying the drivers internal buffer, potentially allowing a * clever user to do optimizations such as avoiding large mallocs * and memcpys or to perform detailed logging. * @@ -2666,7 +2666,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || + HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* Make sure a file image hasn't already been set */ @@ -2675,7 +2675,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* verify that callbacks_ptr is not NULL */ if(NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") /* Make sure udata callbacks are going to be set if udata is going to be set */ if(callbacks_ptr->udata) @@ -2686,7 +2686,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback if(info.callbacks.udata != NULL) { HDassert(info.callbacks.udata_free); if(info.callbacks.udata_free(info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") } /* end if */ /* Update struct */ @@ -2713,7 +2713,7 @@ done: * * Purpose: Sets the callbacks for file images. Some file drivers allow * the use of user-defined callbacks for allocating, freeing and - * copying the drivers internal buffer, potentially allowing a + * copying the drivers internal buffer, potentially allowing a * clever user to do optimizations such as avoiding large mallocs * * Return: Non-negative on success/Negative on failure @@ -2742,12 +2742,12 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || + HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* verify that callbacks_ptr is not NULL */ if(NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") /* Transfer values to parameters */ *callbacks_ptr = info.callbacks; @@ -2768,12 +2768,12 @@ done: * Function: H5P__file_image_info_copy * * Purpose: Copy file image info. The buffer - * and udata may need to be copied, possibly using their + * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. + * finishes the "deep" part of the copy. * * Return: Success: Non-negative * Failure: Negative @@ -2796,7 +2796,7 @@ H5P__file_image_info_copy(void *value) info = (H5FD_file_image_info_t *)value; /* verify file image field consistancy */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || + HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); if(info->buffer && info->size > 0) { @@ -2815,14 +2815,14 @@ H5P__file_image_info_copy(void *value) if(NULL == (info->buffer = H5MM_malloc(info->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ - + /* Copy data to new buffer */ if(info->callbacks.image_memcpy) { - if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, - info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, + info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ - else + else HDmemcpy(info->buffer, old_buffer, info->size); } /* end if */ @@ -2846,8 +2846,8 @@ done: * Function: H5P__file_image_info_free * * Purpose: Free file image info. The buffer and udata may need to be - * freed, possibly using their respective callbacks, so the - * default free won't work. + * freed, possibly using their respective callbacks, so the + * default free won't work. * * Return: Success: Non-negative * Failure: Negative @@ -2868,16 +2868,16 @@ H5P__file_image_info_free(void *value) H5FD_file_image_info_t *info; /* Image info struct */ info = (H5FD_file_image_info_t *)value; - + /* Verify file image field consistancy */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || + HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); /* Free buffer */ - if(info->buffer != NULL && info->size > 0) { + if(info->buffer != NULL && info->size > 0) { if(info->callbacks.image_free) { if((*info->callbacks.image_free)(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") } /* end if */ else H5MM_xfree(info->buffer); @@ -2903,7 +2903,7 @@ done: * Purpose: Compare two cache image configurations. * * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is - * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * * Programmer: John Mainzer * June 26, 2015 @@ -2944,11 +2944,11 @@ done: * Function: H5P__facc_cache_image_config_enc * * Purpose: Callback routine which is called whenever the default - * cache image config property in the file creation - * property list is encoded. + * cache image config property in the file creation + * property list is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: John Mainzer * June 26, 2015 @@ -2990,11 +2990,11 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) * Function: H5P__facc_cache_image_config_dec * * Purpose: Callback routine which is called whenever the default - * cache image config property in the file creation property - * list is decoded. + * cache image config property in the file creation property + * list is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: John Mainzer * June 26, 2015 @@ -3109,7 +3109,7 @@ done: * * Purpose: Delete callback for the file image info property, called * when the property is deleted from the plist. The buffer - * and udata may need to be freed, possibly using their + * and udata may need to be freed, possibly using their * respective callbacks so the default free won't work. * * Return: Non-negative on success/Negative on failure @@ -3139,7 +3139,7 @@ done: * Function: H5P__facc_file_image_info_copy * * Purpose: Copy callback for the file image info property. The buffer - * and udata may need to be copied, possibly using their + * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * * Return: Non-negative on success/Negative on failure @@ -3228,7 +3228,7 @@ done: * Function: H5P__facc_file_image_info_close * * Purpose: Close callback for the file image info property. The buffer - * and udata may need to be freed, possibly using their + * and udata may need to be freed, possibly using their * respective callbacks so the standard free won't work. * * Return: Non-negative on success/Negative on failure @@ -3260,7 +3260,7 @@ done: * Purpose: Compare two cache configurations. * * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is - * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * * Programmer: Mohamad Chaarawi * September 24, 2012 @@ -3373,8 +3373,8 @@ done: * cache config property in the file creation property list is * encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * August 09, 2012 @@ -3518,8 +3518,8 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) * cache config property in the file creation property list is * decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * August 09, 2012 @@ -3653,8 +3653,8 @@ done: * degree property in the file access property list * is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3691,8 +3691,8 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) * degree property in the file access property list * is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3726,8 +3726,8 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) * memory type property in the file access property list * is encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3764,8 +3764,8 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) * memory type property in the file access property list * is decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -3793,12 +3793,12 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) /*------------------------------------------------------------------------- - * Function: H5Pset_core_write_tracking + * Function: H5Pset_core_write_tracking * - * Purpose: Enables/disables core VFD write tracking and page + * Purpose: Enables/disables core VFD write tracking and page * aggregation size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Dana Robinson * Tuesday, April 8, 2014 @@ -3834,12 +3834,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_core_write_tracking + * Function: H5Pget_core_write_tracking * - * Purpose: Gets information about core VFD write tracking and page + * Purpose: Gets information about core VFD write tracking and page * aggregation size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Dana Robinson * Tuesday, April 8, 2014 @@ -3876,19 +3876,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_metadata_read_attempts + * Function: H5Pset_metadata_read_attempts + * + * Purpose: Sets the # of read attempts in the file access property list + * when reading metadata with checksum. + * The # of read attempts set via this routine will only apply + * when opening a file with SWMR access. + * The # of read attempts set via this routine does not have + * any effect when opening a file with non-SWMR access; for this + * case, the # of read attempts will be always be 1. * - * Purpose: Sets the # of read attempts in the file access property list - * when reading metadata with checksum. - * The # of read attempts set via this routine will only apply - * when opening a file with SWMR access. - * The # of read attempts set via this routine does not have - * any effect when opening a file with non-SWMR access; for this - * case, the # of read attempts will be always be 1. - * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 + * Programmer: Vailin Choi; Sept 2013 * *------------------------------------------------------------------------- */ @@ -3919,13 +3919,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_metadata_read_attempts + * Function: H5Pget_metadata_read_attempts * - * Purpose: Returns the # of metadata read attempts set in the file access property list. + * Purpose: Returns the # of metadata read attempts set in the file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 + * Programmer: Vailin Choi; Sept 2013 * *------------------------------------------------------------------------- */ @@ -3945,13 +3945,13 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts/*out*/) if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Get the # of read attempts set */ + /* Get the # of read attempts set */ if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, attempts) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get the number of metadata read attempts") - /* If not set, return the default value */ - if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ - *attempts = H5F_METADATA_READ_ATTEMPTS; + /* If not set, return the default value */ + if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ + *attempts = H5F_METADATA_READ_ATTEMPTS; } /* end if */ done: @@ -3960,14 +3960,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_obj_flush_cb + * Function: H5Pset_obj_flush_cb * - * Purpose: Sets the callback function to invoke and the user data when an - * object flush occurs in the file. - * - * Return: Non-negative on success/Negative on failure + * Purpose: Sets the callback function to invoke and the user data when an + * object flush occurs in the file. * - * Programmer: Vailin Choi; Dec 2013 + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ @@ -4004,14 +4004,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_obj_flush_cb + * Function: H5Pget_obj_flush_cb + * + * Purpose: Retrieves the callback function and user data set in the + * property list for an object flush. * - * Purpose: Retrieves the callback function and user data set in the - * property list for an object flush. - * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Dec 2013 + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ @@ -4035,9 +4035,9 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata) /* Assign return value */ if(func) - *func = flush_info.func; + *func = flush_info.func; if(udata) - *udata = flush_info.udata; + *udata = flush_info.udata; done: FUNC_LEAVE_API(ret_value) @@ -4045,11 +4045,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_mdc_log_options + * Function: H5Pset_mdc_log_options * - * Purpose: Set metadata cache log options. + * Purpose: Set metadata cache log options. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -4097,11 +4097,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_mdc_log_options + * Function: H5Pget_mdc_log_options * - * Purpose: Get metadata cache log options. + * Purpose: Get metadata cache log options. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -4455,8 +4455,8 @@ done: * * Purpose: Generic encoding callback routine for 'coll_md_read_flag' properties. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 @@ -4493,8 +4493,8 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) * * Purpose: Generic decoding callback routine for 'coll_md_read_flag' properties. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 @@ -4523,22 +4523,22 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) /*------------------------------------------------------------------------- - * Function: H5Pset_all_coll_metadata_ops + * Function: H5Pset_all_coll_metadata_ops * - * Purpose: Tell the library whether the metadata read operations will - * be done collectively (1) or not (0). Default is independent. - * With collective mode, the library will optimize access to - * metadata operations on the file. + * Purpose: Tell the library whether the metadata read operations will + * be done collectively (1) or not (0). Default is independent. + * With collective mode, the library will optimize access to + * metadata operations on the file. * - * Note: This routine accepts file access property lists, link - * access property lists, attribute access property lists, - * dataset access property lists, group access property lists, - * named datatype access property lists, - * and dataset transfer property lists. + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4582,19 +4582,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_all_coll_metadata_ops + * Function: H5Pget_all_coll_metadata_ops * - * Purpose: Gets information about collective metadata read mode. + * Purpose: Gets information about collective metadata read mode. * - * Note: This routine accepts file access property lists, link - * access property lists, attribute access property lists, - * dataset access property lists, group access property lists, - * named datatype access property lists, - * and dataset transfer property lists. + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4640,14 +4640,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_coll_metadata_write + * Function: H5Pset_coll_metadata_write * - * Purpose: Tell the library whether the metadata write operations will - * be done collectively (1) or not (0). Default is collective. + * Purpose: Tell the library whether the metadata write operations will + * be done collectively (1) or not (0). Default is collective. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4679,13 +4679,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_coll_metadata_write + * Function: H5Pget_coll_metadata_write * - * Purpose: Gets information about collective metadata write mode. + * Purpose: Gets information about collective metadata write mode. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * Sunday, June 21, 2015 * *------------------------------------------------------------------------- @@ -4717,15 +4717,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_page_buffer_size + * Function: H5Pset_page_buffer_size * * Purpose: Set the maximum page buffering size. This has to be a * multiple of the page allocation size which must be enabled; * otherwise file create/open will fail. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * June 2015 * *------------------------------------------------------------------------- @@ -4765,13 +4765,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_page_buffer_size + * Function: H5Pget_page_buffer_size * - * Purpose: Retrieves the maximum page buffer size. + * Purpose: Retrieves the maximum page buffer size. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi + * Programmer: Mohamad Chaarawi * June 2015 * *------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 493a322..a2c0418 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -420,6 +420,8 @@ H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view); H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view); H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size); H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size); +H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); +H5_DLL ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); H5_DLL herr_t H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t boundary[], H5D_append_cb_t func, void *udata); H5_DLL herr_t H5Pget_append_flush(hid_t plist_id, unsigned dims, diff --git a/src/H5system.c b/src/H5system.c index a8726c2..719b7e0 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1043,7 +1043,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) * Unix: does not apply */ if(H5_CHECK_ABS_DRIVE(name)) { - drive = name[0] - 'A' + 1; + drive = HDtoupper(name[0]) - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); HDstrncpy(new_name, &name[2], name_len); } /* end if */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6e8fd78..713f2bd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,7 +37,7 @@ endif () if (MINGW) target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") endif () -target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE ${LINK_LIBS}) +target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${LINK_LIBS}) target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC) set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES @@ -54,7 +54,7 @@ if (BUILD_SHARED_LIBS) if (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "wsock32.lib") endif () - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE ${LINK_LIBS}) + target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${LINK_LIBS}) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES @@ -174,13 +174,13 @@ set (testhdf5_SOURCES add_executable (testhdf5 ${testhdf5_SOURCES}) TARGET_NAMING (testhdf5 STATIC) TARGET_C_PROPERTIES (testhdf5 STATIC " " " ") -target_link_libraries (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (testhdf5 ${HDF5_TEST_LIB_TARGET}) set_target_properties (testhdf5 PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (testhdf5-shared ${testhdf5_SOURCES}) TARGET_NAMING (testhdf5-shared SHARED) TARGET_C_PROPERTIES (testhdf5-shared SHARED " " " ") - target_link_libraries (testhdf5-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (testhdf5-shared PUBLIC ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (testhdf5-shared PROPERTIES FOLDER test) endif () @@ -188,13 +188,13 @@ MACRO (ADD_H5_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}) + target_link_libraries (${file} PUBLIC ${HDF5_TEST_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}) + target_link_libraries (${file}-shared PUBLIC ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (${file}-shared PROPERTIES FOLDER test) endif () ENDMACRO () diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 973d389..fca2f27 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -452,7 +452,6 @@ set (test_CLEANFILES extlinks19B00026.h5 extlinks19B00027.h5 extlinks19B00028.h5 - tmp big.data big*.h5 stdio.h5 @@ -582,6 +581,7 @@ set (test_CLEANFILES cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 + tmp/vds_src_2.h5 ) # Remove any output file left over from previous test run @@ -839,21 +839,28 @@ add_test (NAME H5TEST-clear-error_test-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" -) -set_tests_properties (H5TEST-error_test PROPERTIES - DEPENDS H5TEST-clear-error_test-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) +if (HDF5_USE_16_API_DEFAULT) + add_test ( + NAME H5TEST-error_test-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" + ) +else () + add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-error_test PROPERTIES + DEPENDS H5TEST-clear-error_test-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +endif () #-- Adding test for links_env add_test (NAME H5TEST-clear-links_env-objects @@ -959,21 +966,28 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) - add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-error_test PROPERTIES - DEPENDS H5TEST-shared-clear-error_test-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) + if (HDF5_USE_16_API_DEFAULT) + add_test ( + NAME H5TEST-shared-error_test-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" + ) + else () + add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_1" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-shared-error_test PROPERTIES + DEPENDS H5TEST-shared-clear-error_test-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + endif () #-- Adding test for links_env add_test (NAME H5TEST-shared-clear-links_env-objects diff --git a/test/vds.c b/test/vds.c index c9b7a1b..a882698 100644 --- a/test/vds.c +++ b/test/vds.c @@ -36,6 +36,12 @@ const char *FILENAME[] = { "vds_src_1", "vds%%_src", "vds_dapl", + "vds_virt_2", + "vds_virt_3", + "vds_src_2", + "vds_src_3", + "vds%%_src2", + "vds_dapl2", NULL }; @@ -49,6 +55,8 @@ const char *FILENAME[] = { #define FILENAME_BUF_SIZE 1024 +#define TMPDIR "tmp/" + /*------------------------------------------------------------------------- * Function: vds_select_equal @@ -57,14 +65,7 @@ const char *FILENAME[] = { * provided dataspaces are the same. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Neil Fortner - * Monday, March 2, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -130,7 +131,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } /* end if */ + } /* Free buffers */ HDfree(buf1); @@ -180,7 +181,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } /* end if */ + } /* Free buffers */ HDfree(buf1); @@ -217,14 +218,7 @@ error: * parameters. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Neil Fortner - * Monday, March 2, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -298,8 +292,7 @@ vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, error: H5E_BEGIN_TRY { - if(space_out >= 0) - (void)H5Sclose(space_out); + H5Sclose(space_out); } H5E_END_TRY return -1; @@ -312,14 +305,7 @@ error: * Purpose: Tests API functions related to virtual datasets. * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Monday, February 16, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ /* Helper function to get DCPL for examination depending on config */ @@ -370,12 +356,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, file = -1; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } /* Open dataset */ if((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get DCPL from dataset */ if((*ex_dcpl = H5Dget_create_plist(dset)) < 0) @@ -394,8 +380,8 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(oinfo.meta_size.obj.heap_size != exp_meta_size) { printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR - } /* end if */ - } /* end if */ + } + } else if((oinfo.meta_size.obj.heap_size != exp_meta_size) && (oinfo.meta_size.obj.heap_size != (hsize_t)0)) @@ -424,12 +410,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(H5Fclose(file) < 0) TEST_ERROR file = -1; - } /* end if */ + } else if(config == TEST_API_COPY_PLIST) { /* Copy property list */ if((*ex_dcpl = H5Pcopy(dcpl)) < 0) TEST_ERROR - } /* end if */ + } else if(config == TEST_API_ENCDEC_PLIST) { size_t plist_buf_size; @@ -448,14 +434,14 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, /* Free plist_buf */ HDfree(plist_buf); plist_buf = NULL; - } /* end if */ + } else { /* Simply copy the id to ex_dcpl and increment the ref count so ex_dcpl * can be closed */ if(H5Iinc_ref(dcpl) < 0) TEST_ERROR *ex_dcpl = dcpl; - } /* end else */ + } /* Verify examination DCPL is equal to original DCPL. Do not compare the * plist to itself, and do not do the comparison if we reopened the file, @@ -466,16 +452,14 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(!tri_ret) TEST_ERROR - } /* end if */ + } return 0; error: H5E_BEGIN_TRY { - if(file >= 0) - (void)H5Fclose(file); - if(dset >= 0) - (void)H5Dclose(dset); + H5Fclose(file); + H5Dclose(dset); } H5E_END_TRY; if(plist_buf) HDfree(plist_buf); @@ -532,7 +516,7 @@ test_api(test_api_config_t config, hid_t fapl) case TEST_API_NTESTS: default: TEST_ERROR - } /* end switch */ + } h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -818,7 +802,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Create virtual dataspace */ if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - } /* end for */ + } /* Select all (should not be necessary, but just to be sure) */ if(H5Sselect_all(srcspace[0]) < 0) @@ -932,7 +916,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } /* end for */ + } if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1038,7 +1022,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Add virtual layout mapping */ if(H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0) TEST_ERROR - } /* end if */ + } /* Get examination DCPL */ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)697) < 0) @@ -1063,7 +1047,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Check that the mapping in the DCPL is correct */ if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0) TEST_ERROR - } /* end if */ + } /* Close */ if(H5Sclose(srcspace[0]) < 0) @@ -1073,7 +1057,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } /* end for */ + } if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1123,23 +1107,460 @@ test_api(test_api_config_t config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(dcpl >= 0) - (void)H5Pclose(dcpl); - if(ex_dcpl >= 0) - (void)H5Pclose(ex_dcpl); + for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Pclose(dcpl); + H5Pclose(ex_dcpl); } H5E_END_TRY; return 1; } /* end test_api() */ +/*------------------------------------------------------------------------- + * Function: vds_link_prefix + * + * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp" + * Should be able to access the target source files in tmp directory via the prefix set + * by H5Pset_virtual_prefix() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +test_vds_prefix(unsigned config, hid_t fapl) +{ + char srcfilename[FILENAME_BUF_SIZE]; + char srcfilename_map[FILENAME_BUF_SIZE]; + char vfilename[FILENAME_BUF_SIZE]; + char vfilename2[FILENAME_BUF_SIZE]; + char srcfilenamepct[FILENAME_BUF_SIZE]; + char srcfilenamepct_map[FILENAME_BUF_SIZE]; + const char *srcfilenamepct_map_orig = "vds%%%%_src"; + hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t vfile2 = -1; /* File with copied virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t dapl = -1; /* Dataset access property list */ + hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ + hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ + hsize_t start[4]; /* Hyperslab start */ + hsize_t stride[4]; /* Hyperslab stride */ + hsize_t count[4]; /* Hyperslab count */ + hsize_t block[4]; /* Hyperslab block */ + hssize_t offset[2] = {0, 0}; /* Selection offset */ + int buf[10][26]; /* Write and expected read buffer */ + int rbuf[10][26]; /* Read buffer */ + int rbuf99[9][9]; /* 9x9 Read buffer */ + int evbuf[10][26]; /* Expected VDS "buffer" */ + int erbuf[10][26]; /* Expected read buffer */ + int fill = -1; /* Fill value */ + herr_t ret; /* Generic return value */ + int i, j; + char buffer[1024]; /* buffer to read vds_prefix */ + + TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()") + + h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); + h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2); + h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename); + h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map); + h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + + /* create tmp directory and get current working directory path */ + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + + /* Create DCPL */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + /* Set fill value */ + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + TEST_ERROR + + /* Initialize VDS prefix items */ + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + TEST_ERROR + + if(H5Pset_virtual_prefix(dapl, TMPDIR) < 0) + TEST_ERROR + if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) + TEST_ERROR + + if(HDstrcmp(buffer, TMPDIR) != 0) + FAIL_PUTS_ERROR("vds prefix not set correctly"); + + /* + * Test 1: All - all selection + */ + /* Create source dataspace */ + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspace */ + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all (should not be necessary, but just to be sure) */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + if(H5Sselect_all(vspace[0]) < 0) + TEST_ERROR + + /* Add virtual layout mapping */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) + TEST_ERROR + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source dataset */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + TEST_ERROR + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Write data directly to source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Close srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + + if(config & TEST_IO_DIFFERENT_FILE) { + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + TEST_ERROR + } + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) { + TEST_ERROR + } + } + + /* Adjust write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); + + /* Write data through virtual dataset */ + if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Reopen srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Read data directly from source dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) + TEST_ERROR + + /* Close */ + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Pclose(dapl) < 0) + TEST_ERROR + dapl = -1; + if(H5Pclose(dcpl) < 0) + TEST_ERROR + dcpl = -1; + + /* + * Test 2: All - all selection with ENV prefix + */ + if(HDsetenv("HDF5_VDS_PREFIX", "${ORIGIN}/tmp", 1)) + TEST_ERROR + + /* Create DCPL */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + /* Set fill value */ + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + TEST_ERROR + + /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + TEST_ERROR + + if(H5Pset_virtual_prefix(dapl, "someprefix") < 0) + TEST_ERROR + if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) + TEST_ERROR + + if(HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("vds prefix not set correctly"); + + /* Create source dataspace */ + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspace */ + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all (should not be necessary, but just to be sure) */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + if(H5Sselect_all(vspace[0]) < 0) + TEST_ERROR + + /* Add virtual layout mapping */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) + TEST_ERROR + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source dataset */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + TEST_ERROR + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Write data directly to source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Close srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + + if(config & TEST_IO_DIFFERENT_FILE) { + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + TEST_ERROR + } + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) { + TEST_ERROR + } + } + + /* Adjust write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); + + /* Write data through virtual dataset */ + if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Reopen srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Read data directly from source dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) + TEST_ERROR + + /* Close */ + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Pclose(dapl) < 0) + TEST_ERROR + dapl = -1; + if(H5Pclose(dcpl) < 0) + TEST_ERROR + dcpl = -1; + + if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) + TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + H5Fclose(vfile2); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(memspace); + H5Pclose(dapl); + H5Pclose(dcpl); + } H5E_END_TRY; + + if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) + TEST_ERROR + + return 1; +} /* end vds_link_prefix() */ + /*------------------------------------------------------------------------- * Function: test_basic_io @@ -1148,14 +1569,7 @@ error: * pattern-matching file/dataset strings * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Tuesday, March 3, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1238,12 +1652,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1272,8 +1686,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1287,7 +1701,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1316,7 +1730,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1400,12 +1814,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1441,8 +1855,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1456,7 +1870,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1487,7 +1901,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1536,8 +1950,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1546,7 +1960,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } /* Open v_dset2 */ if((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0) @@ -1572,7 +1986,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Only copy to a different file if the source datasets are in a different * file */ @@ -1614,8 +2028,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen copied virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1624,7 +2038,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile2 = -1; if((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } /* Open v_dset3 */ if((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0) @@ -1650,13 +2064,13 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Close copied virtual file */ if(H5Fclose(vfile2) < 0) TEST_ERROR vfile2 = -1; - } /* end if */ + } /* Close */ if(H5Dclose(srcdset[0]) < 0) @@ -1735,12 +2149,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1782,8 +2196,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1797,7 +2211,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1828,7 +2242,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1923,12 +2337,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1964,8 +2378,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1979,7 +2393,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read first source dataset through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2032,7 +2446,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2131,12 +2545,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2164,7 +2578,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i][j] = buf[2 * i][j]; for(/* j = 13 */; j < 26; j++) evbuf[i][j] = buf[2 * i + 1][j - 13]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2181,7 +2595,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i + 5][j] = buf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) evbuf[i + 5][j] = buf[2 * i + 1][j]; - } /* end for */ + } /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2196,8 +2610,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2211,7 +2625,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -2227,7 +2641,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i][j] = evbuf[2 * i][j]; for(/* j = 13 */; j < 26; j++) erbuf[i][j] = evbuf[2 * i + 1][j - 13]; - } /* end for */ + } /* Read second slice */ if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2239,7 +2653,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i + 5][j] = evbuf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) erbuf[i + 5][j] = evbuf[2 * i + 1][j]; - } /* end for */ + } /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2263,7 +2677,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j] = buf[i][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j - 13] = buf[i][j]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2280,7 +2694,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j + 13] = buf[i + 5][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j] = buf[i + 5][j]; - } /* end for */ + } /* Reopen srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2291,7 +2705,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ /* Reset rbuf */ @@ -2307,7 +2721,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j] = evbuf[i][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j - 13] = evbuf[i][j]; - } /* end for */ + } /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2319,7 +2733,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j + 13] = evbuf[i + 5][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j] = evbuf[i + 5][j]; - } /* end for */ + } /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2439,12 +2853,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2498,8 +2912,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2513,7 +2927,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -2538,7 +2952,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } /* end for */ + } /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2584,7 +2998,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source datasets */ /* Reset rbuf */ @@ -2605,7 +3019,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } /* end for */ + } /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) @@ -2780,12 +3194,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2822,8 +3236,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2837,7 +3251,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data through virtual dataset */ /* Reset rbuf */ @@ -2943,7 +3357,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 3) && (j < 6)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -2996,7 +3410,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 6) && (j < 9)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -3214,7 +3628,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read data directly from source dataset */ /* Select hyperslab in memory space */ @@ -3289,32 +3703,19 @@ test_basic_io(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { - if(srcfile[i] >= 0) - (void)H5Fclose(srcfile[i]); - } /* end for */ - if(vfile >= 0) - (void)H5Fclose(vfile); - if(vfile2 >= 0) - (void)H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + H5Fclose(vfile2); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(memspace); + H5Pclose(dcpl); } H5E_END_TRY; return 1; @@ -3327,14 +3728,7 @@ error: * Purpose: Tests VDS with unlimited selections * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Thursday, April 30, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -3447,12 +3841,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -3517,8 +3911,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3532,7 +3926,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -3577,11 +3971,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Test H5Pget_virtual_view() */ if(H5Pget_virtual_view(dapl, &virtual_view) < 0) @@ -3601,7 +3995,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -3649,11 +4043,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -3662,7 +4056,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[0] = 5; @@ -3699,8 +4093,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3714,7 +4108,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -3761,11 +4155,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -3779,7 +4173,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -3832,11 +4226,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -3845,7 +4239,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 5; @@ -3887,8 +4281,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3902,7 +4296,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -3964,7 +4358,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -4029,11 +4423,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Shrink to 15 */ dims[1] = 15; @@ -4060,12 +4454,12 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end if */ + } + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4079,7 +4473,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4127,11 +4521,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -4166,11 +4560,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try setting extent manually */ /* Grow to 18 */ @@ -4198,11 +4592,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Grow to 20 */ dims[1] = 20; @@ -4228,7 +4622,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < (int)mdims[1]; j++) if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -4241,12 +4635,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -4322,12 +4716,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -4392,8 +4786,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4407,7 +4801,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4451,11 +4845,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4469,7 +4863,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4511,11 +4905,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4524,7 +4918,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[1] = 7; @@ -4566,8 +4960,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4581,7 +4975,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4627,11 +5021,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -4645,7 +5039,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4696,11 +5090,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4709,7 +5103,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[1] = 10; @@ -4751,8 +5145,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4766,7 +5160,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4828,7 +5222,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -4845,7 +5239,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4897,11 +5291,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -4914,12 +5308,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -5014,12 +5408,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -5059,7 +5453,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][6 * j] = buf[i][2 * j]; erbuf[i][(6 * j) + 1] = buf[i][(2 * j) + 1]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5075,7 +5469,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][(6 * j) + 2] = buf[i][2 * j]; erbuf[i][(6 * j) + 3] = buf[i][(2 * j) + 1]; - } /* end for */ + } /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5096,7 +5490,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][4] = buf[i][0]; erbuf[i][5] = buf[i][1]; - } /* end for */ + } /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5114,8 +5508,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5129,7 +5523,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5173,11 +5567,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -5191,7 +5585,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5233,11 +5627,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5246,7 +5640,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[1] = 7; @@ -5283,8 +5677,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5298,7 +5692,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5343,11 +5737,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5361,7 +5755,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5371,7 +5765,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][12] = buf[i][0]; erbuf[i][13] = buf[i][1]; erbuf[i][18] = buf[i][2]; - } /* end for */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5415,11 +5809,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5428,7 +5822,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[2] */ dims[1] = 5; @@ -5460,7 +5854,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][10] = buf[i][0]; erbuf[i][11] = buf[i][1]; erbuf[i][16] = buf[i][2]; - } /* end for */ + } /* Close srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5472,8 +5866,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5487,7 +5881,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5532,11 +5926,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -5550,7 +5944,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5596,11 +5990,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5609,7 +6003,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[1] = 6; @@ -5640,7 +6034,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][14] = buf[i][0]; erbuf[i][15] = buf[i][1]; - } /* end for */ + } /* Close srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5652,8 +6046,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5667,7 +6061,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5711,11 +6105,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5729,7 +6123,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5771,11 +6165,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now just read middle 2 rows */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -5801,11 +6195,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != 0) TEST_ERROR @@ -5824,12 +6218,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -5910,12 +6304,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -5968,8 +6362,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5983,7 +6377,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6029,11 +6423,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -6047,7 +6441,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6089,11 +6483,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6102,7 +6496,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[0] */ dims[0] = 5; @@ -6140,8 +6534,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6155,7 +6549,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6201,11 +6595,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -6219,7 +6613,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6267,11 +6661,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -6284,12 +6678,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -6329,36 +6723,21 @@ test_unlim(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { - if(srcfile[i] >= 0) - (void)H5Fclose(srcfile[i]); - } /* end for */ - if(vfile >= 0) - (void)H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(filespace >= 0) - (void)H5Sclose(filespace); - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); - if(srcdcpl >= 0) - (void)H5Pclose(srcdcpl); - if(dapl >= 0) - (void)H5Pclose(dapl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(filespace); + H5Sclose(memspace); + H5Pclose(dcpl); + H5Pclose(srcdcpl); + H5Pclose(dapl); } H5E_END_TRY; return 1; @@ -6372,14 +6751,7 @@ error: * source dataset resolution * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Tuesday, May 26, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -6485,12 +6857,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -6502,7 +6874,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6516,7 +6888,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6602,8 +6974,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6617,7 +6989,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6661,11 +7033,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -6702,8 +7074,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6717,7 +7089,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6757,11 +7129,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try with different selections */ count[0] = 10; @@ -6788,12 +7160,12 @@ test_printf(unsigned config, hid_t fapl) if((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end for */ + } + } start[1] = 0; /* Now try writing through VDS */ @@ -6829,7 +7201,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Read srcdset[0] */ count[0] = 10; @@ -6931,12 +7303,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -6948,7 +7320,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6962,7 +7334,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7100,14 +7472,14 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7121,7 +7493,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7165,11 +7537,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Test H5Pget_virtual_printf_gap() */ if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) @@ -7189,7 +7561,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7241,11 +7613,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 2, reopen file as well if * config option specified */ @@ -7259,7 +7631,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7311,11 +7683,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 3, reopen file as well if * config option specified */ @@ -7329,7 +7701,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7381,11 +7753,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 4, reopen file as well if * config option specified */ @@ -7399,7 +7771,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7451,11 +7823,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -7469,7 +7841,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7515,11 +7887,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -7533,16 +7905,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -7615,7 +7987,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7681,7 +8053,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7695,7 +8067,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7739,11 +8111,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -7778,7 +8150,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7792,7 +8164,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7836,11 +8208,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -7856,7 +8228,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -7926,7 +8298,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7992,7 +8364,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8006,7 +8378,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8050,11 +8422,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -8089,7 +8461,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8103,7 +8475,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8147,11 +8519,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -8167,7 +8539,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8180,7 +8552,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - } /* end if */ + } /* @@ -8238,12 +8610,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -8255,7 +8627,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8269,7 +8641,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8355,8 +8727,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8370,7 +8742,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8414,11 +8786,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -8454,8 +8826,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8469,7 +8841,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8513,11 +8885,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -8531,7 +8903,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -8578,11 +8950,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -8618,8 +8990,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8633,7 +9005,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8677,11 +9049,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -8695,7 +9067,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -8742,11 +9114,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf_gap set to 1, reopen file as well if * config option specified */ @@ -8760,7 +9132,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -8807,11 +9179,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -8825,16 +9197,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8910,12 +9282,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -8927,7 +9299,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8941,7 +9313,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9037,8 +9409,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9052,7 +9424,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9096,11 +9468,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -9114,7 +9486,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9161,11 +9533,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9205,8 +9577,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9220,7 +9592,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9264,11 +9636,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -9282,7 +9654,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9328,11 +9700,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9369,8 +9741,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9384,7 +9756,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9428,11 +9800,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -9466,11 +9838,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try setting extent manually */ /* Shrink to 12 */ @@ -9496,11 +9868,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Shrink to 10 */ dims[1] = 12; @@ -9525,12 +9897,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end if */ + } + } /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -9544,7 +9916,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9590,11 +9962,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -9628,11 +10000,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Now try setting extent manually */ /* Grow to 12 */ @@ -9658,11 +10030,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Grow to 15 */ dims[1] = 15; @@ -9687,12 +10059,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ - } /* end if */ + } + } /* Reset dapl */ if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) @@ -9704,16 +10076,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -9770,12 +10142,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -9787,7 +10159,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9801,7 +10173,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9867,8 +10239,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9882,7 +10254,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9926,11 +10298,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Close VDS and reopen with printf gap set to 127, reopen file as well if * config option specified */ @@ -9944,7 +10316,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } /* end if */ + } if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9990,11 +10362,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -10008,12 +10380,12 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -10044,32 +10416,19 @@ test_printf(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { - if(srcfile[i] >= 0) - (void)H5Fclose(srcfile[i]); - } /* end for */ - if(vfile >= 0) - (void)H5Fclose(vfile); - if(srcspace >= 0) - (void)H5Sclose(srcspace); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(filespace >= 0) - (void)H5Sclose(filespace); - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); - if(dapl >= 0) - (void)H5Pclose(dapl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + H5Sclose(srcspace); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(filespace); + H5Sclose(memspace); + H5Pclose(dcpl); + H5Pclose(dapl); } H5E_END_TRY; return 1; @@ -10083,14 +10442,7 @@ error: * VDS * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: Neil Fortner - * Friday, August 14, 2015 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -10212,12 +10564,12 @@ test_all(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } /* end if */ + } else { srcfile = vfile; if(H5Iinc_ref(srcfile) < 0) TEST_ERROR - } /* end if */ + } /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -10229,7 +10581,7 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10243,7 +10595,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10314,14 +10666,14 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10335,7 +10687,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10381,11 +10733,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10394,7 +10746,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 2; @@ -10429,8 +10781,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10444,7 +10796,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10490,11 +10842,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -10534,8 +10886,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10549,7 +10901,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10595,11 +10947,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10608,7 +10960,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 3; @@ -10652,8 +11004,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10667,7 +11019,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10713,11 +11065,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -10757,8 +11109,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10772,7 +11124,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10818,11 +11170,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10831,7 +11183,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Extend srcdset[1] */ dims[0] = 7; @@ -10876,8 +11228,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10891,7 +11243,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10937,11 +11289,11 @@ test_all(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } /* end if */ + } else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } /* end for */ + } /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -10981,8 +11333,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ - } /* end if */ + } + } /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10996,7 +11348,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } /* end if */ + } /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11048,16 +11400,16 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } /* end for */ + } if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ + } else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } /* end if */ + } if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -11068,12 +11420,12 @@ test_all(unsigned config, hid_t fapl) if(H5Sclose(srcspace[i]) < 0) TEST_ERROR srcspace[i] = -1; - } /* end for */ + } for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } /* end for */ + } if(H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; @@ -11089,32 +11441,19 @@ test_all(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { - if(srcdset[i] >= 0) - (void)H5Dclose(srcdset[i]); - } /* end for */ - if(vdset >= 0) - (void)H5Dclose(vdset); - if(srcfile >= 0) - (void)H5Fclose(srcfile); - if(vfile >= 0) - (void)H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { - if(srcspace[i] >= 0) - (void)H5Sclose(srcspace[i]); - } /* end for */ - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { - if(vspace[i] >= 0) - (void)H5Sclose(vspace[i]); - } /* end for */ - if(filespace >= 0) - (void)H5Sclose(filespace); - if(memspace >= 0) - (void)H5Sclose(memspace); - if(dcpl >= 0) - (void)H5Pclose(dcpl); - if(srcdcpl >= 0) - (void)H5Pclose(srcdcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + H5Fclose(srcfile); + H5Fclose(vfile); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(filespace); + H5Sclose(memspace); + H5Pclose(dcpl); + H5Pclose(srcdcpl); } H5E_END_TRY; return 1; @@ -11128,10 +11467,6 @@ error: * * Return: Success: 0 * Failure: 1 - * - * Programmer: Dana Robinson - * March 2016 - * *------------------------------------------------------------------------- */ static int @@ -11273,10 +11608,6 @@ test_dapl_values(hid_t fapl_id) * Purpose: Tests datasets with virtual layout * * Return: EXIT_SUCCESS/EXIT_FAILURE - * - * Programmer: Neil Fortner - * Tuesday, February 17, 2015 - * *------------------------------------------------------------------------- */ int @@ -11299,10 +11630,11 @@ main(void) for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, fapl); + nerrors += test_vds_prefix(bit_config, fapl); nerrors += test_unlim(bit_config, fapl); nerrors += test_printf(bit_config, fapl); nerrors += test_all(bit_config, fapl); - } /* end for */ + } nerrors += test_dapl_values(fapl); diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 3addecf..368471c 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -72,6 +72,14 @@ f-3.h5 vds-eiger.h5 ) + set (HDF5_REFERENCE_PREFIX_VDS + 1_vds.h5 + 2_vds.h5 + 4_vds.h5 + 5_vds.h5 + vds-percival-unlim-maxmin.h5 + vds-eiger.h5 + ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -80,12 +88,21 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () + foreach (vds_h5_file ${HDF5_REFERENCE_PREFIX_VDS}) + get_filename_component(fname "${vds_h5_file}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") + endforeach () foreach (ddl_vds ${HDF5_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") endforeach () + foreach (ddl_vds ${HDF5_REFERENCE_VDS}) + get_filename_component(fname "${ddl_vds}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5dump_vds_files") + endforeach () + foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS}) get_filename_component(fname "${ddl_vds}" NAME) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files") @@ -134,6 +151,44 @@ endif () endmacro () + macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + if (NOT "${resultcode}" STREQUAL "0") + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_vds_test}" STREQUAL "") + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) + endif () + else () + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP_PREFIX-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5DUMP_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + add_test ( + NAME H5DUMP_PREFIX-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/testfiles/vds/" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS H5DUMP_PREFIX-${resultfile}-clear-objects) + endif () + endmacro () + macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) @@ -261,3 +316,15 @@ 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 () + + # Data read with prefix + if (USE_FILTER_DEFLATE) + ADD_H5_VDS_PREFIX_TEST (tvds-1 0 --enable-error-stack 1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-2 0 --enable-error-stack 2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_PREFIX_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) + ADD_H5_VDS_PREFIX_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_PREFIX_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) + endif () + diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 5df61bb..f25bd98 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -61,6 +61,17 @@ get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5ls_vds_files") endforeach () + + foreach (listfiles ${LIST_HDF5_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") + endforeach () + + foreach (listfiles ${LIST_OTHER_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5LS_SOURCE_DIR}/vds_prefix/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/prefix/${fname}" "h5ls_vds_files") + endforeach () + add_custom_target(h5ls_vds_files ALL COMMENT "Copying files needed by h5ls_vds tests" DEPENDS ${h5ls_vds_files_list}) ############################################################################## @@ -104,6 +115,43 @@ endif () endmacro () + macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + if ("${resultcode}" STREQUAL "1") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else () + add_test ( + NAME H5LS_PREFIX-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + add_test ( + NAME H5LS_PREFIX-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=vds/prefix/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=vds/prefix/${resultfile}.ls" + -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE=\${ORIGIN}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS H5LS_PREFIX-${resultfile}-clear-objects) + endif () + endmacro () + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -155,3 +203,10 @@ ADD_H5_VDS_TEST (tvds-4 0 -w80 -v -S 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 -w80 -v -S 5_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-1 0 -w80 -v -S vds/prefix/1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-2 0 -w80 -v -S vds/prefix/2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-3_1 0 -w80 -v -S vds/prefix/3_1_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-3_2 0 -w80 -v -S vds/prefix/3_2_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-4 0 -w80 -v -S vds/prefix/4_vds.h5) + ADD_H5_VDS_PREFIX_TEST (tvds-5 0 -w80 -v -S vds/prefix/5_vds.h5) + diff --git a/tools/test/h5ls/vds_prefix/tvds-1.ls b/tools/test/h5ls/vds_prefix/tvds-1.ls new file mode 100644 index 0000000..2830d1a --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-1.ls @@ -0,0 +1,14 @@ +Opened "vds/prefix/1_vds.h5" with sec2 driver. +vds_dset Dataset {5/Inf, 18/18, 8/8} + Location: 1:800 + Links: 1 + Maps: {6} Source { + 1_a.h5 /source_dset + 1_b.h5 /source_dset + 1_c.h5 /source_dset + 1_d.h5 /source_dset + 1_e.h5 /source_dset + 1_f.h5 /source_dset + } + Storage: 2880 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-2.ls b/tools/test/h5ls/vds_prefix/tvds-2.ls new file mode 100644 index 0000000..5c6f9d3 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-2.ls @@ -0,0 +1,13 @@ +Opened "vds/prefix/2_vds.h5" with sec2 driver. +vds_dset Dataset {6/Inf, 8/8, 14/14} + Location: 1:800 + Links: 1 + Maps: {5} Source { + 2_a.h5 /source_dset + 2_b.h5 /source_dset + 2_c.h5 /source_dset + 2_d.h5 /source_dset + 2_e.h5 /source_dset + } + Storage: 2688 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_1.ls b/tools/test/h5ls/vds_prefix/tvds-3_1.ls new file mode 100644 index 0000000..f4c8e78 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-3_1.ls @@ -0,0 +1,14 @@ +Opened "vds/prefix/3_1_vds.h5" with sec2 driver. +vds_dset Dataset {5/Inf, 25/25, 8/8} + Location: 1:800 + Links: 1 + Maps: {6} Source { + 1_a.h5 /source_dset + 1_b.h5 /source_dset + 1_c.h5 /source_dset + 1_d.h5 /source_dset + 1_e.h5 /source_dset + 1_f.h5 /source_dset + } + Storage: 4000 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-3_2.ls b/tools/test/h5ls/vds_prefix/tvds-3_2.ls new file mode 100644 index 0000000..5a7e2d8 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-3_2.ls @@ -0,0 +1,13 @@ +Opened "vds/prefix/3_2_vds.h5" with sec2 driver. +vds_dset Dataset {6/Inf, 13/13, 19/19} + Location: 1:800 + Links: 1 + Maps: {5} Source { + 2_a.h5 /source_dset + 2_b.h5 /source_dset + 2_c.h5 /source_dset + 2_d.h5 /source_dset + 2_e.h5 /source_dset + } + Storage: 5928 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-4.ls b/tools/test/h5ls/vds_prefix/tvds-4.ls new file mode 100644 index 0000000..c22d3a4 --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-4.ls @@ -0,0 +1,9 @@ +Opened "vds/prefix/4_vds.h5" with sec2 driver. +vds_dset Dataset {9/Inf, 4/4, 4/4} + Location: 1:800 + Links: 1 + Maps: {1} Source { + 4_%b.h5 /source_dset + } + Storage: 576 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer diff --git a/tools/test/h5ls/vds_prefix/tvds-5.ls b/tools/test/h5ls/vds_prefix/tvds-5.ls new file mode 100644 index 0000000..efba8dc --- /dev/null +++ b/tools/test/h5ls/vds_prefix/tvds-5.ls @@ -0,0 +1,11 @@ +Opened "vds/prefix/5_vds.h5" with sec2 driver. +vds_dset Dataset {9/Inf, 4/4, 4/4} + Location: 1:800 + Links: 1 + Maps: {3} Source { + 5_a.h5 /source_dset + 5_b.h5 /source_dset + 5_c.h5 /source_dset + } + Storage: 576 logical bytes, 0 allocated bytes + Type: 32-bit little-endian integer -- cgit v0.12 From f5f2c36d98a6bfeb41363e38f1a34036264d1036 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 29 Dec 2017 09:05:30 -0600 Subject: HDFFV-9724 prefix of 0 length should be null value --- src/H5Dvirtual.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 8d861c9..24623e4 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -898,7 +898,7 @@ H5D__virtual_open_file(hid_t plist_id, const H5F_t *vdset_file, H5E_BEGIN_TRY { size = H5Pget_virtual_prefix(plist_id, NULL, 0); } H5E_END_TRY; - if(size < 0) + if(size <= 0) my_prefix = NULL; else { /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ -- cgit v0.12 From 6d3f7dea8683053cad86c04ac800ecf78361590f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 29 Dec 2017 11:53:11 -0600 Subject: Fix memory leak due to addition of FORMAT check loop --- test/filter_plugin.c | 204 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 126 insertions(+), 78 deletions(-) diff --git a/test/filter_plugin.c b/test/filter_plugin.c index 8b7e0e4..9897c84 100644 --- a/test/filter_plugin.c +++ b/test/filter_plugin.c @@ -134,7 +134,7 @@ allocate_and_init_2D_array(int ***arr, const hsize_t *sizes, int **initial_value return SUCCEED; error: free_2D_array(arr); - + return FAIL; } /* end allocate_and_init_2D_array() */ @@ -165,7 +165,7 @@ compare_2D_arrays(int **dset1, int **dset2, const hsize_t *sizes, /*OUT*/ hbool_ } return SUCCEED; - + } /* end compare_2D_arrays() */ @@ -612,7 +612,7 @@ test_read_data(hid_t did, int *origin_data) free_2D_array(&check); PASSED(); - + return SUCCEED; error: @@ -943,14 +943,14 @@ error: * paths. * * Return: SUCCEED/FAIL - * + * *------------------------------------------------------------------------- */ static herr_t test_path_api_calls(void) { unsigned int n_starting_paths; - unsigned int u; + unsigned int u; unsigned int n_paths; herr_t ret; ssize_t path_len = -1; @@ -1319,7 +1319,7 @@ error: * Purpose: Turns the chunk cache off * * Return: SUCCEED/FAIL - * + * *------------------------------------------------------------------------- */ static herr_t @@ -1360,37 +1360,36 @@ main(void) unsigned new_format; int nerrors = 0; - /* Testing setup */ - h5_reset(); - /*******************************************************************/ /* ENSURE THAT WRITING TO DATASETS AND CREATING GROUPS WORKS */ /*******************************************************************/ + /* Test with old & new format groups */ + for (new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl_id; - /* Get a VFD-dependent filename */ - if ((old_ff_fapl_id = h5_fileaccess()) < 0) - TEST_ERROR; - - /* Turn off the chunk cache, so all the chunks are immediately written to disk */ - if (disable_chunk_cache(old_ff_fapl_id) < 0) - TEST_ERROR; + /* Testing setup */ + h5_reset(); - /* Copy the file access property list and set the latest file format on it */ - if ((new_ff_fapl_id = H5Pcopy(old_ff_fapl_id)) < 0) - TEST_ERROR; - if (H5Pset_libver_bounds(new_ff_fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - TEST_ERROR; + /* Get a VFD-dependent filename */ + if ((old_ff_fapl_id = h5_fileaccess()) < 0) + TEST_ERROR; - /* Fix up the filename for the VFD */ - h5_fixname(FILENAME[0], old_ff_fapl_id, filename, sizeof(filename)); + /* Turn off the chunk cache, so all the chunks are immediately written to disk */ + if (disable_chunk_cache(old_ff_fapl_id) < 0) + TEST_ERROR; - /* Test with old & new format groups */ - for (new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl_id; + /* Fix up the filename for the VFD */ + h5_fixname(FILENAME[0], old_ff_fapl_id, filename, sizeof(filename)); /* Set the FAPL for the type of format */ if (new_format) { HDputs("\nTesting with new file format:"); + /* Copy the file access property list and set the latest file format on it */ + if ((new_ff_fapl_id = H5Pcopy(old_ff_fapl_id)) < 0) + TEST_ERROR; + if (H5Pset_libver_bounds(new_ff_fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + my_fapl_id = new_ff_fapl_id; } else { @@ -1410,61 +1409,121 @@ main(void) if (H5Fclose(fid) < 0) TEST_ERROR; - } /* end for */ - /* Close FAPLs */ - if (H5Pclose(old_ff_fapl_id) < 0) - TEST_ERROR; - if (H5Pclose(new_ff_fapl_id) < 0) - TEST_ERROR; + /* Close FAPLs */ + if (H5Pclose(old_ff_fapl_id) < 0) + TEST_ERROR; + if (new_format) { + if (H5Pclose(new_ff_fapl_id) < 0) + TEST_ERROR; + } - /* Restore the default error handler (set in h5_reset()) */ - h5_restore_err(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); - /*******************************************************************/ - /* ENSURE THAT READING FROM DATASETS AND OPENING GROUPS WORKS */ - /*******************************************************************/ + /*******************************************************************/ + /* ENSURE THAT READING FROM DATASETS AND OPENING GROUPS WORKS */ + /*******************************************************************/ - HDputs("\nTesting reading data with with dynamic plugin filters:"); + HDputs("\nTesting reading data with with dynamic plugin filters:"); - /* Close the library so that all loaded plugin libraries are unloaded */ - h5_reset(); - if ((old_ff_fapl_id = h5_fileaccess()) < 0) - TEST_ERROR; + /* Close the library so that all loaded plugin libraries are unloaded */ + h5_reset(); + if ((old_ff_fapl_id = h5_fileaccess()) < 0) + TEST_ERROR; - /* Reopen the file for testing data reading */ - if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, old_ff_fapl_id)) < 0) - TEST_ERROR; + /* Set the FAPL for the type of format */ + if (new_format) { + /* Copy the file access property list and set the latest file format on it */ + if ((new_ff_fapl_id = H5Pcopy(old_ff_fapl_id)) < 0) + TEST_ERROR; + if (H5Pset_libver_bounds(new_ff_fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; - /* Read the data with filters */ - nerrors += (test_dataset_read_with_filters(fid) < 0 ? 1 : 0); + my_fapl_id = new_ff_fapl_id; + } + else + my_fapl_id = old_ff_fapl_id; - /* Test creating groups using dynamically-loaded plugin filters */ - nerrors += (test_opening_groups_using_plugins(fid) < 0 ? 1 : 0); + /* Reopen the file for testing data reading */ + if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, my_fapl_id)) < 0) + TEST_ERROR; - /* Restore the default error handler (set in h5_reset()) */ - h5_restore_err(); + /* Read the data with filters */ + nerrors += (test_dataset_read_with_filters(fid) < 0 ? 1 : 0); - /*******************************************************************/ - /* ENSURE THAT DISABLING FILTER PLUGINS VIA THE FILTER FLAGS WORKS */ - /*******************************************************************/ + /* Test creating groups using dynamically-loaded plugin filters */ + nerrors += (test_opening_groups_using_plugins(fid) < 0 ? 1 : 0); - /* Close the library so that all loaded plugin libraries are unloaded */ - h5_reset(); - if ((old_ff_fapl_id = h5_fileaccess()) < 0) - TEST_ERROR; + /* Close FAPLs */ + if (H5Pclose(old_ff_fapl_id) < 0) + TEST_ERROR; + if (new_format) { + if (H5Pclose(new_ff_fapl_id) < 0) + TEST_ERROR; + } - /* Reopen the file for testing data reading */ - if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, old_ff_fapl_id)) < 0) - TEST_ERROR; + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); - /* When filters are disabled, make sure we can't read data from a - * dataset that requires a filter plugin. - */ - nerrors += (test_no_read_when_plugins_disabled(fid) < 0 ? 1 : 0); + /*******************************************************************/ + /* ENSURE THAT DISABLING FILTER PLUGINS VIA THE FILTER FLAGS WORKS */ + /*******************************************************************/ - if (H5Fclose(fid) < 0) - TEST_ERROR; + /* Close the library so that all loaded plugin libraries are unloaded */ + h5_reset(); + if ((old_ff_fapl_id = h5_fileaccess()) < 0) + TEST_ERROR; + + /* Set the FAPL for the type of format */ + if (new_format) { + /* Copy the file access property list and set the latest file format on it */ + if ((new_ff_fapl_id = H5Pcopy(old_ff_fapl_id)) < 0) + TEST_ERROR; + if (H5Pset_libver_bounds(new_ff_fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + my_fapl_id = new_ff_fapl_id; + } + else + my_fapl_id = old_ff_fapl_id; + + /* Reopen the file for testing data reading */ + if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, my_fapl_id)) < 0) + TEST_ERROR; + + /* When filters are disabled, make sure we can't read data from a + * dataset that requires a filter plugin. + */ + nerrors += (test_no_read_when_plugins_disabled(fid) < 0 ? 1 : 0); + + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /*********************/ + /* CLEAN UP */ + /*********************/ + /* Close FAPLs */ + if (new_format) { + if (H5Pclose(new_ff_fapl_id) < 0) + TEST_ERROR; + } + else { + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + + if (H5Pclose(old_ff_fapl_id) < 0) + TEST_ERROR; + } + + /* Free up saved arrays */ + free_2D_array(&orig_deflate_g); + free_2D_array(&orig_dynlib1_g); + free_2D_array(&orig_dynlib2_g); + free_2D_array(&orig_dynlib4_g); + } /* end for */ + + h5_cleanup(FILENAME, old_ff_fapl_id); /************************************/ /* TEST THE FILTER PLUGIN API CALLS */ @@ -1473,21 +1532,10 @@ main(void) /* Test the APIs for access to the filter plugin path table */ nerrors += (test_path_api_calls() < 0 ? 1 : 0); - /*********************/ - /* CLEAN UP AND EXIT */ - /*********************/ - - /* Free up saved arrays */ - free_2D_array(&orig_deflate_g); - free_2D_array(&orig_dynlib1_g); - free_2D_array(&orig_dynlib2_g); - free_2D_array(&orig_dynlib4_g); - if (nerrors) TEST_ERROR; HDprintf("All plugin tests passed.\n"); - h5_cleanup(FILENAME, old_ff_fapl_id); HDexit(EXIT_SUCCESS); -- cgit v0.12 From 9a477bef3a55718fbc886a70576f90c8329f7f12 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 29 Dec 2017 13:13:30 -0600 Subject: HDFFV-9724 add valgrind ENV --- tools/test/h5dump/CMakeTestsVDS.cmake | 5 ++++- tools/test/h5ls/CMakeTestsVDS.cmake | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 368471c..922e79e 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -155,7 +155,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) - set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES + ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" + ) if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index f25bd98..00e7d28 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -119,7 +119,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") + set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES + ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" + ) if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () -- cgit v0.12 From fa1ae9f312aad7fa51e01961ce255a4ce08539e0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 29 Dec 2017 13:42:16 -0600 Subject: HDFFV-9724 init var to null --- src/H5Dvirtual.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 24623e4..306fe62 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -812,7 +812,7 @@ H5D__virtual_open_file(hid_t plist_id, const H5F_t *vdset_file, H5F_t *src_file = NULL; /* Source file */ H5F_t *ret_value = NULL; /* Actual return value */ char *full_name = NULL; /* File name with prefix */ - char *my_prefix; /* Library's copy of the prefix */ + char *my_prefix = NULL; /* Library's copy of the prefix */ unsigned intent; /* File access permissions */ char *actual_file_name = NULL; /* Virtual file's actual name */ char *temp_file_name = NULL; /* Temporary pointer to file name */ -- cgit v0.12 From 17b8f0bb936633f01bf6deba247e37bcadbc6b82 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 2 Jan 2018 09:39:09 -0600 Subject: Fix valgrind issues --- config/cmake/CTestCustom.cmake | 81 ++++++++++++++++++++++++++++++++++++- tools/test/h5ls/CMakeTestsVDS.cmake | 2 +- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 7aff076..33e6d4c 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -45,11 +45,13 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5TEST-clear-objects H5TEST-clear-cache-objects H5TEST-clear-cache_api-objects + H5TEST-clear-cache_image-objects H5TEST-clear-cache_tagging-objects - H5TEST-clear-ttsafe-objects H5TEST-clear-err_compat-objects H5TEST-clear-error_test-objects + H5TEST-clear-filenotclosed-objects H5TEST-clear-links_env-objects + H5TEST-clear-ttsafe-objects PERFORM_h5perform-clear-objects HL_TOOLS-clear-objects HL_test-clear-objects @@ -58,6 +60,18 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE CPP_testhdf5-clear-objects ######### tools/h5clear ######### H5CLEAR-clearall-objects + H5CLEAR-copy_h5clear_log_v3.h5 + H5CLEAR-copy_h5clear_mdc_image.h5 + H5CLEAR-copy_h5clear_sec2_v0.h5 + H5CLEAR-copy_h5clear_sec2_v2.h5 + H5CLEAR-copy_h5clear_sec2_v3.h5 + H5CLEAR-copy_latest_h5clear_log_v3.h5 + H5CLEAR-copy_latest_h5clear_sec2_v3.h5 + H5CLEAR-copy_mod_h5clear_mdc_image.h5 + H5CLEAR-copy_mod_h5clr_mdc_image2.h5 + H5CLEAR-copy_orig_h5clear_sec2_v0.h5 + H5CLEAR-copy_orig_h5clear_sec2_v2.h5 + H5CLEAR-copy_orig_h5clear_sec2_v3.h5 H5CLEAR-h5clear_gentest # does not close ids by design ######### tools/h5copy ######### H5COPY-clearall-objects @@ -209,6 +223,68 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5LS_VDS-clearall-objects ######### tools/h5repack ######### H5REPACK-clearall-objects + H5REPACK-add_alignment-clear-objects + H5REPACK-add_userblock-clear-objects + H5REPACK-all_filters-clear-objects + H5REPACK-attr-clear-objects + H5REPACK-committed_dt-clear-objects + H5REPACK-deflate_convert-clear-objects + H5REPACK-deflate_copy-clear-objects + H5REPACK-deflate_file-clear-objects + H5REPACK-deflate_remove-clear-objects + H5REPACK-early-clear-objects + H5REPACK-error4-clear-objects + H5REPACK-family-clear-objects + H5REPACK-fill-clear-objects + H5REPACK-fletcher_all-clear-objects + H5REPACK-fletcher_copy-clear-objects + H5REPACK-fletcher_individual-clear-objects + H5REPACK-fletcher_remove-clear-objects + H5REPACK-global_filters-clear-objects + H5REPACK-gt_mallocsize-clear-objects + H5REPACK-gzip_all-clear-objects + H5REPACK-gzip_individual-clear-objects + H5REPACK-hlink-clear-objects + H5REPACK-layout-clear-objects + H5REPACK-native_attr-clear-objects + H5REPACK-native_fill-clear-objects + H5REPACK-nbit_add-clear-objects + H5REPACK-nbit_copy-clear-objects + H5REPACK-nbit_remove-clear-objects + H5REPACK-nested_8bit_enum-clear-objects + H5REPACK-objs-clear-objects + H5REPACK-remove_all-clear-objects + H5REPACK-scale_add-clear-objects + H5REPACK-scale_copy-clear-objects + H5REPACK-scale_remove-clear-objects + H5REPACK-shuffle_all-clear-objects + H5REPACK-shuffle_copy-clear-objects + H5REPACK-shuffle_individual-clear-objects + H5REPACK-shuffle_remove-clear-objects + H5REPACK-szip_all-clear-objects + H5REPACK-szip_convert-clear-objects + H5REPACK-szip_copy-clear-objects + H5REPACK-szip_individual-clear-objects + H5REPACK-szip_remove-clear-objects + H5REPACK-upgrade_layout-clear-objects + H5REPACK_DMP-crtorder-clear-objects + H5REPACK_DMP-deflate_limit-clear-objects + H5REPACK-bug1814-clear-objects + H5REPACK-HDFFV-5932-clear-objects + H5REPACK-HDFFV-7840-clear-objects + H5REPACK_META-meta_long_N-clear-objects + H5REPACK_META-meta_short_N-clear-objects + H5REPACK_OLD-old_style_layout_short_switches-clear-objects + H5REPACK_STAT-GS_AGGR-clear-objects + H5REPACK_STAT-S_AGGR-clear-objects + H5REPACK_STAT-SP_NONE-clear-objects + H5REPACK_STAT-SP_PAGE-clear-objects + H5REPACK_STAT-SPT_FSM_AGGR-clear-objects + H5REPACK_STAT-STG_PAGE-clear-objects + ######### + H5REPACK_META-meta_long + H5REPACK_META-meta_short + ######### H5REPACK-gzip_verbose_filters #uses runTest.cmake H5REPACK_VERIFY_LAYOUT-dset2_chunk_20x10 #uses grepTest.cmake H5REPACK_VERIFY_LAYOUT_ALL-chunk_20x10 #uses grepTest.cmake @@ -236,6 +312,8 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE ######### tools/misc ######### H5REPART-clearall-objects H5MKGRP-clearall-objects + ######### tools/perform ######### + PERFORM_h5perform-clearall-objects ######### hl/tools/h5watch ######### H5WATCH-clearall-objects ######### examples ######### @@ -244,5 +322,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE CPP_ex_tutr-clear-objects HL_ex-clear-objects f90_ex-clear-objects + HL_CPP_ex_ptExampleFL-clear-objects HL_FORTRAN_f90_ex-clear-objects ) diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 00e7d28..2b6f61e 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -121,7 +121,7 @@ add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" - WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") -- cgit v0.12 From 5f4676f3c8f077b1667611b78d2cb19deec1f37a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 2 Jan 2018 14:39:32 -0600 Subject: HDFFV-8745 - fix implementation of 8625 --- MANIFEST | 2 +- tools/lib/h5diff_attr.c | 20 -------------------- tools/lib/h5diff_dset.c | 19 +++++++++++++++++++ tools/test/h5diff/CMakeTests.cmake | 12 +++++++----- tools/test/h5diff/testfiles/h5diff_8625.txt | 10 ++++++++++ tools/test/h5diff/testfiles/h5diff_tmp1.txt | 5 ----- tools/test/h5diff/testh5diff.sh.in | 8 ++++---- 7 files changed, 41 insertions(+), 35 deletions(-) create mode 100644 tools/test/h5diff/testfiles/h5diff_8625.txt delete mode 100644 tools/test/h5diff/testfiles/h5diff_tmp1.txt diff --git a/MANIFEST b/MANIFEST index c6c7b3c..45b6912 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2425,7 +2425,7 @@ ./tools/test/h5diff/testfiles/non_comparables2.h5 ./tools/test/h5diff/testfiles/tmptest2.he5 ./tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 -./tools/test/h5diff/testfiles/h5diff_tmp1.txt +./tools/test/h5diff/testfiles/h5diff_8625.txt ./tools/test/h5diff/testfiles/tmptest.he5 ./tools/test/h5diff/testfiles/h5diff_tmp2.txt ./tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6019738..4e4b40d 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -385,28 +385,8 @@ hsize_t diff_attr(hid_t loc1_id, /* get the datatypes */ if((ftype1_id = H5Aget_type(attr1_id)) < 0) HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); - vstrtype1 = H5Tis_variable_str(ftype1_id); if((ftype2_id = H5Aget_type(attr2_id)) < 0) HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); - vstrtype2 = H5Tis_variable_str(ftype2_id); - - /* no compare if either one but not both are variable string type */ - if (vstrtype1 != vstrtype2) { - if((opts->m_verbose || opts->m_list_not_cmp)) - parallel_print("Not comparable: one of attribute <%s/%s> or <%s/%s> is of variable length type\n", - path1, name1, path2, name2); - opts->not_cmp = 1; - if (H5Tclose(ftype1_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed"); - if (H5Tclose(ftype2_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed"); - if (H5Aclose(attr1_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed"); - if (H5Aclose(attr2_id) < 0) - HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed"); - - continue; - } if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed"); diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index ee42b99..55e9839 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -767,12 +767,31 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } } + if(tclass1 == H5T_STRING) { + hid_t vstrtype1 = -1; + hid_t vstrtype2 = -1; + h5difftrace("diff_can_type end - H5T_STRING\n"); + + vstrtype1 = H5Tis_variable_str(f_tid1); + vstrtype2 = H5Tis_variable_str(f_tid2); + + /* no compare if either one but not both are variable string type */ + if (vstrtype1 != vstrtype2) { + if((opts->m_verbose || opts->m_list_not_cmp)) + parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n", + obj1_name, obj2_name); + opts->not_cmp = 1; + HGOTO_DONE(0); + } + } + if(tclass1 == H5T_COMPOUND) { int nmembs1; int nmembs2; int j; hid_t memb_type1 = -1; hid_t memb_type2 = -1; + h5difftrace("diff_can_type end - H5T_COMPOUND\n"); nmembs1 = H5Tget_nmembers(f_tid1); nmembs2 = H5Tget_nmembers(f_tid2); diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index bbc39d8..773b03d 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -293,7 +293,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_800.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_tmp1.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_tmp2.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt @@ -1021,6 +1021,8 @@ h5diff_800.out.err h5diff_801.out h5diff_801.out.err + h5diff_8625.out + h5diff_8625.out.err h5diff_90.out h5diff_90.out.err h5diff_v1.out @@ -1281,9 +1283,7 @@ ADD_H5_TEST (h5diff_631 0 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp18 g1/f # 7. attributes # ############################################################################## ADD_H5_TEST (h5diff_70 1 -v ${FILE5} ${FILE6}) -# temporary test to verify HDF5-8625 -ADD_H5_TEST (h5diff_tmp1 0 tmptest2.he5 tmptest.he5) -# temporary test to verify HDF5-8639 +# temporary test to verify HDFFV-8639 ADD_H5_TEST (h5diff_tmp2 1 tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5) # ################################################## @@ -1613,7 +1613,9 @@ ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## -ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group /group_copy) +ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group /group_copy) +# test to verify HDFFV-8625 +ADD_H5_TEST (h5diff_8625 0 -v --enable-error-stack ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group/Compound_dset1 /group_copy/Compound_dset3) ADD_H5_TEST (h5diff_vlstr 0 -v tvlstr.h5 tvlstr2.h5) # ############################################################################## diff --git a/tools/test/h5diff/testfiles/h5diff_8625.txt b/tools/test/h5diff/testfiles/h5diff_8625.txt new file mode 100644 index 0000000..a7ddb86 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_8625.txt @@ -0,0 +1,10 @@ +dataset: and +Warning: different storage datatype +Warning: different storage datatype +Not comparable: or is of mixed string type +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. +EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_tmp1.txt b/tools/test/h5diff/testfiles/h5diff_tmp1.txt deleted file mode 100644 index 40e3fb6..0000000 --- a/tools/test/h5diff/testfiles/h5diff_tmp1.txt +++ /dev/null @@ -1,5 +0,0 @@ --------------------------------- -Some objects are not comparable --------------------------------- -Use -c for a list of objects. -EXIT CODE: 0 diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index df472d4..2f04ab2 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -337,7 +337,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_709.txt $SRC_H5DIFF_TESTFILES/h5diff_710.txt $SRC_H5DIFF_TESTFILES/h5diff_80.txt $SRC_H5DIFF_TESTFILES/h5diff_90.txt -$SRC_H5DIFF_TESTFILES/h5diff_tmp1.txt +$SRC_H5DIFF_TESTFILES/h5diff_8625.txt $SRC_H5DIFF_TESTFILES/h5diff_tmp2.txt $SRC_H5DIFF_TESTFILES/h5diff_v1.txt $SRC_H5DIFF_TESTFILES/h5diff_v2.txt @@ -820,9 +820,7 @@ TOOLTEST h5diff_631.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h # 7. attributes # ############################################################################## TOOLTEST h5diff_70.txt -v h5diff_attr1.h5 h5diff_attr2.h5 -# temporary test to verify HDF5-8625 -TOOLTEST h5diff_tmp1.txt tmptest2.he5 tmptest.he5 -# temporary test to verify HDF5-8639 +# temporary test to verify HDFFV-8639 TOOLTEST h5diff_tmp2.txt tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5 # ################################################## @@ -1145,6 +1143,8 @@ TOOLTEST h5diff_487.txt -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5 # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## TOOLTEST h5diff_530.txt -v h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group /group_copy +# test to verify HDFFV-8625 +TOOLTEST h5diff_8625.txt -v --enable-error-stack h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group/Compound_dset1 /group_copy/Compound_dset3 TOOLTEST h5diff_vlstr.txt -v tvlstr.h5 tvlstr2.h5 # ############################################################################## -- cgit v0.12 From ccf044135c675baa95e79a0623216c644ed6b657 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 2 Jan 2018 14:43:28 -0600 Subject: HDFFV-8745 remove obsolete files --- MANIFEST | 2 -- tools/test/h5diff/testfiles/tmptest.he5 | Bin 4740424 -> 0 bytes tools/test/h5diff/testfiles/tmptest2.he5 | Bin 4734280 -> 0 bytes 3 files changed, 2 deletions(-) delete mode 100644 tools/test/h5diff/testfiles/tmptest.he5 delete mode 100644 tools/test/h5diff/testfiles/tmptest2.he5 diff --git a/MANIFEST b/MANIFEST index 45b6912..3b729ff 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2423,10 +2423,8 @@ ./tools/test/h5diff/testfiles/compounds_array_vlen2.h5 ./tools/test/h5diff/testfiles/non_comparables1.h5 ./tools/test/h5diff/testfiles/non_comparables2.h5 -./tools/test/h5diff/testfiles/tmptest2.he5 ./tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 ./tools/test/h5diff/testfiles/h5diff_8625.txt -./tools/test/h5diff/testfiles/tmptest.he5 ./tools/test/h5diff/testfiles/h5diff_tmp2.txt ./tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 ./tools/test/h5diff/testfiles/tudfilter.h5 diff --git a/tools/test/h5diff/testfiles/tmptest.he5 b/tools/test/h5diff/testfiles/tmptest.he5 deleted file mode 100644 index edcfcd2..0000000 Binary files a/tools/test/h5diff/testfiles/tmptest.he5 and /dev/null differ diff --git a/tools/test/h5diff/testfiles/tmptest2.he5 b/tools/test/h5diff/testfiles/tmptest2.he5 deleted file mode 100644 index a6ab02b..0000000 Binary files a/tools/test/h5diff/testfiles/tmptest2.he5 and /dev/null differ -- cgit v0.12 From 0ec1e5eeeea9667c267a88814381de4242447da9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 2 Jan 2018 15:08:43 -0600 Subject: HDFFV-8745 remove files from test scripts --- tools/test/h5diff/CMakeTests.cmake | 2 -- tools/test/h5diff/testh5diff.sh.in | 2 -- 2 files changed, 4 deletions(-) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 773b03d..0a8d40f 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -63,8 +63,6 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables1.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmptest.he5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmptest2.he5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.reference.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.output.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5 diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index 2f04ab2..d9cb857 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -118,8 +118,6 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5 $SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5 $SRC_H5DIFF_TESTFILES/non_comparables1.h5 $SRC_H5DIFF_TESTFILES/non_comparables2.h5 -$SRC_H5DIFF_TESTFILES/tmptest.he5 -$SRC_H5DIFF_TESTFILES/tmptest2.he5 $SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.reference.h5 $SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.output.h5 $SRC_H5DIFF_TESTFILES/diff_strings1.h5 -- cgit v0.12 From f8e84c55092d71b491cf86292a981f6122c78cfa Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 2 Jan 2018 16:25:03 -0600 Subject: HDFFV-8745 cleanup vl resource usage --- tools/lib/h5diff_dset.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 55e9839..86aa543 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -192,7 +192,8 @@ hsize_t diff_datasetid(hid_t did1, hid_t sm_space = -1; /*stripmine data space */ size_t need; /* bytes needed for malloc */ int i; - unsigned int vl_data = 0; /*contains VL datatypes */ + unsigned int vl_data1 = 0; /*contains VL datatypes */ + unsigned int vl_data2 = 0; /*contains VL datatypes */ h5difftrace("diff_datasetid start\n"); /* Get the dataspace handle */ @@ -320,7 +321,9 @@ hsize_t diff_datasetid(hid_t did1, * VLEN memory buffer later */ if(TRUE == h5tools_detect_vlen(m_tid1)) - vl_data = TRUE; + vl_data1 = TRUE; + if(TRUE == h5tools_detect_vlen(m_tid2)) + vl_data2 = TRUE; h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", opts->err_stat); /*------------------------------------------------------------------------ @@ -411,11 +414,12 @@ hsize_t diff_datasetid(hid_t did1, h5diffdebug2("diff_array nfound:%d\n", nfound); /* reclaim any VL memory, if necessary */ - if(vl_data) { - h5difftrace("check vl_data\n"); + h5diffdebug2("check vl_data1:%d\n", vl_data1); + if(vl_data1) H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); + h5diffdebug2("check vl_data2:%d\n", vl_data2); + if(vl_data2) H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); - } /* end if */ if(buf1 != NULL) { HDfree(buf1); buf1 = NULL; @@ -505,10 +509,10 @@ hsize_t diff_datasetid(hid_t did1, dadims, opts, name1, name2, dam_tid, did1, did2); /* reclaim any VL memory, if necessary */ - if(vl_data) { + if(vl_data1) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); - H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); - } /* end if */ + if(vl_data2) + H5Dvlen_reclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2); /* calculate the next hyperslab offset */ for(i = rank1, carry = 1; i > 0 && carry; --i) { @@ -545,29 +549,29 @@ done: /* free */ if(buf1 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) + if(vl_data1) H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); HDfree(buf1); buf1 = NULL; } if(buf2 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) + if(vl_data2) H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); HDfree(buf2); buf2 = NULL; } if(sm_buf1 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) + if(vl_data1) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); HDfree(sm_buf1); sm_buf1 = NULL; } if(sm_buf2 != NULL) { /* reclaim any VL memory, if necessary */ - if(vl_data) - H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); + if(vl_data2) + H5Dvlen_reclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2); HDfree(sm_buf2); sm_buf2 = NULL; } @@ -576,6 +580,7 @@ done: H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); + H5Sclose(sm_space); H5Tclose(f_tid1); H5Tclose(f_tid2); H5Tclose(m_tid1); -- cgit v0.12 From 7d13e53294dc5e5161da49bc2654ecb1fbe207b8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Jan 2018 10:09:03 -0600 Subject: HDFFV-9745 Create test and files to verify fixes --- MANIFEST | 5 +- tools/test/h5diff/CMakeTests.cmake | 11 +- tools/test/h5diff/h5diffgentest.c | 6776 +++++++++++++++------------ tools/test/h5diff/testfiles/h5diff_8639.txt | 72 + tools/test/h5diff/testfiles/h5diff_attr1.h5 | Bin 26000 -> 27480 bytes tools/test/h5diff/testfiles/h5diff_attr2.h5 | Bin 26000 -> 27480 bytes tools/test/h5diff/testfiles/h5diff_attr3.h5 | Bin 0 -> 27440 bytes tools/test/h5diff/testfiles/h5diff_tmp2.txt | 13 - tools/test/h5diff/testh5diff.sh.in | 9 +- 9 files changed, 3748 insertions(+), 3138 deletions(-) create mode 100644 tools/test/h5diff/testfiles/h5diff_8639.txt create mode 100644 tools/test/h5diff/testfiles/h5diff_attr3.h5 delete mode 100644 tools/test/h5diff/testfiles/h5diff_tmp2.txt diff --git a/MANIFEST b/MANIFEST index 3b729ff..2db6d6b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2382,6 +2382,7 @@ ./tools/test/h5diff/testfiles/h5diff_attr1.h5 ./tools/test/h5diff/testfiles/h5diff_attr2.h5 +./tools/test/h5diff/testfiles/h5diff_attr3.h5 ./tools/test/h5diff/testfiles/h5diff_attr_v_level1.h5 ./tools/test/h5diff/testfiles/h5diff_attr_v_level2.h5 ./tools/test/h5diff/testfiles/h5diff_basic1.h5 @@ -2423,10 +2424,8 @@ ./tools/test/h5diff/testfiles/compounds_array_vlen2.h5 ./tools/test/h5diff/testfiles/non_comparables1.h5 ./tools/test/h5diff/testfiles/non_comparables2.h5 -./tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 ./tools/test/h5diff/testfiles/h5diff_8625.txt -./tools/test/h5diff/testfiles/h5diff_tmp2.txt -./tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 +./tools/test/h5diff/testfiles/h5diff_8639.txt ./tools/test/h5diff/testfiles/tudfilter.h5 ./tools/test/h5diff/testfiles/tudfilter2.h5 ./tools/test/h5diff/testfiles/h5diff_ud.txt diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 0a8d40f..e06f069 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -26,6 +26,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dtypes.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr2.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr3.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset1.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset3.h5 @@ -63,8 +64,6 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables1.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.reference.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tmpSingleSiteBethe.output.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings1.h5 @@ -292,7 +291,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_tmp2.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v1.txt @@ -1021,6 +1020,8 @@ h5diff_801.out.err h5diff_8625.out h5diff_8625.out.err + h5diff_8639.out + h5diff_8639.out.err h5diff_90.out h5diff_90.out.err h5diff_v1.out @@ -1281,8 +1282,6 @@ ADD_H5_TEST (h5diff_631 0 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp18 g1/f # 7. attributes # ############################################################################## ADD_H5_TEST (h5diff_70 1 -v ${FILE5} ${FILE6}) -# temporary test to verify HDFFV-8639 -ADD_H5_TEST (h5diff_tmp2 1 tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5) # ################################################## # attrs with verbose option level @@ -1614,6 +1613,8 @@ ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group /group_copy) # test to verify HDFFV-8625 ADD_H5_TEST (h5diff_8625 0 -v --enable-error-stack ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group/Compound_dset1 /group_copy/Compound_dset3) +# test to verify HDFFV-8639 +ADD_H5_TEST (h5diff_8639 0 -v h5diff_attr3.h5 h5diff_attr2.h5 /g1) ADD_H5_TEST (h5diff_vlstr 0 -v tvlstr.h5 tvlstr2.h5) # ############################################################################## diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 459a37e..2e98436 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -1,15 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* 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 * + * 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 COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include @@ -29,16 +29,16 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); /*------------------------------------------------------------------------- -* Program: h5diffgentest -* -* Purpose: generate files for h5diff testing -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: November 12, 2003 -* -*------------------------------------------------------------------------- -*/ + * Program: h5diffgentest + * + * Purpose: generate files for h5diff testing + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 12, 2003 + * + *------------------------------------------------------------------------- + */ #define FILE1 "h5diff_basic1.h5" #define FILE2 "h5diff_basic2.h5" @@ -46,6 +46,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define FILE4 "h5diff_dtypes.h5" #define FILE5 "h5diff_attr1.h5" #define FILE6 "h5diff_attr2.h5" +#define FILE6a "h5diff_attr3.h5" #define FILE7 "h5diff_dset1.h5" #define FILE8 "h5diff_dset2.h5" #define FILE8A "h5diff_dset3.h5" @@ -110,37 +111,36 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM2 0 /* A UD link traversal function. Shouldn't actually be called. */ -static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, - H5_ATTR_UNUSED const void * udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id) -{ +static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, + H5_ATTR_UNUSED hid_t cur_group, H5_ATTR_UNUSED const void * udata, + H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id) { return -1; } -const H5L_class_t UD_link_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)MY_LINKCLASS, /* Link type id number */ - "UD link class", /* name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ -}}; - +const H5L_class_t UD_link_class[1] = { { + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t) MY_LINKCLASS, /* Link type id number */ + "UD link class", /* name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ +} }; /*------------------------------------------------------------------------- -* prototypes -*------------------------------------------------------------------------- -*/ + * prototypes + *------------------------------------------------------------------------- + */ /* tests called in main() */ static int test_basic(const char *fname1, const char *fname2, const char *fname3); static int test_types(const char *fname); static int test_datatypes(const char *fname); -static int test_attributes(const char *fname,int make_diffs); -static int test_datasets(const char *fname,int make_diffs); -static int test_special_datasets(const char *fname,int make_diffs); -static int test_hyperslab(const char *fname,int make_diffs); +static int test_attributes(const char *fname, int make_diffs); +static int test_datasets(const char *fname, int make_diffs); +static int test_special_datasets(const char *fname, int make_diffs); +static int test_hyperslab(const char *fname, int make_diffs); static int test_link_name(const char *fname1); static int test_soft_links(const char *fname1); static int test_linked_softlinks(const char *fname1); @@ -155,54 +155,60 @@ static int test_exclude_obj3(const char *fname1, const char *fname2); static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new); static int test_attributes_verbose_level(const char *fname1, const char *fname2); static int test_enums(const char *fname); -static void test_comps_array (const char *fname, const char *dset, const char *attr,int diff, int is_file_new); -static void test_comps_vlen (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); -static void test_comps_array_vlen (const char *fname, const char *dset, const char *attr, int diff, int is_file_new); -static void test_comps_vlen_arry (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); -static void test_data_nocomparables (const char *fname, int diff); -static void test_objs_nocomparables (const char *fname1, const char *fname2); -static void test_objs_strings (const char *fname, const char *fname2); +static void test_comps_array(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_comps_vlen(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_comps_array_vlen(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_comps_vlen_arry(const char *fname, const char *dset, + const char *attr, int diff, int is_file_new); +static void test_data_nocomparables(const char *fname, int diff); +static void test_objs_nocomparables(const char *fname1, const char *fname2); +static void test_objs_strings(const char *fname, const char *fname2); /* called by test_attributes() and test_datasets() */ -static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); -static void write_dset_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); -static void gen_datareg(hid_t fid,int make_diffs); +static void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); +static void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); +static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); +static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ -static int write_attr(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf); -static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf); +static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static int gen_dataset_idx(const char *file, int format); - /*------------------------------------------------------------------------- -* Function: main -* -* Purpose: main program -* -*------------------------------------------------------------------------- -*/ + * Function: main + * + * Purpose: main program + * + *------------------------------------------------------------------------- + */ int main(void) { test_basic(FILE1, FILE2, FILE11); - test_types (FILE3); + test_types(FILE3); test_datatypes(FILE4); /* generate 2 files, the second call creates a similar file with differences */ - test_attributes(FILE5,0); - test_attributes(FILE6,1); + test_attributes(FILE5, 0); + test_attributes(FILE6, 1); + /* generate file with string datatypes swapped */ + test_attributes(FILE6a, 2); /* test attributes with verbose level */ test_attributes_verbose_level(ATTR_VERBOSE_LEVEL_FILE1, ATTR_VERBOSE_LEVEL_FILE2); /* generate 2 files, the second call creates a similar file with differences */ - test_datasets(FILE7,0); - test_datasets(FILE8,1); - test_datasets(FILE8A,2); + test_datasets(FILE7, 0); + test_datasets(FILE8, 1); + test_datasets(FILE8A, 2); /* generate 2 files, the second call creates a similar file with differences */ - test_hyperslab(FILE9,0); - test_hyperslab(FILE10,1); + test_hyperslab(FILE9, 0); + test_hyperslab(FILE10, 1); test_link_name(FILE12); @@ -215,15 +221,15 @@ int main(void) test_ext2soft_links(FILE17, FILE18); /* generate 2 files, the second call creates a similar file with differences */ - test_special_datasets(FILE19,0); - test_special_datasets(FILE20,1); + test_special_datasets(FILE19, 0); + test_special_datasets(FILE20, 1); /* - * Generate 2 files: FILE21 with old format; FILE22 with new format - * Create 2 datasets in each file: - * One dataset: chunked layout, w/o filters, fixed dimension - * One dataset: chunked layout, w/ filters, fixed dimension - */ + * Generate 2 files: FILE21 with old format; FILE22 with new format + * Create 2 datasets in each file: + * One dataset: chunked layout, w/o filters, fixed dimension + * One dataset: chunked layout, w/ filters, fixed dimension + */ gen_dataset_idx(FILE21, 0); gen_dataset_idx(FILE22, 1); @@ -241,34 +247,34 @@ int main(void) test_comp_vlen_strings(COMP_VL_STRS_FILE, "group_copy", 0); /* diff when invalid enum values are present. - * This will probably grow to involve more extensive testing of - * enums so it has been given its own test file and test (apart - * from the basic type testing). - */ + * This will probably grow to involve more extensive testing of + * enums so it has been given its own test file and test (apart + * from the basic type testing). + */ test_enums(ENUM_INVALID_VALUES); /* ------------------------------------------------- - * Create test files with dataset and attribute with container types - * (array, vlen) with multiple nested compound types. - */ + * Create test files with dataset and attribute with container types + * (array, vlen) with multiple nested compound types. + */ /* file1 */ - test_comps_array(COMPS_COMPLEX1,"dset1", "attr1", 0, 1); - test_comps_vlen(COMPS_COMPLEX1,"dset2", "attr2", 0, 0); - test_comps_array_vlen(COMPS_COMPLEX1,"dset3", "attr3", 0, 0); - test_comps_vlen_arry(COMPS_COMPLEX1,"dset4", "attr4", 0, 0); + test_comps_array(COMPS_COMPLEX1, "dset1", "attr1", 0, 1); + test_comps_vlen(COMPS_COMPLEX1, "dset2", "attr2", 0, 0); + test_comps_array_vlen(COMPS_COMPLEX1, "dset3", "attr3", 0, 0); + test_comps_vlen_arry(COMPS_COMPLEX1, "dset4", "attr4", 0, 0); /* file2 */ - test_comps_array(COMPS_COMPLEX2,"dset1", "attr1", 5, 1); - test_comps_vlen(COMPS_COMPLEX2,"dset2", "attr2",5, 0); - test_comps_array_vlen(COMPS_COMPLEX2,"dset3", "attr3", 5, 0); - test_comps_vlen_arry(COMPS_COMPLEX2,"dset4", "attr4", 5, 0); + test_comps_array(COMPS_COMPLEX2, "dset1", "attr1", 5, 1); + test_comps_vlen(COMPS_COMPLEX2, "dset2", "attr2", 5, 0); + test_comps_array_vlen(COMPS_COMPLEX2, "dset3", "attr3", 5, 0); + test_comps_vlen_arry(COMPS_COMPLEX2, "dset4", "attr4", 5, 0); /*------------------------------------------------- - * Create test files with non-comparable dataset and attributes with - * comparable datasets and attributes. All the comparables should display - * differences. - */ - test_data_nocomparables(NON_COMPARBLES1,0); - test_data_nocomparables(NON_COMPARBLES2,5); + * Create test files with non-comparable dataset and attributes with + * comparable datasets and attributes. All the comparables should display + * differences. + */ + test_data_nocomparables(NON_COMPARBLES1, 0); + test_data_nocomparables(NON_COMPARBLES2, 5); /* common objects (same name) with different object types. HDFFV-7644 */ test_objs_nocomparables(NON_COMPARBLES1, NON_COMPARBLES2); @@ -280,28 +286,28 @@ int main(void) } /*------------------------------------------------------------------------- -* Function: test_basic -* -* Purpose: Create basic test files, first two contains different data, the -* third one is just an empty file. -* -*------------------------------------------------------------------------- -*/ + * Function: test_basic + * + * Purpose: Create basic test files, first two contains different data, the + * third one is just an empty file. + * + *------------------------------------------------------------------------- + */ static int test_basic(const char *fname1, const char *fname2, const char *fname3) { - hid_t fid1, fid2; - hid_t gid1, gid2, gid3; + hid_t fid1 = -1, fid2 = -1; + hid_t gid1 = -1, gid2 = -1, gid3 = -1; hsize_t dims1[1] = { 6 }; - hsize_t dims2[2] = { 3,2 }; + hsize_t dims2[2] = { 3, 2 }; /* create the empty file */ - if ((fid1=H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0){ + if ((fid1 = H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "empty file (%s) creation failed.\n", fname3); goto out; } - if (H5Fclose(fid1) < 0){ + if (H5Fclose(fid1) < 0) { fprintf(stderr, "empty file (%s) close failed.\n", fname3); goto out; } @@ -311,9 +317,9 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ - if (( fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) + if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if (( fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) + if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; /*------------------------------------------------------------------------- @@ -336,16 +342,20 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) */ { - double data1[3][2] = {{ 1.0F, 1.0F}, { 1.00F, 1.000F}, { 0.0F, 0.0F}}; - double data2[3][2] = {{ 0.0F, 1.1F}, { 1.01F, 1.001F}, { 0.0F, 1.0F}}; - double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}}; - double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, { 80.0F, 40.0F}}; + double data1[3][2] = + { { 1.0F, 1.0F }, { 1.00F, 1.000F }, { 0.0F, 0.0F } }; + double data2[3][2] = + { { 0.0F, 1.1F }, { 1.01F, 1.001F }, { 0.0F, 1.0F } }; + double data3[3][2] = { { 100.0F, 100.0F }, { 100.00F, 100.000F }, { + 100.0F, 100.0F } }; + double data4[3][2] = { { 105.0F, 120.0F }, { 160.00F, 95.000F }, { + 80.0F, 40.0F } }; - write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1); - write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2); - write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_DOUBLE,data3); - write_dset(gid2,2,dims2,"dset4",H5T_NATIVE_DOUBLE,data4); - write_dset(gid2,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data2); + write_dset(gid1, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data1); + write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_DOUBLE, data2); + write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_DOUBLE, data3); + write_dset(gid2, 2, dims2, "dset4", H5T_NATIVE_DOUBLE, data4); + write_dset(gid2, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data2); } /*------------------------------------------------------------------------- @@ -354,11 +364,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - int data5[3][2] = {{100,100},{100,0},{0,100}}; - int data6[3][2] = {{120,80}, {0,100},{0,50}}; + int data5[3][2] = { { 100, 100 }, { 100, 0 }, { 0, 100 } }; + int data6[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } }; - write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5); - write_dset(gid1,2,dims2,"dset6",H5T_NATIVE_INT,data6); + write_dset(gid1, 2, dims2, "dset5", H5T_NATIVE_INT, data5); + write_dset(gid1, 2, dims2, "dset6", H5T_NATIVE_INT, data6); } @@ -368,11 +378,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - unsigned long long data7[3][2] = {{100,100},{100,0},{0,100}}; - unsigned long long data8[3][2] = {{120,80}, {0,100},{0,50}}; + unsigned long long data7[3][2] = + { { 100, 100 }, { 100, 0 }, { 0, 100 } }; + unsigned long long data8[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } }; - write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7); - write_dset(gid1,2,dims2,"dset8",H5T_NATIVE_ULLONG,data8); + write_dset(gid1, 2, dims2, "dset7", H5T_NATIVE_ULLONG, data7); + write_dset(gid1, 2, dims2, "dset8", H5T_NATIVE_ULLONG, data8); } @@ -390,45 +401,47 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}}; - double data10[3][2] ={{120.0F, 80.0F}, { 0.0F, 100.0F}, {0.0F, 50.0F}}; + double data9[3][2] = { { 100.0F, 100.0F }, { 100.0F, 0.0F }, { 0.0F, + 100.0F } }; + double data10[3][2] = { { 120.0F, 80.0F }, { 0.0F, 100.0F }, { 0.0F, + 50.0F } }; - write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9); - write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10); + write_dset(gid1, 2, dims2, "dset9", H5T_NATIVE_DOUBLE, data9); + write_dset(gid1, 2, dims2, "dset10", H5T_NATIVE_DOUBLE, data10); } - /*------------------------------------------------------------------------- * test floating point comparison *------------------------------------------------------------------------- */ { /* epsilon = 0.0000001 = 1e-7 - * system epsilon for float : FLT_EPSILON = 1.19209E-07 - */ - float data11[3][2] ={{0.000000f,0.0000001f},{0.0000001f, 0.00000022f},{0.0000001f,0.0000001f}}; - float data12[3][2] ={{0.000000f,0.0000002f},{0.0000003f,0.0000001f},{0.000000f,0.0000001f}}; + * system epsilon for float : FLT_EPSILON = 1.19209E-07 + */ + float data11[3][2] = { { 0.000000f, 0.0000001f }, { 0.0000001f, + 0.00000022f }, { 0.0000001f, 0.0000001f } }; + float data12[3][2] = { { 0.000000f, 0.0000002f }, { 0.0000003f, + 0.0000001f }, { 0.000000f, 0.0000001f } }; /* epsilon = 0.0000000000000001 = 1e-16 - * system epsilon for double : DBL_EPSILON = 2.22045E-16 - */ - double data13[3][2] ={ - {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000001)}, - {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.0000000000000000)}, - {H5_DOUBLE(0.00000000000000033), H5_DOUBLE(0.0000000000000001)}}; - double data14[3][2] ={ - {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000004)}, - {H5_DOUBLE(0.0000000000000002), H5_DOUBLE(0.0000000000000001)}, - {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.00000000000000000)}}; + * system epsilon for double : DBL_EPSILON = 2.22045E-16 + */ + double data13[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE( + 0.0000000000000001) }, { H5_DOUBLE(0.0000000000000001), + H5_DOUBLE(0.0000000000000000) }, { H5_DOUBLE( + 0.00000000000000033), H5_DOUBLE(0.0000000000000001) } }; + double data14[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE( + 0.0000000000000004) }, { H5_DOUBLE(0.0000000000000002), + H5_DOUBLE(0.0000000000000001) }, { H5_DOUBLE( + 0.0000000000000001), H5_DOUBLE(0.00000000000000000) } }; - write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11); - write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12); - write_dset(gid1,2,dims2,"d1",H5T_NATIVE_DOUBLE,data13); - write_dset(gid1,2,dims2,"d2",H5T_NATIVE_DOUBLE,data14); + write_dset(gid1, 2, dims2, "fp1", H5T_NATIVE_FLOAT, data11); + write_dset(gid1, 2, dims2, "fp2", H5T_NATIVE_FLOAT, data12); + write_dset(gid1, 2, dims2, "d1", H5T_NATIVE_DOUBLE, data13); + write_dset(gid1, 2, dims2, "d2", H5T_NATIVE_DOUBLE, data14); } - #if H5_SIZEOF_LONG_DOUBLE !=0 { @@ -437,15 +450,13 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ - long double data15[3][2] ={{1.0L,1.0L},{1.0L,1.0L},{1.0L,1.0L}}; + long double data15[3][2] = { {1.0L,1.0L}, {1.0L,1.0L}, {1.0L,1.0L}}; write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15); } #endif - - /*------------------------------------------------------------------------- * NaNs in H5T_NATIVE_FLOAT *------------------------------------------------------------------------- @@ -455,22 +466,22 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) float data15[6]; float data16[6]; - data15[0] = (float)HDsqrt(-1.0F); + data15[0] = (float) HDsqrt(-1.0F); data15[1] = 1.0F; - data15[2] = (float)HDsqrt(-1.0F); + data15[2] = (float) HDsqrt(-1.0F); data15[3] = 1.0F; data15[4] = 1.0F; data15[5] = 1.0F; - data16[0] = (float)HDsqrt(-1.0F); - data16[1] = (float)HDsqrt(-1.0F); + data16[0] = (float) HDsqrt(-1.0F); + data16[1] = (float) HDsqrt(-1.0F); data16[2] = 1.0F; data16[3] = 1.0F; data16[4] = 1.0F; data16[5] = 1.0F; - write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15); - write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16); + write_dset(gid1, 1, dims1, "fp15", H5T_NATIVE_FLOAT, data15); + write_dset(gid1, 1, dims1, "fp16", H5T_NATIVE_FLOAT, data16); } @@ -497,29 +508,29 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) data18[4] = 1.0F; data18[5] = 1.0F; - write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17); - write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18); - write_dset(gid1,1,dims1,"fp18_COPY",H5T_NATIVE_DOUBLE,data18); + write_dset(gid1, 1, dims1, "fp17", H5T_NATIVE_DOUBLE, data17); + write_dset(gid1, 1, dims1, "fp18", H5T_NATIVE_DOUBLE, data18); + write_dset(gid1, 1, dims1, "fp18_COPY", H5T_NATIVE_DOUBLE, data18); } /*------------------------------------------------------------------------ - * INFINITY values - *------------------------------------------------------------------------ - */ + * INFINITY values + *------------------------------------------------------------------------ + */ { - float data19[6]; + float data19[6]; double data20[6]; - data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F); - data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F); + data19[0] = data19[1] = data19[2] = (float) HDlog(0.0F); + data19[3] = data19[4] = data19[5] = (float) -HDlog(0.0F); data20[0] = data20[1] = data20[2] = HDlog(0.0F); data20[3] = data20[4] = data20[5] = -HDlog(0.0F); - write_dset(gid1,1,dims1,"fp19",H5T_NATIVE_FLOAT,data19); - write_dset(gid1,1,dims1,"fp19_COPY",H5T_NATIVE_FLOAT,data19); - write_dset(gid1,1,dims1,"fp20",H5T_NATIVE_DOUBLE,data20); - write_dset(gid1,1,dims1,"fp20_COPY",H5T_NATIVE_DOUBLE,data20); + write_dset(gid1, 1, dims1, "fp19", H5T_NATIVE_FLOAT, data19); + write_dset(gid1, 1, dims1, "fp19_COPY", H5T_NATIVE_FLOAT, data19); + write_dset(gid1, 1, dims1, "fp20", H5T_NATIVE_DOUBLE, data20); + write_dset(gid1, 1, dims1, "fp20_COPY", H5T_NATIVE_DOUBLE, data20); } /*------------------------------------------------------------------------- @@ -527,105 +538,97 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) *------------------------------------------------------------------------- */ { - typedef struct cmp1_t - { + typedef struct cmp1_t { double d; - float f; + float f; } cmp1_t; - cmp1_t buf1[2]; - cmp1_t buf2[2]; - hsize_t dims[1] = {2}; - size_t type_size; - hid_t tid; + cmp1_t buf1[2]; + cmp1_t buf2[2]; + hsize_t dims[1] = { 2 }; + size_t type_size; + hid_t tid; buf1[0].d = HDsqrt(-1.0F); - buf1[0].f = (float)HDsqrt(-1.0F); + buf1[0].f = (float) HDsqrt(-1.0F); buf2[0].d = HDsqrt(-1.0F); - buf2[0].f = (float)HDsqrt(-1.0F); + buf2[0].f = (float) HDsqrt(-1.0F); buf1[1].d = HDsqrt(-1.0F); - buf1[1].f = (float)HDsqrt(-1.0F); + buf1[1].f = (float) HDsqrt(-1.0F); buf2[1].d = 0.0F; buf2[1].f = 0.0F; - type_size = sizeof( cmp1_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE ); - H5Tinsert(tid, "f", HOFFSET( cmp1_t, f ), H5T_NATIVE_FLOAT ); - write_dset(gid1,1,dims,"dset11",tid,buf1); - write_dset(gid1,1,dims,"dset12",tid,buf2); + type_size = sizeof(cmp1_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE); + H5Tinsert(tid, "f", HOFFSET(cmp1_t, f), H5T_NATIVE_FLOAT); + write_dset(gid1, 1, dims, "dset11", tid, buf1); + write_dset(gid1, 1, dims, "dset12", tid, buf2); H5Tclose(tid); - } /* not comparable objects */ { - typedef struct cmp1_t - { + typedef struct cmp1_t { double d; - int i; + int i; } cmp1_t; - typedef struct cmp2_t - { - int i; + typedef struct cmp2_t { + int i; double d; } cmp2_t; - typedef struct cmp3_t - { + typedef struct cmp3_t { int i; } cmp3_t; - double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; - int data3[6] = {0,0,0,0,0,0}; - int data4[3][2] = {{0,0},{0,0},{0,0}}; - int data5[2][2] = {{0,0},{0,0}}; - unsigned int data6[3][2] = {{0,0},{0,0},{0,0}}; - cmp1_t data7[1] = {{1.0f, 2}}; - cmp2_t data8[1] = {{1, 2.0f}}; - hsize_t dims3[2] = {2, 2}; - hsize_t dims4[1] = {1}; - size_t type_size; - hid_t tid; - - - - write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL); - write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2); - write_dset(gid3,1,dims1,"dset3",H5T_NATIVE_INT,data3); - write_dset(gid3,2,dims2,"dset4",H5T_NATIVE_INT,data4); - write_dset(gid3,2,dims3,"dset5",H5T_NATIVE_INT,data5); - write_dset(gid3,2,dims2,"dset6",H5T_NATIVE_UINT,data6); + double data2[6] = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; + int data3[6] = { 0, 0, 0, 0, 0, 0 }; + int data4[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; + int data5[2][2] = { { 0, 0 }, { 0, 0 } }; + unsigned int data6[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; + cmp1_t data7[1] = { { 1.0f, 2 } }; + cmp2_t data8[1] = { { 1, 2.0f } }; + hsize_t dims3[2] = { 2, 2 }; + hsize_t dims4[1] = { 1 }; + size_t type_size; + hid_t tid; + + write_dset(gid3, 1, dims1, "dset1", H5T_NATIVE_DOUBLE, NULL); + write_dset(gid3, 1, dims1, "dset2", H5T_NATIVE_DOUBLE, data2); + write_dset(gid3, 1, dims1, "dset3", H5T_NATIVE_INT, data3); + write_dset(gid3, 2, dims2, "dset4", H5T_NATIVE_INT, data4); + write_dset(gid3, 2, dims3, "dset5", H5T_NATIVE_INT, data5); + write_dset(gid3, 2, dims2, "dset6", H5T_NATIVE_UINT, data6); /* case of compound with different type members */ - type_size = sizeof( cmp1_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE ); - H5Tinsert(tid, "i", HOFFSET( cmp1_t, i ), H5T_NATIVE_INT ); - write_dset(gid3,1,dims4,"dset7",tid,data7); + type_size = sizeof(cmp1_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE); + H5Tinsert(tid, "i", HOFFSET(cmp1_t, i), H5T_NATIVE_INT); + write_dset(gid3, 1, dims4, "dset7", tid, data7); H5Tclose(tid); - type_size = sizeof( cmp2_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT ); - H5Tinsert(tid, "d", HOFFSET( cmp2_t, d ), H5T_NATIVE_DOUBLE ); - write_dset(gid3,1,dims4,"dset8",tid,data8); + type_size = sizeof(cmp2_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT); + H5Tinsert(tid, "d", HOFFSET(cmp2_t, d), H5T_NATIVE_DOUBLE); + write_dset(gid3, 1, dims4, "dset8", tid, data8); H5Tclose(tid); /* case of compound with different number of members */ - type_size = sizeof( cmp3_t ); - tid = H5Tcreate (H5T_COMPOUND, type_size ); - H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT ); - write_dset(gid3,1,dims4,"dset9",tid,NULL); + type_size = sizeof(cmp3_t); + tid = H5Tcreate(H5T_COMPOUND, type_size); + H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT); + write_dset(gid3, 1, dims4, "dset9", tid, NULL); H5Tclose(tid); } - /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -642,46 +645,43 @@ out: return FAIL; } - /*------------------------------------------------------------------------- -* Function: test_types -* -* Purpose: Compare different HDF5 object & link types: -* H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK, H5G_UDLINK -* -*------------------------------------------------------------------------- -*/ + * Function: test_types + * + * Purpose: Compare different HDF5 object & link types: + * H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK, H5G_UDLINK + * + *------------------------------------------------------------------------- + */ static int test_types(const char *fname) { - hid_t fid1; - hid_t gid1; - hid_t gid2; - hid_t tid1; - hid_t tid2; - herr_t status; - hsize_t dims[1]={1}; - typedef struct s1_t - { - int a; - float b; + hid_t fid1 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t tid1 = -1; + hid_t tid2 = -1; + herr_t status; + hsize_t dims[1] = { 1 }; + typedef struct s1_t { + int a; + float b; } s1_t; - typedef struct s2_t - { - int a; + typedef struct s2_t { + int a; } s2_t; /*------------------------------------------------------------------------- * Create one file *------------------------------------------------------------------------- */ - fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ - write_dset(fid1,1,dims,"dset",H5T_NATIVE_INT,0); + write_dset(fid1, 1, dims, "dset", H5T_NATIVE_INT, 0); /*------------------------------------------------------------------------- * H5G_GROUP @@ -723,7 +723,7 @@ int test_types(const char *fname) */ H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); H5Lregister(UD_link_class); - H5Lcreate_ud(fid1, "ud_link", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(fid1, "ud_link", (H5L_type_t) MY_LINKCLASS, NULL, (size_t) 0, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * Close @@ -733,195 +733,192 @@ int test_types(const char *fname) return status; } - /* -# ############################################################################## -# # not comparable types -# ############################################################################## + # ############################################################################## + # # not comparable types + # ############################################################################## -# 2.0 -TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset g1 + # 2.0 + TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset g1 -# 2.1 -TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset l1 + # 2.1 + TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset l1 -# 2.2 -TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset t1 + # 2.2 + TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset t1 -# ############################################################################## -# # compare groups, types, links (no differences and differences) -# ############################################################################## + # ############################################################################## + # # compare groups, types, links (no differences and differences) + # ############################################################################## -# 2.3 -TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1 + # 2.3 + TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1 -# 2.4 -TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1 + # 2.4 + TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1 -# 2.5 -TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1 + # 2.5 + TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1 -# 2.6 -TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2 + # 2.6 + TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2 -# 2.7 -TOOLTEST h5diff_27.txt file3.h5 file3.h5 -v t1 t2 + # 2.7 + TOOLTEST h5diff_27.txt file3.h5 file3.h5 -v t1 t2 -# 2.8 -TOOLTEST h5diff_28.txt file3.h5 file3.h5 -v l1 l2 -*/ + # 2.8 + TOOLTEST h5diff_28.txt file3.h5 file3.h5 -v l1 l2 + */ /*------------------------------------------------------------------------- -* Function: test_datatypes -* -* Purpose: test dataset datatypes -* -*------------------------------------------------------------------------- -*/ + * Function: test_datatypes + * + * Purpose: test dataset datatypes + * + *------------------------------------------------------------------------- + */ static int test_datatypes(const char *fname) { - - hid_t fid1; - hid_t dset; - hsize_t dims[2]={3,2}; - herr_t status; - char buf1a[3][2] = {{1,1},{1,1},{1,1}}; - char buf1b[3][2] = {{1,1},{3,4},{5,6}}; - short buf2a[3][2] = {{1,1},{1,1},{1,1}}; - short buf2b[3][2] = {{1,1},{3,4},{5,6}}; - int buf3a[3][2] = {{1,1},{1,1},{1,1}}; - int buf3b[3][2] = {{1,1},{3,4},{5,6}}; - long buf4a[3][2] = {{1,1},{1,1},{1,1}}; - long buf4b[3][2] = {{1,1},{3,4},{5,6}}; - float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; - float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; - double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}}; - double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; + hid_t fid1 = -1; + hid_t dset = -1; + hsize_t dims[2] = { 3, 2 }; + herr_t status; + char buf1a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + char buf1b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + short buf2a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + short buf2b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + int buf3a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + int buf3b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + long buf4a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + long buf4b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + float buf5a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } }; + float buf5b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; + double buf6a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } }; + double buf6b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /*unsigned/signed test signed char -128 to 127 unsigned char 0 to 255 */ - char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}}; - unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}}; + char buf7a[3][2] = { { -1, -128 }, { -1, -1 }, { -1, -1 } }; + unsigned char buf7b[3][2] = { { 1, 128 }, { 1, 1 }, { 1, 1 } }; /* long long test */ - long long buf8a[3][2] = {{1,1},{1,1},{1,1}}; - long long buf8b[3][2] = {{1,1},{3,4},{5,6}}; - unsigned long long buf9a[3][2] = {{1,1},{1,1},{1,1}}; - unsigned long long buf9b[3][2] = {{1,1},{3,4},{5,6}}; + long long buf8a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + long long buf8b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + unsigned long long buf9a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; + unsigned long long buf9b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; - unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}}; - unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}}; - - unsigned short buf11a[3][2] = {{204,205},{2,3},{1,1}}; - unsigned int buf11b[3][2] = {{204,205},{2,3},{1,1}}; + unsigned int buf10a[3][2] = { { UIMAX, 1 }, { 1, 1 }, { 1, 1 } }; + unsigned int buf10b[3][2] = { { UIMAX - 1, 1 }, { 3, 4 }, { 5, 6 } }; + unsigned short buf11a[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } }; + unsigned int buf11b[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } }; /*------------------------------------------------------------------------- * Create a file *------------------------------------------------------------------------- */ - fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * Check for different storage order. Give a warning if they are different *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset0a",H5T_STD_I16LE,buf2a); - write_dset(fid1,2,dims,"dset0b",H5T_STD_I32LE,buf3b); + write_dset(fid1, 2, dims, "dset0a", H5T_STD_I16LE, buf2a); + write_dset(fid1, 2, dims, "dset0b", H5T_STD_I32LE, buf3b); /*------------------------------------------------------------------------- * H5T_NATIVE_CHAR *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset1a",H5T_NATIVE_CHAR,buf1a); - write_dset(fid1,2,dims,"dset1b",H5T_NATIVE_CHAR,buf1b); + write_dset(fid1, 2, dims, "dset1a", H5T_NATIVE_CHAR, buf1a); + write_dset(fid1, 2, dims, "dset1b", H5T_NATIVE_CHAR, buf1b); /*------------------------------------------------------------------------- * H5T_NATIVE_SHORT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset2a",H5T_NATIVE_SHORT,buf2a); - write_dset(fid1,2,dims,"dset2b",H5T_NATIVE_SHORT,buf2b); + write_dset(fid1, 2, dims, "dset2a", H5T_NATIVE_SHORT, buf2a); + write_dset(fid1, 2, dims, "dset2b", H5T_NATIVE_SHORT, buf2b); /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset3a",H5T_NATIVE_INT,buf3a); - write_dset(fid1,2,dims,"dset3b",H5T_NATIVE_INT,buf3b); + write_dset(fid1, 2, dims, "dset3a", H5T_NATIVE_INT, buf3a); + write_dset(fid1, 2, dims, "dset3b", H5T_NATIVE_INT, buf3b); /*------------------------------------------------------------------------- * H5T_NATIVE_LONG *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset4a",H5T_NATIVE_LONG,buf4a); - write_dset(fid1,2,dims,"dset4b",H5T_NATIVE_LONG,buf4b); + write_dset(fid1, 2, dims, "dset4a", H5T_NATIVE_LONG, buf4a); + write_dset(fid1, 2, dims, "dset4b", H5T_NATIVE_LONG, buf4b); /*------------------------------------------------------------------------- * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset5a",H5T_NATIVE_FLOAT,buf5a); - write_dset(fid1,2,dims,"dset5b",H5T_NATIVE_FLOAT,buf5b); + write_dset(fid1, 2, dims, "dset5a", H5T_NATIVE_FLOAT, buf5a); + write_dset(fid1, 2, dims, "dset5b", H5T_NATIVE_FLOAT, buf5b); /*------------------------------------------------------------------------- * H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset6a",H5T_NATIVE_DOUBLE,buf6a); - write_dset(fid1,2,dims,"dset6b",H5T_NATIVE_DOUBLE,buf6b); + write_dset(fid1, 2, dims, "dset6a", H5T_NATIVE_DOUBLE, buf6a); + write_dset(fid1, 2, dims, "dset6b", H5T_NATIVE_DOUBLE, buf6b); /*------------------------------------------------------------------------- * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset7a",H5T_NATIVE_CHAR,buf7a); - write_dset(fid1,2,dims,"dset7b",H5T_NATIVE_UCHAR,buf7b); + write_dset(fid1, 2, dims, "dset7a", H5T_NATIVE_CHAR, buf7a); + write_dset(fid1, 2, dims, "dset7b", H5T_NATIVE_UCHAR, buf7b); /*------------------------------------------------------------------------- * H5T_NATIVE_LLONG *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset8a",H5T_NATIVE_LLONG,buf8a); - write_dset(fid1,2,dims,"dset8b",H5T_NATIVE_LLONG,buf8b); + write_dset(fid1, 2, dims, "dset8a", H5T_NATIVE_LLONG, buf8a); + write_dset(fid1, 2, dims, "dset8b", H5T_NATIVE_LLONG, buf8b); /*------------------------------------------------------------------------- * H5T_NATIVE_ULLONG *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset9a",H5T_NATIVE_ULLONG,buf9a); - write_dset(fid1,2,dims,"dset9b",H5T_NATIVE_ULLONG,buf9b); + write_dset(fid1, 2, dims, "dset9a", H5T_NATIVE_ULLONG, buf9a); + write_dset(fid1, 2, dims, "dset9b", H5T_NATIVE_ULLONG, buf9b); /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a); - write_dset(fid1,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b); + write_dset(fid1, 2, dims, "dset10a", H5T_NATIVE_UINT, buf10a); + write_dset(fid1, 2, dims, "dset10b", H5T_NATIVE_UINT, buf10b); /*------------------------------------------------------------------------- * Same type class, different size *------------------------------------------------------------------------- */ - write_dset(fid1,2,dims,"dset11a",H5T_STD_U16LE,buf11a); - dset=H5Dopen2 (fid1, "dset11a", H5P_DEFAULT); - write_attr(dset,2,dims,"attr",H5T_STD_U16LE,buf11a); - H5Dclose (dset); + write_dset(fid1, 2, dims, "dset11a", H5T_STD_U16LE, buf11a); + dset = H5Dopen2(fid1, "dset11a", H5P_DEFAULT); + write_attr(dset, 2, dims, "attr", H5T_STD_U16LE, buf11a); + H5Dclose(dset); - write_dset(fid1,2,dims,"dset11b",H5T_STD_U32LE,buf11b); - dset=H5Dopen2 (fid1, "dset11b", H5P_DEFAULT); - write_attr(dset,2,dims,"attr",H5T_STD_U32LE,buf11b); - H5Dclose (dset); + write_dset(fid1, 2, dims, "dset11b", H5T_STD_U32LE, buf11b); + dset = H5Dopen2(fid1, "dset11b", H5P_DEFAULT); + write_attr(dset, 2, dims, "attr", H5T_STD_U32LE, buf11b); + H5Dclose(dset); /*------------------------------------------------------------------------- * Close @@ -932,59 +929,58 @@ int test_datatypes(const char *fname) } /* -# ############################################################################## -# # Dataset datatypes -# ############################################################################## + # ############################################################################## + # # Dataset datatypes + # ############################################################################## -# 5.0 -TOOLTEST h5diff_50.txt file4.h5 file4.h5 -v dset0a dset0b + # 5.0 + TOOLTEST h5diff_50.txt file4.h5 file4.h5 -v dset0a dset0b -# 5.1 -TOOLTEST h5diff_51.txt file4.h5 file4.h5 -v dset1a dset1b + # 5.1 + TOOLTEST h5diff_51.txt file4.h5 file4.h5 -v dset1a dset1b -# 5.2 -TOOLTEST h5diff_52.txt file4.h5 file4.h5 -v dset2a dset2b + # 5.2 + TOOLTEST h5diff_52.txt file4.h5 file4.h5 -v dset2a dset2b -# 5.3 -TOOLTEST h5diff_53.txt file4.h5 file4.h5 -v dset3a dset4b + # 5.3 + TOOLTEST h5diff_53.txt file4.h5 file4.h5 -v dset3a dset4b -# 5.4 -TOOLTEST h5diff_54.txt file4.h5 file4.h5 -v dset4a dset4b + # 5.4 + TOOLTEST h5diff_54.txt file4.h5 file4.h5 -v dset4a dset4b -# 5.5 -TOOLTEST h5diff_55.txt file4.h5 file4.h5 -v dset5a dset5b + # 5.5 + TOOLTEST h5diff_55.txt file4.h5 file4.h5 -v dset5a dset5b -# 5.6 -TOOLTEST h5diff_56.txt file4.h5 file4.h5 -v dset6a dset6b + # 5.6 + TOOLTEST h5diff_56.txt file4.h5 file4.h5 -v dset6a dset6b -# 5.7 -TOOLTEST h5diff_57.txt file4.h5 file4.h5 -v dset7a dset7b + # 5.7 + TOOLTEST h5diff_57.txt file4.h5 file4.h5 -v dset7a dset7b -# 5.8 (region reference) -TOOLTEST h5diff_58.txt file7.h5 file8.h5 -v refreg -*/ + # 5.8 (region reference) + TOOLTEST h5diff_58.txt file7.h5 file8.h5 -v refreg + */ /*------------------------------------------------------------------------- -* Function: test_attributes -* -* Purpose: test attributes -* -*------------------------------------------------------------------------- -*/ + * Function: test_attributes + * + * Purpose: test attributes + * + *------------------------------------------------------------------------- + */ static -int test_attributes(const char *file, - int make_diffs /* flag to modify data buffers */) +int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid; - hid_t did; - hid_t gid; - hid_t root_id; - hid_t sid; - hsize_t dims[1]={2}; - herr_t status; + hid_t fid = -1; + hid_t did = -1; + hid_t gid = -1; + hid_t root_id = -1; + hid_t sid = -1; + hsize_t dims[1] = { 2 }; + herr_t status; /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* Create a 1D dataset */ @@ -994,18 +990,23 @@ int test_attributes(const char *file, assert(status >= 0); /* Create groups */ - gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen2(fid, "/", H5P_DEFAULT); + gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + root_id = H5Gopen2(fid, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group, and root group *------------------------------------------------------------------------- */ - - write_attr_in(did,"dset",fid,make_diffs); - write_attr_in(gid,NULL,(hid_t)0,make_diffs); - write_attr_in(root_id,NULL,(hid_t)0,make_diffs); - + if (make_diffs > 1) { + write_attr_strings(did, "dset", fid, make_diffs); + write_attr_strings(gid, NULL, (hid_t) 0, make_diffs); + write_attr_strings(root_id, NULL, (hid_t) 0, make_diffs); + } + else { + write_attr_in(did, "dset", fid, make_diffs); + write_attr_in(gid, NULL, (hid_t) 0, make_diffs); + write_attr_in(root_id, NULL, (hid_t) 0, make_diffs); + } /* Close */ status = H5Dclose(did); @@ -1021,338 +1022,313 @@ int test_attributes(const char *file, return status; } - /*------------------------------------------------------------------------- -* Function: test_attributes_verbose_level -* -* Purpose: Cresting test files for testing attributes along with -* levels of verbos option -* -*------------------------------------------------------------------------- -*/ + * Function: test_attributes_verbose_level + * + * Purpose: Cresting test files for testing attributes along with + * levels of verbos option + * + *------------------------------------------------------------------------- + */ static int test_attributes_verbose_level(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; - hid_t fid1 = -1, fid2 = -1; - hid_t f1_gid = -1, f2_gid = -1; - hid_t f1_gid2 = -1, f2_gid2 = -1; - hid_t f1_gid3 = -1, f2_gid3 = -1; - hid_t f1_gid4 = -1, f2_gid4 = -1; - hid_t f1_did = -1, f2_did = -1; - hid_t f1_sid = -1, f2_sid = -1; - hid_t f1_tid = -1, f2_tid = -1; + herr_t status = SUCCEED; + hid_t fid1 = -1, fid2 = -1; + hid_t f1_gid = -1, f2_gid = -1; + hid_t f1_gid2 = -1, f2_gid2 = -1; + hid_t f1_gid3 = -1, f2_gid3 = -1; + hid_t f1_gid4 = -1, f2_gid4 = -1; + hid_t f1_did = -1, f2_did = -1; + hid_t f1_sid = -1, f2_sid = -1; + hid_t f1_tid = -1, f2_tid = -1; /* dset */ - hsize_t dset_dims[1]={3}; - int dset_data[3] = {0,1,2}; + hsize_t dset_dims[1] = { 3 }; + int dset_data[3] = { 0, 1, 2 }; /* common attrs dim */ - hsize_t attr_dims[1]={2}; + hsize_t attr_dims[1] = { 2 }; /* file1 attr */ - int f1_attr_idata[2]= {1,2}; /* integer */ - float f1_attr_fdata[2]= {1.1F,2.2F}; /* float */ + int f1_attr_idata[2] = { 1, 2 }; /* integer */ + float f1_attr_fdata[2] = { 1.1F, 2.2F }; /* float */ /* file2 attr */ - int f2_attr_idata[2]= {2,3}; /* integer */ - float f2_attr_fdata[2]= {2.1F,3.2F}; /* float */ - + int f2_attr_idata[2] = { 2, 3 }; /* integer */ + float f2_attr_fdata[2] = { 2.1F, 3.2F }; /* float */ /*---------------------------------------------------------------------- * Create file1 *-----------------------------------------------------------------------*/ - if((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Groups */ f1_gid = H5Gcreate2(fid1, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid < 0) - { + if (f1_gid < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid2 < 0) - { + if (f1_gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid3 = H5Gcreate2(fid1, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid3 < 0) - { + if (f1_gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid4 = H5Gcreate2(fid1, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_gid4 < 0) - { + if (f1_gid4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Datasets */ f1_sid = H5Screate_simple(1, dset_dims, NULL); f1_did = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, f1_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f1_did == FAIL) - { + if (f1_did == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = H5Dwrite(f1_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Named Datatype */ f1_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid1, "ntype", f1_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); status = FAIL; goto out; } - - - /*---------------------------------------------------------------------- * Create file2 *-----------------------------------------------------------------------*/ - if((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Groups */ f2_gid = H5Gcreate2(fid2, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid < 0) - { + if (f2_gid < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid2 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid2 < 0) - { + if (f2_gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid3 = H5Gcreate2(fid2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid3 < 0) - { + if (f2_gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid4 = H5Gcreate2(fid2, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_gid4 < 0) - { + if (f2_gid4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Datasets */ f2_sid = H5Screate_simple(1, dset_dims, NULL); f2_did = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, f2_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (f2_did == FAIL) - { + if (f2_did == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = H5Dwrite(f2_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * Named Datatype */ f2_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid2, "ntype", f2_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); status = FAIL; goto out; } - /*---------------------------------- + /*---------------------------------- * CASE1 - Same attr number, all Same attr name * add attr to group */ - write_attr(f1_gid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f1_attr_fdata); + write_attr(f1_gid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f1_attr_fdata); - write_attr(f2_gid,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f2_gid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE2 - Same attr number, some Same attr name * add attr to dset */ - write_attr(f1_did,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_did,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata); + write_attr(f1_did, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_did, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); - write_attr(f2_did,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_did,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f2_did, 1, attr_dims, "integer1", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_did, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE3 - Same attr number, all different attr name * add attr to ntype */ - write_attr(f1_tid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_tid,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata); - write_attr(f1_tid,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f1_attr_fdata); + write_attr(f1_tid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_tid, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f1_tid, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata); - write_attr(f2_tid,1,attr_dims,"integer4",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_tid,1,attr_dims,"float5",H5T_NATIVE_FLOAT,f2_attr_fdata); - write_attr(f2_tid,1,attr_dims,"float6",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f2_tid, 1, attr_dims, "integer4", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_tid, 1, attr_dims, "float5", H5T_NATIVE_FLOAT, f2_attr_fdata); + write_attr(f2_tid, 1, attr_dims, "float6", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE4 - Different attr number, some same attr name (vs file2-g2) * add attr to g2 */ - write_attr(f1_gid2,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_gid2,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata); - write_attr(f1_gid2,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f1_attr_fdata); - - write_attr(f2_gid2,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_gid2,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f1_gid2, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f1_gid2, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f2_gid2, 1, attr_dims, "integer1", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f2_attr_fdata); - /*---------------------------------- + /*---------------------------------- * CASE5 - Different attr number, all different attr name * add attr to g3 */ - write_attr(f1_gid3,1,attr_dims,"integer10",H5T_NATIVE_INT,f1_attr_idata); - write_attr(f1_gid3,1,attr_dims,"float11",H5T_NATIVE_FLOAT,f1_attr_fdata); - write_attr(f1_gid3,1,attr_dims,"float12",H5T_NATIVE_FLOAT,f1_attr_fdata); - - write_attr(f2_gid3,1,attr_dims,"integer3",H5T_NATIVE_INT,f2_attr_idata); - write_attr(f2_gid3,1,attr_dims,"float4",H5T_NATIVE_FLOAT,f2_attr_fdata); + write_attr(f1_gid3, 1, attr_dims, "integer10", H5T_NATIVE_INT, f1_attr_idata); + write_attr(f1_gid3, 1, attr_dims, "float11", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f1_gid3, 1, attr_dims, "float12", H5T_NATIVE_FLOAT, f1_attr_fdata); + write_attr(f2_gid3, 1, attr_dims, "integer3", H5T_NATIVE_INT, f2_attr_idata); + write_attr(f2_gid3, 1, attr_dims, "float4", H5T_NATIVE_FLOAT, f2_attr_fdata); out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1 > 0) + if (fid1 > 0) H5Fclose(fid1); - if(fid2 > 0) + if (fid2 > 0) H5Fclose(fid2); - if(f1_gid > 0) + if (f1_gid > 0) H5Gclose(f1_gid); - if(f2_gid > 0) + if (f2_gid > 0) H5Gclose(f2_gid); - if(f1_gid2 > 0) + if (f1_gid2 > 0) H5Gclose(f1_gid2); - if(f2_gid2 > 0) + if (f2_gid2 > 0) H5Gclose(f2_gid2); - if(f1_gid3 > 0) + if (f1_gid3 > 0) H5Gclose(f1_gid3); - if(f2_gid3 > 0) + if (f2_gid3 > 0) H5Gclose(f2_gid3); - if(f1_gid4 > 0) + if (f1_gid4 > 0) H5Gclose(f1_gid4); - if(f2_gid4 > 0) + if (f2_gid4 > 0) H5Gclose(f2_gid4); - if(f1_did > 0) + if (f1_did > 0) H5Dclose(f1_did); - if(f2_did > 0) + if (f2_did > 0) H5Dclose(f2_did); - if(f1_sid > 0) + if (f1_sid > 0) H5Sclose(f1_sid); - if(f2_sid > 0) + if (f2_sid > 0) H5Sclose(f2_sid); - if(f1_tid > 0) + if (f1_tid > 0) H5Tclose(f1_tid); - if(f2_tid > 0) + if (f2_tid > 0) H5Tclose(f2_tid); return status; } - /*------------------------------------------------------------------------- -* Function: test_datasets -* -* Purpose: Check all HDF5 classes -* H5T_INTEGER, H5T_FLOAT -* H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE, -* H5T_ENUM, H5T_VLEN, H5T_ARRAY -* -*------------------------------------------------------------------------- -*/ + * Function: test_datasets + * + * Purpose: Check all HDF5 classes + * H5T_INTEGER, H5T_FLOAT + * H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE, + * H5T_ENUM, H5T_VLEN, H5T_ARRAY + * + *------------------------------------------------------------------------- + */ static -int test_datasets(const char *file, - int make_diffs /* flag to modify data buffers */) +int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid; - hid_t did; - hid_t gid; - hid_t sid; - hsize_t dims[1]={2}; - herr_t status; - int buf[2]={1,2}; - - if(make_diffs > 0) + hid_t fid = -1; + hid_t did = -1; + hid_t gid = -1; + hid_t sid = -1; + hsize_t dims[1] = { 2 }; + herr_t status; + int buf[2] = { 1, 2 }; + + if (make_diffs > 0) memset(buf, 0, sizeof buf); /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* Create a 1D dataset */ sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); status = H5Sclose(sid); assert(status >= 0); /* Create a group */ - gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of datasets on the group *------------------------------------------------------------------------- */ - write_dset_in(gid,"/dset",fid,make_diffs); + write_dset_in(gid, "/dset", fid, make_diffs); /* close */ status = H5Dclose(did); @@ -1367,29 +1343,29 @@ int test_datasets(const char *file, } /*------------------------------------------------------------------------- -* Function: test_special_datasets -* -* Purpose: Check datasets with datasapce of zero dimension size. -*------------------------------------------------------------------------- -*/ + * Function: test_special_datasets + * + * Purpose: Check datasets with datasapce of zero dimension size. + *------------------------------------------------------------------------- + */ static -int test_special_datasets(const char *file, - int make_diffs /* flag to modify data buffers */) +int test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid; - hid_t did; - hid_t sid0, sid; - hsize_t dims0[SPACE1_RANK]={SPACE1_DIM1, SPACE1_DIM2}; - hsize_t dims[SPACE1_RANK]={SPACE1_DIM1, SPACE1_DIM2}; - herr_t status; + hid_t fid = -1; + hid_t did = -1; + hid_t sid0 = -1; + hid_t sid = -1; + hsize_t dims0[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; + hsize_t dims[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; + herr_t status; /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* Create a dataset with zero dimension size */ sid0 = H5Screate_simple(SPACE1_RANK, dims0, NULL); - did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* close dataset */ status = H5Dclose(did); @@ -1400,12 +1376,12 @@ int test_special_datasets(const char *file, assert(status >= 0); /* Create a dataset with zero dimension size in one file but the other one - * has a dataset with a non-zero dimension size */ - if(make_diffs) + * has a dataset with a non-zero dimension size */ + if (make_diffs) dims[1] = SPACE1_DIM2 + 4; sid = H5Screate_simple(SPACE1_RANK, dims, NULL); - did = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* close dataspace */ status = H5Sclose(sid); @@ -1422,26 +1398,25 @@ int test_special_datasets(const char *file, } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare links, one has longer name than -* the other and short name is subset of long name. -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare links, one has longer name than + * the other and short name is subset of long name. + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_link_name(const char *fname1) { - hid_t fid1=0; - hid_t gid1=0; - hid_t gid2=0; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; @@ -1451,16 +1426,15 @@ static int test_link_name(const char *fname1) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } - gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -1470,16 +1444,14 @@ static int test_link_name(const char *fname1) * Soft Links *------------------------------------------------------------------------*/ status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("group_longname", fid1, "link_g2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -1489,38 +1461,37 @@ out: /*----------------------------------------------------------------------- * Close *------------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare soft links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare soft links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_soft_links(const char *fname1) { - hid_t fid1=0; - hid_t gid1=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t gid1 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; @@ -1530,8 +1501,7 @@ static int test_soft_links(const char *fname1) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -1541,25 +1511,22 @@ static int test_soft_links(const char *fname1) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; @@ -1570,48 +1537,42 @@ static int test_soft_links(const char *fname1) *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset2", fid1, "softlink_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_group", fid1, "softlink_group1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_group", fid1, "softlink_group2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/no_obj", fid1, "softlink_noexist", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -1621,38 +1582,37 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(gid1) + if (gid1) H5Gclose(gid1); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare linked soft links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare linked soft links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_linked_softlinks(const char *fname1) { - hid_t fid1=0; - hid_t gid1=0; - hid_t gid2=0; - hid_t gid3=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t gid3 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; @@ -1662,24 +1622,21 @@ static int test_linked_softlinks(const char *fname1) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid2 = H5Gcreate2(fid1, "target_group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid3 = H5Gcreate2(fid1, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3 < 0) - { + if (gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -1689,24 +1646,21 @@ static int test_linked_softlinks(const char *fname1) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "target_dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; @@ -1716,98 +1670,86 @@ static int test_linked_softlinks(const char *fname1) * Soft Links (Linked) *------------------------------------------------------------------------*/ /*--------- - * file 1 */ + * file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink1_to_dset1", fid1, "softlink1_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink1_to_slink1", fid1, "softlink1_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset2", fid1, "softlink2_to_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink2_to_dset2", fid1, "softlink2_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink2_to_slink1", fid1, "softlink2_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("target_group1", fid1, "softlink3_to_group1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink3_to_group1", fid1, "softlink3_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink3_to_slink1", fid1, "softlink3_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("target_group2", fid1, "softlink4_to_group2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink4_to_group2", fid1, "softlink4_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink4_to_slink1", fid1, "softlink4_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -1817,52 +1759,50 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(gid3) + if (gid3) H5Gclose(gid3); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare external links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare external links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_external_links(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hid_t gid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ /* source file */ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } /* target file */ - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -1872,18 +1812,16 @@ static int test_external_links(const char *fname1, const char *fname2) * Groups *------------------------------------------------------------------------*/ /*-------------- - * target file */ + * target file */ gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid2 = H5Gcreate2(fid2, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -1892,26 +1830,23 @@ static int test_external_links(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /*-------------- - * target file */ - status = write_dset(fid2,2,dims2,"target_dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + * target file */ + status = write_dset(fid2, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"x_dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "x_dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"x_dset",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "x_dset", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -1923,48 +1858,42 @@ static int test_external_links(const char *fname1, const char *fname2) /*--------------*/ /* source file */ status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group", fid1, "/ext_link_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group2", fid1, "/ext_link_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link_noexist1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link_noexist2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -1974,52 +1903,50 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare external links which point to -* soft link in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare external links which point to + * soft link in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_ext2soft_links(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ /* source file */ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } /* target file */ - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -2030,8 +1957,7 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* target file */ gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -2041,18 +1967,16 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /*-------------- - * target file */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + * target file */ + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -2062,18 +1986,16 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * Soft Links (Linked) *------------------------------------------------------------------------*/ /*--------------- - * target file */ + * target file */ status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/dset2", fid2, "softlink_to_dset2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; @@ -2083,26 +2005,23 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * External Links *------------------------------------------------------------------------*/ /*--------------- - * source file */ + * source file */ status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -2112,56 +2031,57 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* Function: gen_dataset_idx -* -* Purpose: Create a file with either the new or old format -* Create two datasets in the file: -* one dataset: fixed dimension, chunked layout, w/o filters -* one dataset: fixed dimension, chunked layout, w/ filters -* -*------------------------------------------------------------------------- -*/ + * Function: gen_dataset_idx + * + * Purpose: Create a file with either the new or old format + * Create two datasets in the file: + * one dataset: fixed dimension, chunked layout, w/o filters + * one dataset: fixed dimension, chunked layout, w/ filters + * + *------------------------------------------------------------------------- + */ static int gen_dataset_idx(const char *file, int format) { - hid_t fid; /* file id */ - hid_t did, did2; /* dataset id */ - hid_t sid; /* space id */ - hid_t fapl; /* file access property id */ - hid_t dcpl; /* dataset creation property id */ - hsize_t dims[1] = {10}; /* dataset dimension */ - hsize_t c_dims[1] = {2}; /* chunk dimension */ - herr_t status; /* return status */ - int buf[10]; /* data buffer */ - int i; /* local index variable */ + hid_t fid = -1; /* file id */ + hid_t did = -1; + hid_t did2 = -1; /* dataset id */ + hid_t sid = -1; /* space id */ + hid_t fapl = -1; /* file access property id */ + hid_t dcpl = -1; /* dataset creation property id */ + hsize_t dims[1] = { 10 }; /* dataset dimension */ + hsize_t c_dims[1] = { 2 }; /* chunk dimension */ + herr_t status; /* return status */ + int buf[10]; /* data buffer */ + int i; /* local index variable */ /* Get a copy of the file aaccess property */ fapl = H5Pcreate(H5P_FILE_ACCESS); /* Set the "use the latest format" bounds for creating objects in the file */ - if(format) { - status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - assert(status >= 0); + if (format) { + status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + assert(status >= 0); } /* Create a file */ - if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) return -1; /* Create data */ - for(i = 0; i < 10; i++) - buf[i] = i; + for (i = 0; i < 10; i++) + buf[i] = i; /* Set chunk */ dcpl = H5Pcreate(H5P_DATASET_CREATE); @@ -2170,7 +2090,7 @@ int gen_dataset_idx(const char *file, int format) /* Create a 1D dataset */ sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); /* Write to the dataset */ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -2182,7 +2102,7 @@ int gen_dataset_idx(const char *file, int format) assert(status >= 0); /* Create and write the dataset */ - did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); assert(status >= 0); @@ -2212,35 +2132,33 @@ int gen_dataset_idx(const char *file, int format) } /*------------------------------------------------------------------------- -* -* Purpose: Create test files to compare dangling links in various way -* -* Programmer: Jonathan Kim (Feb 17, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files to compare dangling links in various way + * + * Programmer: Jonathan Kim (Feb 17, 2010) + * + *-------------------------------------------------------------------------*/ static int test_dangle_links(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -2250,34 +2168,30 @@ static int test_dangle_links(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -2288,32 +2202,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/dset1", fid1, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj", fid1, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj1", fid1, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -2321,32 +2231,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file 2 */ status = H5Lcreate_soft("no_obj", fid2, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj", fid2, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/dset2", fid2, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj2", fid2, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; @@ -2357,32 +2263,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file1 */ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/dset1", fid1, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -2390,32 +2292,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file2 */ status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/dset2", fid2, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; @@ -2425,47 +2323,45 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: For testing comparing group member objects recursively -* -* Programmer: Jonathan Kim (Aug 19, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: For testing comparing group member objects recursively + * + * Programmer: Jonathan Kim (Aug 19, 2010) + * + *-------------------------------------------------------------------------*/ static int test_group_recurse(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1_f1=0, gid2_f1=0, gid3_f1=0, gid10_f1=0; - hid_t gid1_f2=0, gid2_f2=0, gid3_f2=0, gid11_f2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,1},{0,1},{1,0},{1,0}}; - int data2[4][2] = {{0,2},{0,2},{2,0},{2,0}}; - int data3[4][2] = {{0,3},{0,3},{3,0},{3,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1_f1 = -1, gid2_f1 = -1, gid3_f1 = -1, gid10_f1 = -1; + hid_t gid1_f2 = -1, gid2_f2 = -1, gid3_f2 = -1, gid11_f2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 1 }, { 0, 1 }, { 1, 0 }, { 1, 0 } }; + int data2[4][2] = { { 0, 2 }, { 0, 2 }, { 2, 0 }, { 2, 0 } }; + int data3[4][2] = { { 0, 3 }, { 0, 3 }, { 3, 0 }, { 3, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; @@ -2476,32 +2372,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file1 */ gid1_f1 = H5Gcreate2(fid1, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1_f1 < 0) - { + if (gid1_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid2_f1 = H5Gcreate2(fid1, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2_f1 < 0) - { + if (gid2_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid3_f1 = H5Gcreate2(fid1, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3_f1 < 0) - { + if (gid3_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid10_f1 = H5Gcreate2(fid1, "/grp10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid10_f1 < 0) - { + if (gid10_f1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -2509,32 +2401,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ gid1_f2 = H5Gcreate2(fid2, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1_f2 < 0) - { + if (gid1_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid2_f2 = H5Gcreate2(fid2, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2_f2 < 0) - { + if (gid2_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid3_f2 = H5Gcreate2(fid2, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3_f2 < 0) - { + if (gid3_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid11_f2 = H5Gcreate2(fid2, "/grp11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid11_f2 < 0) - { + if (gid11_f2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -2544,50 +2432,44 @@ static int test_group_recurse(const char *fname1, const char *fname2) * Datasets under root *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(fid2,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -2597,163 +2479,142 @@ static int test_group_recurse(const char *fname1, const char *fname2) * Datasets under group *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(gid1_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid2_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid2_f1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2_f1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid3_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid3_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid3_f1,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid3_f1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid3_f1,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(gid3_f1, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid10_f1,2,dims2,"dset4",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid10_f1, 2, dims2, "dset4", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid10_f1,2,dims2,"dset5",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(gid10_f1, 2, dims2, "dset5", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(gid1_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2_f2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2_f2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid3_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3_f2,2,dims2,"dset2",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid3_f2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3_f2,2,dims2,"dset3",H5T_NATIVE_INT,data3); - if (status == FAIL) - { + status = write_dset(gid3_f2, 2, dims2, "dset3", H5T_NATIVE_INT, data3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid11_f2,2,dims2,"dset4",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid11_f2, 2, dims2, "dset4", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid11_f2,2,dims2,"dset5",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid11_f2, 2, dims2, "dset5", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - /*----------------------------------------------------------------------- * Soft Links *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("/grp1", fid1, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2", fid1, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2/grp3", fid1, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp10", fid1, "slink_grp10", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; @@ -2761,32 +2622,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file 2 */ status = H5Lcreate_soft("/grp1", fid2, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2", fid2, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2/grp3", fid2, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp11", fid2, "slink_grp11", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; @@ -2797,24 +2654,21 @@ static int test_group_recurse(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file1 */ status = H5Lcreate_external(fname2, "/grp1", fid1, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/grp1/grp2", fid1, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/grp1/grp2/grp3", fid1, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; @@ -2822,225 +2676,210 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ status = H5Lcreate_external(fname1, "/grp1", fid2, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/grp1/grp2", fid2, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/grp1/grp2/grp3", fid2, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } /*------------------------------ - * external circle route test - * file1/grp11 <-> file2/grp10 via elink_grp_circle link - */ + * external circle route test + * file1/grp11 <-> file2/grp10 via elink_grp_circle link + */ /* file1 */ status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } /* file2 */ status = H5Lcreate_external(fname1, "/grp10", gid11_f2, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } - out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1_f1) + if (gid1_f1) H5Gclose(gid1_f1); - if(gid2_f1) + if (gid2_f1) H5Gclose(gid2_f1); - if(gid3_f1) + if (gid3_f1) H5Gclose(gid3_f1); - if(gid1_f2) + if (gid1_f2) H5Gclose(gid1_f2); - if(gid2_f2) + if (gid2_f2) H5Gclose(gid2_f2); - if(gid3_f2) + if (gid3_f2) H5Gclose(gid3_f2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: -* For testing comparing group member objects recursively via multiple -* linked external links -* -* Programmer: Jonathan Kim (Sep 16, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: + * For testing comparing group member objects recursively via multiple + * linked external links + * + * Programmer: Jonathan Kim (Sep 16, 2010) + * + *-------------------------------------------------------------------------*/ #define GRP_R_DSETNAME1 "dset1" #define GRP_R_DSETNAME2 "dset2" static int test_group_recurse2(void) { - hid_t fileid1 = -1; - hid_t grp1 = -1; - hid_t grp2 = -1; - hid_t grp3 = -1; - hid_t grp4 = -1; - hid_t dset1 = -1; - hid_t dset2 = -1; - hid_t datatype = -1; - hid_t dataspace = -1; - hid_t fileid2 = -1; - hid_t fileid3 = -1; - hid_t fileid4 = -1; - hsize_t dimsf[2]; /* dataset dimensions */ - herr_t status=0; - int data1[4][2] = {{0,0},{1,1},{2,2},{3,3}}; - int data2[4][2] = {{0,0},{0,1},{0,2},{3,3}}; - - /*----------------------------------------------------------------------- + hid_t fileid1 = -1; + hid_t grp1 = -1; + hid_t grp2 = -1; + hid_t grp3 = -1; + hid_t grp4 = -1; + hid_t dset1 = -1; + hid_t dset2 = -1; + hid_t datatype = -1; + hid_t dataspace = -1; + hid_t fileid2 = -1; + hid_t fileid3 = -1; + hid_t fileid4 = -1; + hsize_t dimsf[2]; /* dataset dimensions */ + herr_t status = 0; + int data1[4][2] = { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } }; + int data2[4][2] = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 3, 3 } }; + + /*----------------------------------------------------------------------- * FILE 1 *------------------------------------------------------------------------*/ /* - * Create a new file using H5F_ACC_TRUNC access, - * default file creation properties, and default file - * access properties. - */ + * Create a new file using H5F_ACC_TRUNC access, + * default file creation properties, and default file + * access properties. + */ fileid1 = H5Fcreate(GRP_RECURSE1_EXT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Groups *------------------------------------------------------------------------*/ grp1 = H5Gcreate2(fileid1, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp1 < 0) - { + if (grp1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp2 = H5Gcreate2(grp1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp2 < 0) - { + if (grp2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp3 < 0) - { + if (grp3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp4 = H5Gcreate2(grp3, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp4 < 0) - { + if (grp4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Datasets *------------------------------------------------------------------------*/ /* - * Describe the size of the array and create the data space for fixed - * size dataset. - */ + * Describe the size of the array and create the data space for fixed + * size dataset. + */ dimsf[0] = 4; dimsf[1] = 2; dataspace = H5Screate_simple(2, dimsf, NULL); /* - * Define datatype for the data in the file. - * We will store little endian INT numbers. - */ + * Define datatype for the data in the file. + * We will store little endian INT numbers. + */ datatype = H5Tcopy(H5T_NATIVE_INT); status = H5Tset_order(datatype, H5T_ORDER_LE); /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ - dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ + dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); H5Dclose(dset1); /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ - dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ + dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); /*--------------- - * dset2 - */ + * dset2 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ - dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ + dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Soft links *------------------------------------------------------------------------*/ /* - * under '/' root - */ + * under '/' root + */ /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; @@ -3053,90 +2892,83 @@ static int test_group_recurse2(void) H5Gclose(grp3); H5Gclose(grp4); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * FILE 2-3 *------------------------------------------------------------------------*/ /* crate target file */ fileid4 = H5Fcreate(GRP_RECURSE2_EXT3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------- + /*----------------------------------------------- * Groups */ grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp4 < 0) - { + if (grp4 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3); status = FAIL; goto out; } /*--------------- - * dset2 - */ + * dset2 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ - dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ + dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); H5Gclose(grp4); H5Dclose(dset2); - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * FILE 2-2 *------------------------------------------------------------------------*/ /* crate target file */ fileid3 = H5Fcreate(GRP_RECURSE2_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------- + /*----------------------------------------------- * Groups */ grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp2 < 0) - { + if (grp2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; } grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp3 < 0) - { + if (grp3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; } /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ - dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ + dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); - /*----------------------------------------------- + /*----------------------------------------------- * extlink to $GRP_RECURSE2_EXT3/g4 */ status = H5Lcreate_external(GRP_RECURSE2_EXT3, "/g4", fileid3, "/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; @@ -3146,56 +2978,52 @@ static int test_group_recurse2(void) H5Gclose(grp2); H5Gclose(grp3); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * FILE 2-1 *------------------------------------------------------------------------*/ /* crate target file */ fileid2 = H5Fcreate(GRP_RECURSE2_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /*----------------------------------------------- + /*----------------------------------------------- * Groups */ grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (grp1 < 0) - { + if (grp1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } /*--------------- - * dset1 - */ - dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * dset1 + */ + dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Soft links *------------------------------------------------------------------------*/ /* - * under '/' root - */ + * under '/' root + */ /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid2, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE2_EXT1); status = FAIL; goto out; } - /*----------------------------------------------- + /*----------------------------------------------- * extlink to $GRP_RECURSE2_EXT2/g2 */ status = H5Lcreate_external(GRP_RECURSE2_EXT2, "/g2", fileid2, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1); status = FAIL; goto out; @@ -3206,72 +3034,67 @@ static int test_group_recurse2(void) out: /* - * Close/release resources. - */ - if(dataspace > 0) + * Close/release resources. + */ + if (dataspace > 0) H5Sclose(dataspace); - if(datatype > 0) + if (datatype > 0) H5Tclose(datatype); - if(fileid1 > 0) + if (fileid1 > 0) H5Fclose(fileid1); - if(fileid2 > 0) + if (fileid2 > 0) H5Fclose(fileid2); - if(fileid3 > 0) + if (fileid3 > 0) H5Fclose(fileid3); - if(fileid4 > 0) + if (fileid4 > 0) H5Fclose(fileid4); return status; } - /*------------------------------------------------------------------------- -* -* Purpose: Create test files for excluding obj. -* Same structure, same obj names -* Test : exclude obj with different value to verify the rest are same -* -* Programmer: Jonathan Kim (July, 21, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for excluding obj. + * Same structure, same obj names + * Test : exclude obj with different value to verify the rest are same + * + * Programmer: Jonathan Kim (July, 21, 2010) + * + *-------------------------------------------------------------------------*/ static int test_exclude_obj1(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hid_t gid2=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - int data2[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Group *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3280,133 +3103,119 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) /* file2 */ gid2 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*----------------------------------------------------------------------- * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"dset3",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "dset3", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files for excluding obj. -* different structure and name -* Test : exclude different objs to verify the rest are same -* -* Programmer: Jonathan Kim (July, 21, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for excluding obj. + * different structure and name + * Test : exclude different objs to verify the rest are same + * + * Programmer: Jonathan Kim (July, 21, 2010) + * + *-------------------------------------------------------------------------*/ static int test_exclude_obj2(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hid_t gid2=0; - hid_t gid3=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - int data2[4][2] = {{0,1},{2,3},{1,2},{3,4}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t gid3 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Group *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3414,9 +3223,7 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* file2 */ gid2 = H5Gcreate2(fid2, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -3425,133 +3232,118 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* subset name from group10 */ gid3 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid3 < 0) - { + if (gid3 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } - /*----------------------------------------------------------------------- * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset10",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset10", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - /* file2 */ - status = write_dset(fid2,2,dims2,"dset10",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset10", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - status = write_dset(gid3,2,dims2,"dset3",H5T_NATIVE_INT,data2); - if (status == FAIL) - { + status = write_dset(gid3, 2, dims2, "dset3", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } - out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(gid3) + if (gid3) H5Gclose(gid3); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files for excluding obj. -* Only one file contains unique objs. Common objs are same. -* Test : exclude unique objs to verify the rest are same -* - HDFFV-7837 -* -* Programmer: Jonathan Kim (Mar, 19, 2012) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for excluding obj. + * Only one file contains unique objs. Common objs are same. + * Test : exclude unique objs to verify the rest are same - HDFFV-7837 + * + * Programmer: Jonathan Kim (Mar, 19, 2012) + * + *-------------------------------------------------------------------------*/ static int test_exclude_obj3(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t gid1=0; - hsize_t dims2[2] = {2,4}; - int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}}; - herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t gid1 = -1; + hsize_t dims2[2] = { 2, 4 }; + int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Group *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3561,26 +3353,23 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) * Datasets *------------------------------------------------------------------------*/ /* file1 */ - status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } - status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } /* file2 */ - status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); - if (status == FAIL) - { + status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; @@ -3590,25 +3379,25 @@ out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(gid1) + if (gid1) H5Gclose(gid1); return status; } /*------------------------------------------------------------------------- -* -* Purpose: Create test files for multiple variable length string/string array -* along with fixed length string/string array types in -* a compound type dataset. -* -* Programmer: Jonathan Kim (Oct, 26, 2010) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: Create test files for multiple variable length string/string array + * along with fixed length string/string array types in + * a compound type dataset. + * + * Programmer: Jonathan Kim (Oct, 26, 2010) + * + *-------------------------------------------------------------------------*/ #define STR_RANK 1 #define VLEN_STR_DIM 1 #define FIXLEN_STR_SIZE 21 @@ -3621,187 +3410,170 @@ out: static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new) { int i; - - hid_t fid1 = -1; /* file id */ - hid_t gid = -1; + hid_t fid1 = -1; /* file id */ + hid_t gid = -1; /* compound1 datatype */ - typedef struct comp1_t - { - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + typedef struct comp1_t { + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ } comp1_t; /* compound2 datatype */ - typedef struct comp2_t - { - char *str_vlen; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + typedef struct comp2_t { + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ } comp2_t; /* compound3 datatype */ - typedef struct comp3_t - { - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + typedef struct comp3_t { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ } comp3_t; /* compound4 datatype */ - typedef struct comp4_t - { - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + typedef struct comp4_t { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ } comp4_t; /* compound5 datatype */ - typedef struct comp5_t - { - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + typedef struct comp5_t { + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ } comp5_t; /* compound6 datatype */ - typedef struct comp6_t - { - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char *str_vlen; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + typedef struct comp6_t { + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ } comp6_t; /* compound7 datatype */ - typedef struct comp7_t - { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ + typedef struct comp7_t { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ } comp7_t; /* compound8 datatype */ - typedef struct comp8_t - { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ + typedef struct comp8_t { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ } comp8_t; /* compound9 datatype */ - typedef struct comp9_t - { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - int int_data1; - hobj_ref_t objref1; /* reference */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - hobj_ref_t objref2; /* reference */ - char *str_vlen; /* vlen string */ - int int_data2; - char *str_vlen_repeat; /* vlen string */ - hobj_ref_t objref3; /* reference */ - int int_data3; + typedef struct comp9_t { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + int int_data1; + hobj_ref_t objref1; /* reference */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + hobj_ref_t objref2; /* reference */ + char *str_vlen; /* vlen string */ + int int_data2; + char *str_vlen_repeat; /* vlen string */ + hobj_ref_t objref3; /* reference */ + int int_data3; } comp9_t; /* vlen string */ - hid_t sid_vlen_str=0; /* dataspace ID */ - hid_t tid_vlen_str=0; /* datatype ID */ - char vlen_str_buf[]= { - "Variable length string" - }; - hsize_t dims_vlen_str[] = {VLEN_STR_DIM}; + hid_t sid_vlen_str = -1; /* dataspace ID */ + hid_t tid_vlen_str = -1; /* datatype ID */ + char vlen_str_buf[] = { "Variable length string" }; + hsize_t dims_vlen_str[] = { VLEN_STR_DIM }; /* fixlen string */ - hid_t sid_fixlen_str=0; /* dataspace ID */ - hid_t tid_fixlen_str=0; /* datatype ID */ - const char fixlen_str_buf[FIXLEN_STR_SIZE]= { - "Fixed length string" - }; - hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM}; + hid_t sid_fixlen_str = -1; /* dataspace ID */ + hid_t tid_fixlen_str = -1; /* datatype ID */ + const char fixlen_str_buf[FIXLEN_STR_SIZE] = { "Fixed length string" }; + hsize_t dims_fixlen_str[] = { FIXLEN_STR_DIM }; /* vlen string array */ - hid_t sid_vlen_str_array=0; /* dataspace ID */ - hid_t tid_vlen_str_array_pre=0; /* datatype ID */ - hid_t tid_vlen_str_array=0; /* datatype ID */ - const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= { - "1 - Variable length string Array", - "2 - Testing variable length string array in compound type", - "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," - }; - hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM}; + hid_t sid_vlen_str_array = -1; /* dataspace ID */ + hid_t tid_vlen_str_array_pre = -1; /* datatype ID */ + hid_t tid_vlen_str_array = -1; /* datatype ID */ + const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] = + { "1 - Variable length string Array", + "2 - Testing variable length string array in compound type", + "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," }; + hsize_t dims_vlen_str_array[] = { VLEN_STR_ARRY_DIM }; /* fixlen string array */ - hid_t sid_fixlen_str_array=0; /* dataspace ID */ - hid_t tid_fixlen_str_array_pre=0; /* datatype ID */ - hid_t tid_fixlen_str_array=0; /* datatype ID */ - const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM]= { - "1 - Fixed length string Array", - "2 - Fixed length string Array", - "3 - Fixed length string Array" - }; - hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM}; + hid_t sid_fixlen_str_array = -1; /* dataspace ID */ + hid_t tid_fixlen_str_array_pre = -1; /* datatype ID */ + hid_t tid_fixlen_str_array = -1; /* datatype ID */ + const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM] = { + "1 - Fixed length string Array", "2 - Fixed length string Array", + "3 - Fixed length string Array" }; + hsize_t dims_fixlen_str_array[] = { FIXLEN_STR_ARRY_DIM }; /*------------------------------------------ - * compound dataset - *------------------------------------------*/ - hid_t sid_comp=0; /* dataspace ID */ - hid_t tid1_comp=0; /* datatype ID */ - hid_t tid2_comp=0; /* datatype ID */ - hid_t tid3_comp=0; /* datatype ID */ - hid_t tid4_comp=0; /* datatype ID */ - hid_t tid5_comp=0; /* datatype ID */ - hid_t tid6_comp=0; /* datatype ID */ - hid_t tid7_comp=0; /* datatype ID */ - hid_t tid8_comp=0; /* datatype ID */ - hid_t tid9_comp=0; /* datatype ID */ - hid_t did_comp=0; /* dataset ID */ - hsize_t dims_comp[] = {COMP_DIM}; - herr_t status = SUCCEED; + * compound dataset + *------------------------------------------*/ + hid_t sid_comp = -1; /* dataspace ID */ + hid_t tid1_comp = -1; /* datatype ID */ + hid_t tid2_comp = -1; /* datatype ID */ + hid_t tid3_comp = -1; /* datatype ID */ + hid_t tid4_comp = -1; /* datatype ID */ + hid_t tid5_comp = -1; /* datatype ID */ + hid_t tid6_comp = -1; /* datatype ID */ + hid_t tid7_comp = -1; /* datatype ID */ + hid_t tid8_comp = -1; /* datatype ID */ + hid_t tid9_comp = -1; /* datatype ID */ + hid_t did_comp = -1; /* dataset ID */ + hsize_t dims_comp[] = { COMP_DIM }; + herr_t status = SUCCEED; /* make compound strings data */ comp1_t comp1_buf; @@ -3857,23 +3629,30 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int HDstrcpy(comp9_buf.str_fixlen_repeat, fixlen_str_buf); /* copy vlen string array data to compound buffers */ - for (i=0; i < VLEN_STR_ARRY_DIM; i++) - { - comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; - comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + for (i = 0; i < VLEN_STR_ARRY_DIM; i++) { + comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; + comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = + vlen_str_array_buf[i]; } /* copy fixlen string attay data to compound buffers */ - for (i=0; i < FIXLEN_STR_ARRY_DIM; i++) - { + for (i = 0; i < FIXLEN_STR_ARRY_DIM; i++) { HDstrcpy(comp1_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); HDstrcpy(comp1_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); @@ -3907,25 +3686,20 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int comp9_buf.int_data2 = 20; comp9_buf.int_data3 = 30; - /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - if (is_file_new == 1) - { - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { + if (is_file_new == 1) { + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } } - else - { - fid1 = H5Fopen (fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) - { + else { + fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); status = FAIL; goto out; @@ -3936,8 +3710,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Create group *------------------------------------------------------------------------*/ gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid < 0) - { + if (gid < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -3947,8 +3720,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Variable length String1 - Create space and type *------------------------------------------------------------------------*/ sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL); - if (sid_vlen_str < 0) - { + if (sid_vlen_str < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -3956,8 +3728,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_vlen_str = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_vlen_str, H5T_VARIABLE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; @@ -3967,8 +3738,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Fixed length String2 - Create space and type *------------------------------------------------------------------------*/ sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL); - if (sid_fixlen_str < 0) - { + if (sid_fixlen_str < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -3976,8 +3746,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_fixlen_str = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; @@ -3987,8 +3756,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Fixed length String3 array - Create space and type *------------------------------------------------------------------------*/ sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL); - if (sid_vlen_str_array < 0) - { + if (sid_vlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -3996,17 +3764,15 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } - /* Create the array data type for the string array */ + /* Create the array data type for the string array */ tid_vlen_str_array = H5Tarray_create2(tid_vlen_str_array_pre, COMP_RANK, dims_vlen_str_array); - if (tid_vlen_str_array < 0) - { + if (tid_vlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; goto out; @@ -4016,8 +3782,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int * Variable length String4 array - Create space and type *------------------------------------------------------------------------*/ sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL); - if (sid_fixlen_str_array < 0) - { + if (sid_fixlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; @@ -4025,126 +3790,123 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } - /* Create the array data type for the string array */ + /* Create the array data type for the string array */ tid_fixlen_str_array = H5Tarray_create2(tid_fixlen_str_array_pre, COMP_RANK, dims_fixlen_str_array); - if (tid_fixlen_str_array < 0) - { + if (tid_fixlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; goto out; } - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Compound dataset *------------------------------------------------------------------------*/ sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL); - if (sid_comp < 0) - { + if (sid_comp < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } - tid1_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp1_t)); - tid2_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp2_t)); - tid3_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp3_t)); - tid4_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp4_t)); - tid5_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp5_t)); - tid6_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp6_t)); - tid7_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp7_t)); - tid8_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp8_t)); - tid9_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp9_t)); + tid1_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp1_t)); + tid2_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp2_t)); + tid3_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp3_t)); + tid4_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp4_t)); + tid5_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp5_t)); + tid6_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp6_t)); + tid7_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp7_t)); + tid8_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp8_t)); + tid9_comp = H5Tcreate(H5T_COMPOUND, sizeof(comp9_t)); /* compound 1 */ - H5Tinsert(tid1_comp, "VLEN_STR1", HOFFSET(comp1_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid1_comp, "VLEN_STR2", HOFFSET(comp1_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid1_comp, "FIXLEN_STR1", HOFFSET(comp1_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid1_comp, "FIXLEN_STR2", HOFFSET(comp1_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid1_comp, "VLEN_STR1", HOFFSET(comp1_t, str_vlen), tid_vlen_str); + H5Tinsert(tid1_comp, "VLEN_STR2", HOFFSET(comp1_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid1_comp, "FIXLEN_STR1", HOFFSET(comp1_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid1_comp, "FIXLEN_STR2", HOFFSET(comp1_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid1_comp, "VLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid1_comp, "VLEN_STR_ARRAY2", HOFFSET(comp1_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp1_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 2 */ - H5Tinsert(tid2_comp, "VLEN_STR1", HOFFSET(comp2_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid2_comp, "VLEN_STR2", HOFFSET(comp2_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid2_comp, "FIXLEN_STR1", HOFFSET(comp2_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid2_comp, "FIXLEN_STR2", HOFFSET(comp2_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid2_comp, "VLEN_STR1", HOFFSET(comp2_t, str_vlen), tid_vlen_str); + H5Tinsert(tid2_comp, "VLEN_STR2", HOFFSET(comp2_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid2_comp, "FIXLEN_STR1", HOFFSET(comp2_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid2_comp, "FIXLEN_STR2", HOFFSET(comp2_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid2_comp, "VLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid2_comp, "VLEN_STR_ARRAY2", HOFFSET(comp2_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp2_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 3 */ - H5Tinsert(tid3_comp, "VLEN_STR1", HOFFSET(comp3_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid3_comp, "VLEN_STR2", HOFFSET(comp3_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid3_comp, "FIXLEN_STR1", HOFFSET(comp3_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid3_comp, "FIXLEN_STR2", HOFFSET(comp3_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid3_comp, "VLEN_STR1", HOFFSET(comp3_t, str_vlen), tid_vlen_str); + H5Tinsert(tid3_comp, "VLEN_STR2", HOFFSET(comp3_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid3_comp, "FIXLEN_STR1", HOFFSET(comp3_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid3_comp, "FIXLEN_STR2", HOFFSET(comp3_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid3_comp, "VLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid3_comp, "VLEN_STR_ARRAY2", HOFFSET(comp3_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp3_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 4 */ - H5Tinsert(tid4_comp, "VLEN_STR1", HOFFSET(comp4_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid4_comp, "VLEN_STR2", HOFFSET(comp4_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid4_comp, "FIXLEN_STR1", HOFFSET(comp4_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid4_comp, "FIXLEN_STR2", HOFFSET(comp4_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid4_comp, "VLEN_STR1", HOFFSET(comp4_t, str_vlen), tid_vlen_str); + H5Tinsert(tid4_comp, "VLEN_STR2", HOFFSET(comp4_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid4_comp, "FIXLEN_STR1", HOFFSET(comp4_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid4_comp, "FIXLEN_STR2", HOFFSET(comp4_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid4_comp, "VLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid4_comp, "VLEN_STR_ARRAY2", HOFFSET(comp4_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp4_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 5 */ - H5Tinsert(tid5_comp, "VLEN_STR1", HOFFSET(comp5_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid5_comp, "VLEN_STR2", HOFFSET(comp5_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid5_comp, "VLEN_STR1", HOFFSET(comp5_t, str_vlen), tid_vlen_str); + H5Tinsert(tid5_comp, "VLEN_STR2", HOFFSET(comp5_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array); - H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 6 */ - H5Tinsert(tid6_comp, "VLEN_STR1", HOFFSET(comp6_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid6_comp, "VLEN_STR2", HOFFSET(comp6_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid6_comp, "FIXLEN_STR1", HOFFSET(comp6_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid6_comp, "FIXLEN_STR2", HOFFSET(comp6_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid6_comp, "VLEN_STR1", HOFFSET(comp6_t, str_vlen), tid_vlen_str); + H5Tinsert(tid6_comp, "VLEN_STR2", HOFFSET(comp6_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid6_comp, "FIXLEN_STR1", HOFFSET(comp6_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid6_comp, "FIXLEN_STR2", HOFFSET(comp6_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid6_comp, "VLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid6_comp, "VLEN_STR_ARRAY2", HOFFSET(comp6_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp6_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 7 */ - H5Tinsert(tid7_comp, "VLEN_STR1", HOFFSET(comp7_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid7_comp, "VLEN_STR2", HOFFSET(comp7_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid7_comp, "FIXLEN_STR1", HOFFSET(comp7_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid7_comp, "FIXLEN_STR2", HOFFSET(comp7_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid7_comp, "VLEN_STR1", HOFFSET(comp7_t, str_vlen), tid_vlen_str); + H5Tinsert(tid7_comp, "VLEN_STR2", HOFFSET(comp7_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid7_comp, "FIXLEN_STR1", HOFFSET(comp7_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid7_comp, "FIXLEN_STR2", HOFFSET(comp7_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid7_comp, "VLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid7_comp, "VLEN_STR_ARRAY2", HOFFSET(comp7_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp7_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 8 */ - H5Tinsert(tid8_comp, "VLEN_STR1", HOFFSET(comp8_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid8_comp, "VLEN_STR2", HOFFSET(comp8_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid8_comp, "FIXLEN_STR1", HOFFSET(comp8_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid8_comp, "FIXLEN_STR2", HOFFSET(comp8_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid8_comp, "VLEN_STR1", HOFFSET(comp8_t, str_vlen), tid_vlen_str); + H5Tinsert(tid8_comp, "VLEN_STR2", HOFFSET(comp8_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid8_comp, "FIXLEN_STR1", HOFFSET(comp8_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid8_comp, "FIXLEN_STR2", HOFFSET(comp8_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid8_comp, "VLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid8_comp, "VLEN_STR_ARRAY2", HOFFSET(comp8_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp8_t, str_fixlen_array_again), tid_fixlen_str_array); /* compound 9 */ - H5Tinsert(tid9_comp, "VLEN_STR1", HOFFSET(comp9_t, str_vlen), tid_vlen_str ); - H5Tinsert(tid9_comp, "VLEN_STR2", HOFFSET(comp9_t, str_vlen_repeat), tid_vlen_str ); - H5Tinsert(tid9_comp, "FIXLEN_STR1", HOFFSET(comp9_t, str_fixlen), tid_fixlen_str ); - H5Tinsert(tid9_comp, "FIXLEN_STR2", HOFFSET(comp9_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid9_comp, "VLEN_STR1", HOFFSET(comp9_t, str_vlen), tid_vlen_str); + H5Tinsert(tid9_comp, "VLEN_STR2", HOFFSET(comp9_t, str_vlen_repeat), tid_vlen_str); + H5Tinsert(tid9_comp, "FIXLEN_STR1", HOFFSET(comp9_t, str_fixlen), tid_fixlen_str); + H5Tinsert(tid9_comp, "FIXLEN_STR2", HOFFSET(comp9_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid9_comp, "VLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_vlen), tid_vlen_str_array); H5Tinsert(tid9_comp, "VLEN_STR_ARRAY2", HOFFSET(comp9_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_fixlen), tid_fixlen_str_array); @@ -4156,12 +3918,10 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int H5Tinsert(tid9_comp, "OBJREF2", HOFFSET(comp9_t, objref2), H5T_STD_REF_OBJ); H5Tinsert(tid9_comp, "OBJREF3", HOFFSET(comp9_t, objref3), H5T_STD_REF_OBJ); - /* Write data to compound 1 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4171,8 +3931,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 2 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4182,8 +3941,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 3 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4193,8 +3951,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 4 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4204,8 +3961,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 5 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4215,8 +3971,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 6 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4226,8 +3981,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 7 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4237,8 +3991,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 8 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; @@ -4249,166 +4002,158 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* obj references */ - status=H5Rcreate(&(comp9_buf.objref1),gid,"Compound_dset2",H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&(comp9_buf.objref2),gid,"Compound_dset3",H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&(comp9_buf.objref3),gid,"Compound_dset4",H5R_OBJECT,(hid_t)-1); + status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t) -1); status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } - H5Dclose(did_comp); + did_comp = -1; - did_comp=0; out: - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ - if(fid1 > 0) + if (fid1 > 0) H5Fclose(fid1); - if(gid > 0) + if (gid > 0) H5Gclose(gid); /* vlen string */ - if(tid_vlen_str > 0) + if (tid_vlen_str > 0) H5Tclose(tid_vlen_str); - if(sid_vlen_str > 0) + if (sid_vlen_str > 0) H5Sclose(sid_vlen_str); /* fixed len string */ - if(tid_fixlen_str > 0) + if (tid_fixlen_str > 0) H5Tclose(tid_fixlen_str); - if(sid_fixlen_str > 0) + if (sid_fixlen_str > 0) H5Sclose(sid_fixlen_str); /* vlen string array */ - if(tid_vlen_str_array_pre > 0) + if (tid_vlen_str_array_pre > 0) H5Tclose(tid_vlen_str_array_pre); - if(tid_vlen_str_array > 0) + if (tid_vlen_str_array > 0) H5Tclose(tid_vlen_str_array); - if(sid_vlen_str_array > 0) + if (sid_vlen_str_array > 0) H5Sclose(sid_vlen_str_array); /* fixed len string array */ - if(tid_fixlen_str_array_pre > 0) + if (tid_fixlen_str_array_pre > 0) H5Tclose(tid_fixlen_str_array_pre); - if(tid_fixlen_str_array > 0) + if (tid_fixlen_str_array > 0) H5Tclose(tid_fixlen_str_array); - if(sid_fixlen_str_array > 0) + if (sid_fixlen_str_array > 0) H5Sclose(sid_fixlen_str_array); /* compound */ - if(tid1_comp > 0) + if (tid1_comp > 0) H5Tclose(tid1_comp); - if(tid2_comp > 0) + if (tid2_comp > 0) H5Tclose(tid2_comp); - if(tid3_comp > 0) + if (tid3_comp > 0) H5Tclose(tid3_comp); - if(tid4_comp > 0) + if (tid4_comp > 0) H5Tclose(tid4_comp); - if(tid5_comp > 0) + if (tid5_comp > 0) H5Tclose(tid5_comp); - if(tid6_comp > 0) + if (tid6_comp > 0) H5Tclose(tid6_comp); - if(tid7_comp > 0) + if (tid7_comp > 0) H5Tclose(tid7_comp); - if(tid8_comp > 0) + if (tid8_comp > 0) H5Tclose(tid8_comp); - if(tid9_comp > 0) + if (tid9_comp > 0) H5Tclose(tid9_comp); - if(did_comp > 0) + if (did_comp > 0) H5Dclose(did_comp); - if(sid_comp > 0) + if (sid_comp > 0) H5Sclose(sid_comp); return status; } /* end test_comp_vlen_strings() */ - /*------------------------------------------------------------------------- -* -* Purpose: Test diffs of enum values which may include invalid values. -* -* Programmer: Dana Robinson -* -*-------------------------------------------------------------------------*/ - -static int -test_enums(const char *fname) + * + * Purpose: Test diffs of enum values which may include invalid values. + * + * Programmer: Dana Robinson + * + *-------------------------------------------------------------------------*/ + +static int test_enums(const char *fname) { - hid_t fid = -1; + hid_t fid = -1; - hid_t tid = -1; - int enum_val = -1; + hid_t tid = -1; + int enum_val = -1; /* The data in the two arrays cover the following cases: - * - * V = valid enum value, I = invalid enum value - * - * 0: I-I (same value) - * 1: V-I - * 2: I-V - * 3: V-V (same value) - * 4: I-I (different values) SKIPPED FOR NOW - * 5: V-V (different values) - */ + * + * V = valid enum value, I = invalid enum value + * + * 0: I-I (same value) + * 1: V-I + * 2: I-V + * 3: V-V (same value) + * 4: I-I (different values) SKIPPED FOR NOW + * 5: V-V (different values) + */ /* *** NOTE *** - * - * There is a bug in H5Dread() where invalid enum values are always - * returned as -1 so two different invalid enum values cannot be - * properly compared. Test 4 has been adjusted to pass here - * while we fix the issue. - */ - int data1[6] = {9, 0, 9, 0, 9, 0}; + * + * There is a bug in H5Dread() where invalid enum values are always + * returned as -1 so two different invalid enum values cannot be + * properly compared. Test 4 has been adjusted to pass here + * while we fix the issue. + */ + int data1[6] = { 9, 0, 9, 0, 9, 0 }; /*int data1[6] = {9, 0, 9, 0, 8, 0}; */ - int data2[6] = {9, 9, 0, 0, 9, 1}; + int data2[6] = { 9, 9, 0, 0, 9, 1 }; - hsize_t dims = 6; + hsize_t dims = 6; - herr_t status = SUCCEED; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create the file - *---------------------------------------------------------------------*/ + * Create the file + *---------------------------------------------------------------------*/ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*----------------------------------------------------------------------- - * Create enum types - *---------------------------------------------------------------------*/ + * Create enum types + *---------------------------------------------------------------------*/ tid = H5Tenum_create(H5T_NATIVE_INT); enum_val = 0; status = H5Tenum_insert(tid, "YIN", &enum_val); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; goto out; } enum_val = 1; status = H5Tenum_insert(tid, "YANG", &enum_val); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; goto out; } /*----------------------------------------------------------------------- - * Create datasets containing enum data. - *---------------------------------------------------------------------*/ + * Create datasets containing enum data. + *---------------------------------------------------------------------*/ status = write_dset(fid, 1, &dims, "dset1", tid, data1); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> write_dset failed.\n", fname); status = FAIL; goto out; } status = write_dset(fid, 1, &dims, "dset2", tid, data2); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> write_dset failed.\n", fname); status = FAIL; goto out; @@ -4416,41 +4161,41 @@ test_enums(const char *fname) out: /*----------------------------------------------------------------------- - * Close - *---------------------------------------------------------------------*/ - if(fid) + * Close + *---------------------------------------------------------------------*/ + if (fid) H5Fclose(fid); - if(tid) + if (tid) H5Tclose(tid); return status; } /*------------------------------------------------------------------------- -* -* Purpose: -* Create test files with dataset and attribute with container types -* (array, vlen) with multiple nested compound types. -* -* Function: test_comps_array() -* - type: compound->array->compound -* -* Function: test_comps_vlen() -* - type: compound->vlen->compound -* -* Function: test_comps_array_vlen() -* - type: compound->array->compound->vlen->compound -* -* Function: test_comps_vlen_arry() -* - type: compound->vlen->compound->array->compound -* -* Programmer: Jonathan Kim (Sep, 1, 2011) -* -*-------------------------------------------------------------------------*/ + * + * Purpose: + * Create test files with dataset and attribute with container types + * (array, vlen) with multiple nested compound types. + * + * Function: test_comps_array() + * - type: compound->array->compound + * + * Function: test_comps_vlen() + * - type: compound->vlen->compound + * + * Function: test_comps_array_vlen() + * - type: compound->array->compound->vlen->compound + * + * Function: test_comps_vlen_arry() + * - type: compound->vlen->compound->array->compound + * + * Programmer: Jonathan Kim (Sep, 1, 2011) + * + *-------------------------------------------------------------------------*/ #define SDIM_DSET 2 #define SDIM_CMPD_ARRAY 2 -static void test_comps_array (const char *fname, const char *dset, const char *attr,int diff, int is_file_new) +static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 2 */ typedef struct { @@ -4464,42 +4209,39 @@ static void test_comps_array (const char *fname, const char *dset, const char *a cmpd2_t cmpd2[SDIM_CMPD_ARRAY]; } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */ + cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */ - hid_t fid; /* HDF5 File IDs */ - hid_t did_dset; /* Dataset ID */ - hid_t sid_dset; /* Dataset space ID */ - hid_t tid_cmpd1; /* Compound1 type ID */ - hid_t tid_arry1; /* Array type ID in compound1 */ - hid_t tid_cmpd2; /* Compound2 type ID */ - hid_t tid_attr; - hsize_t sdims_dset[] = {SDIM_DSET}; - hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY}; - int i,j; - herr_t ret; /* Generic return value */ + hid_t fid = -1; /* HDF5 File IDs */ + hid_t did_dset = -1; /* Dataset ID */ + hid_t sid_dset = -1; /* Dataset space ID */ + hid_t tid_cmpd1 = -1; /* Compound1 type ID */ + hid_t tid_arry1 = -1; /* Array type ID in compound1 */ + hid_t tid_cmpd2 = -1; /* Compound2 type ID */ + hid_t tid_attr = -1; + hsize_t sdims_dset[] = { SDIM_DSET }; + hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; + int i, j; + herr_t ret; /* Generic return value */ /* Initialize array data to write */ - for(i=0; i < SDIM_DSET; i++) - { + for (i = 0; i < SDIM_DSET; i++) { wdata[i].i1 = i; - for(j=0; j < SDIM_CMPD_ARRAY; j++) - { + for (j = 0; j < SDIM_CMPD_ARRAY; j++) { wdata[i].cmpd2[j].i2 = i * 10 + diff; - wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff; + wdata[i].cmpd2[j].f2 = (float) i * 10.5F + (float) diff; } /* end for */ } - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); - + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ------------------------------- - * Create a sub compound2 datatype */ + * Create a sub compound2 datatype */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert integer field */ @@ -4511,9 +4253,9 @@ static void test_comps_array (const char *fname, const char *dset, const char *a assert(ret >= 0); /*----------------------------------- - * Create a top compound1. - */ - tid_cmpd1 = H5Tcreate (H5T_COMPOUND, sizeof(cmpd1_t)); + * Create a top compound1. + */ + tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT); assert(ret >= 0); @@ -4524,10 +4266,9 @@ static void test_comps_array (const char *fname, const char *dset, const char *a ret = H5Tinsert(tid_cmpd1, "array_cmpd1", HOFFSET(cmpd1_t, cmpd2), tid_arry1); assert(ret >= 0); - /* ------------------- - * Create a dataset - */ + * Create a dataset + */ /* Create dataspace for datasets */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4538,15 +4279,15 @@ static void test_comps_array (const char *fname, const char *dset, const char *a assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); assert(ret >= 0); /* ---------------- - * Close Dataset */ + * Close Dataset */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Tclose(tid_arry1); @@ -4563,9 +4304,7 @@ static void test_comps_array (const char *fname, const char *dset, const char *a assert(ret >= 0); } - - -static void test_comps_vlen (const char * fname, const char *dset, const char *attr, int diff, int is_file_new) +static void test_comps_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 2 */ typedef struct { @@ -4576,44 +4315,46 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a /* top compound 1 */ typedef struct { int i1; - hvl_t vl; /* VL information for compound2 */ + hvl_t vl; /* VL information for compound2 */ } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ + cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid; /* HDF5 File ID */ - hid_t did_dset; /* dataset ID */ - hid_t sid_dset; /* dataset space ID */ - hid_t tid_attr; - hid_t tid_cmpd2; /* compound2 type ID */ - hid_t tid_cmpd1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen; - hsize_t sdims_dset[] = {SDIM_DSET}; + hid_t fid = -1; /* HDF5 File ID */ + hid_t did_dset = -1; /* dataset ID */ + hid_t sid_dset = -1; /* dataset space ID */ + hid_t tid_attr = -1; + hid_t tid_cmpd2 = -1; /* compound2 type ID */ + hid_t tid_cmpd1 = -1; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = -1; + hsize_t sdims_dset[] = { SDIM_DSET }; - unsigned i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + unsigned i, j; /* counting variables */ + herr_t ret; /* Generic return value */ /* Allocate and initialize VL data to write */ - for(i = 0; i < SDIM_DSET; i++) { - wdata[i].i1 = (int)i; + for (i = 0; i < SDIM_DSET; i++) { + wdata[i].i1 = (int) i; wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; - for(j = 0; j < (i + 1); j++) { - ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff); - ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff; + for (j = 0; j < (i + 1); j++) { + ((cmpd2_t *) wdata[i].vl.p)[j].i2 = + (int) (i * 10 + (unsigned) diff); + ((cmpd2_t *) wdata[i].vl.p)[j].f2 = (float) i * 10.5F + + (float) diff; } /* end for */ } /* end for */ /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ----------------------------- - * Create sub compound2 type */ + * Create sub compound2 type */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert fields */ @@ -4623,7 +4364,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /* --------------------------- - * Create top compound1 type */ + * Create top compound1 type */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Insert fields */ ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT); @@ -4635,8 +4376,8 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 - */ + * Create dataset with compound1 + */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4648,8 +4389,8 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); @@ -4660,7 +4401,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); /* ---------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Dclose(did_dset); @@ -4677,17 +4418,16 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a assert(ret >= 0); } - -static void test_comps_array_vlen (const char * fname, const char *dset,const char *attr, int diff, int is_file_new) +static void test_comps_array_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { typedef struct { int i3; float f3; } cmpd3_t; - typedef struct { /* Typedef for compound datatype */ + typedef struct { /* Typedef for compound datatype */ int i2; - hvl_t vl; /* VL information to write */ + hvl_t vl; /* VL information to write */ } cmpd2_t; typedef struct { @@ -4695,53 +4435,53 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch cmpd2_t cmpd2[SDIM_CMPD_ARRAY]; } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Information to write */ - hid_t fid; /* HDF5 File IDs */ - hid_t did_dset; /* Dataset ID */ - hid_t sid_dset; /* Dataspace ID */ - hid_t tid_attr; - hid_t tid_cmpd1; /* Compound1 Datatype ID */ - hid_t tid_arry1; /* Array Datatype ID */ - hid_t tid_cmpd2; /* Compound2 Datatype ID */ - hid_t tid_cmpd2_vlen; - hid_t tid_cmpd3; /* Compound3 Datatype ID */ - hsize_t sdims_dset[] = {SDIM_DSET}; - hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY}; - unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ - - + cmpd1_t wdata[SDIM_DSET]; /* Information to write */ + hid_t fid = -1; /* HDF5 File IDs */ + hid_t did_dset = -1; /* Dataset ID */ + hid_t sid_dset = -1; /* Dataspace ID */ + hid_t tid_attr = -1; + hid_t tid_cmpd1 = -1; /* Compound1 Datatype ID */ + hid_t tid_arry1 = -1; /* Array Datatype ID */ + hid_t tid_cmpd2 = -1; /* Compound2 Datatype ID */ + hid_t tid_cmpd2_vlen = -1; + hid_t tid_cmpd3 = -1; /* Compound3 Datatype ID */ + hsize_t sdims_dset[] = { SDIM_DSET }; + hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY }; + unsigned i, j, k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Initialize array data to write in compound1 */ - for(i = 0; i < SDIM_DSET; i++) { - wdata[i].i1 = (int)i; + for (i = 0; i < SDIM_DSET; i++) { + wdata[i].i1 = (int) i; /* Allocate and initialize VL data to write in compound2 */ - for(j = 0; j < SDIM_CMPD_ARRAY; j++) { - wdata[i].cmpd2[j].i2 = (int)(j * 10); + for (j = 0; j < SDIM_CMPD_ARRAY; j++) { + wdata[i].cmpd2[j].i2 = (int) (j * 10); wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t)); wdata[i].cmpd2[j].vl.len = j + 1; - for(k = 0; k < (j + 1); k++) { + for (k = 0; k < (j + 1); k++) { /* Initialize data of compound3 */ - ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff; - ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff; + ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].i3 = (int) j * 10 + + diff; + ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].f3 = (float) j * 10.5F + + (float) diff; } /* end for */ } /* end for */ } /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* Create dataspace for datasets */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); /*------------------------------------- - * Create a sub compound3 datatype */ + * Create a sub compound3 datatype */ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t)); /* Insert integer field */ @@ -4752,9 +4492,8 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch ret = H5Tinsert(tid_cmpd3, "float", HOFFSET(cmpd3_t, f3), H5T_NATIVE_FLOAT); assert(ret >= 0); - /*------------------------------------- - * Create a sub compound2 datatype */ + * Create a sub compound2 datatype */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert integer field */ @@ -4765,20 +4504,18 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen); assert(ret >= 0); - /*----------------------------------- - * Create a top compound1 datatype for dataset. - */ - tid_cmpd1 = H5Tcreate (H5T_COMPOUND, sizeof(cmpd1_t)); + * Create a top compound1 datatype for dataset. + */ + tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Create an array datatype */ tid_arry1 = H5Tarray_create2(tid_cmpd2, 1, sdims_arry); /* insert the array */ H5Tinsert(tid_cmpd1, "array_comp", HOFFSET(cmpd1_t, cmpd2), tid_arry1); - /* ---------------------- - * Create a dataset */ + * Create a dataset */ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ @@ -4786,8 +4523,8 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); @@ -4798,7 +4535,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch assert(ret >= 0); /*------------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Tclose(tid_arry1); @@ -4819,8 +4556,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch assert(ret >= 0); } - -static void test_comps_vlen_arry (const char * fname, const char *dset, const char *attr, int diff, int is_file_new) +static void test_comps_vlen_arry(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 3 */ typedef struct { @@ -4837,53 +4573,53 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch /* top compound 1 */ typedef struct { int i1; - hvl_t vl; /* VL information for compound2 */ + hvl_t vl; /* VL information for compound2 */ } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ + cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid; /* HDF5 File ID */ - hid_t did_dset; /* dataset ID */ - hid_t sid_dset; /* dataset space ID */ - hid_t tid_attr; - hid_t tid_cmpd3; /* compound3 type ID */ - hid_t tid_cmpd2; /* compound2 type ID */ - hid_t tid_cmpd2_arry; - hid_t tid_cmpd1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen; - hsize_t sdims_dset[] = {SDIM_DSET}; - hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY}; + hid_t fid = -1; /* HDF5 File ID */ + hid_t did_dset = -1; /* dataset ID */ + hid_t sid_dset = -1; /* dataset space ID */ + hid_t tid_attr = -1; + hid_t tid_cmpd3 = -1; /* compound3 type ID */ + hid_t tid_cmpd2 = -1; /* compound2 type ID */ + hid_t tid_cmpd2_arry = -1; + hid_t tid_cmpd1 = -1; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = -1; + hsize_t sdims_dset[] = { SDIM_DSET }; + hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; - unsigned i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + unsigned i, j, k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Allocate and initialize VL data to write */ - for(i = 0; i < SDIM_DSET; i++) { + for (i = 0; i < SDIM_DSET; i++) { /* compound 1 data */ - wdata[i].i1 = (int)i; + wdata[i].i1 = (int) i; wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; - for(j = 0; j < (i + 1); j++) { + for (j = 0; j < (i + 1); j++) { /* compound2 data */ - ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff; - for(k = 0; k < SDIM_CMPD_ARRAY; k++) { + ((cmpd2_t *) wdata[i].vl.p)[j].i2 = (int) i * 10 + diff; + for (k = 0; k < SDIM_CMPD_ARRAY; k++) { /* compound 3 data */ - ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff; - ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff; + ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].i3 = (int) ((float) k * 10.5F) + diff; + ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].f3 = (float) k * 10.5F + (float) diff; } /* end for */ } /* end for */ } /* end for */ /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else - fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ----------------------------- - * Create sub compound3 type */ + * Create sub compound3 type */ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t)); /* Insert fields */ @@ -4893,7 +4629,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* ----------------------------- - * Create sub compound2 type */ + * Create sub compound2 type */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT); @@ -4904,8 +4640,8 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* --------------------------- - * Create top compound1 type - */ + * Create top compound1 type + */ /* Create a VL datatype */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Insert fields */ @@ -4916,21 +4652,22 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 - */ + * Create dataset with compound1 + */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); /* Create a dataset */ - did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); @@ -4941,7 +4678,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); /* ---------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Dclose(did_dset); @@ -4962,99 +4699,95 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch assert(ret >= 0); } - /*------------------------------------------------------------------------- -* Function: test_data_nocomparables -* -* Purpose: -* Create test files with non-comparable dataset and attributes with -* comparable datasets and attributes. All the comparables should display -* differences. -* -*-------------------------------------------------------------------------*/ + * Function: test_data_nocomparables + * + * Purpose: + * Create test files with non-comparable dataset and attributes with + * comparable datasets and attributes. All the comparables should display + * differences. + * + *-------------------------------------------------------------------------*/ #define DIM_ARRY 3 -static void test_data_nocomparables (const char * fname, int make_diffs) +static void test_data_nocomparables(const char * fname, int make_diffs) { - hid_t fid=0; - hid_t gid1=0; - hid_t gid2=0; - hid_t did1=0; - hid_t did2=0; - hid_t sid1=0; - hid_t tid_dset1=0; - hid_t tid_attr1=0; - hsize_t dims1_1[1] = {DIM_ARRY}; - hsize_t dims1_2[1] = {DIM_ARRY+1}; - hsize_t dims2[2] = {DIM_ARRY, 1}; - int data1[DIM_ARRY] = {0,0,0}; - int data2[DIM_ARRY] = {1,1,1}; - int data3[DIM_ARRY+1] = {1,1,1,1}; - int data1_dim2[DIM_ARRY][1] = {{0},{0},{0}}; + hid_t fid = -1; + hid_t gid1 = -1; + hid_t gid2 = -1; + hid_t did1 = -1; + hid_t did2 = -1; + hid_t sid1 = -1; + hid_t tid_dset1 = -1; + hid_t tid_attr1 = -1; + hsize_t dims1_1[1] = { DIM_ARRY }; + hsize_t dims1_2[1] = { DIM_ARRY + 1 }; + hsize_t dims2[2] = { DIM_ARRY, 1 }; + int data1[DIM_ARRY] = { 0, 0, 0 }; + int data2[DIM_ARRY] = { 1, 1, 1 }; + int data3[DIM_ARRY + 1] = { 1, 1, 1, 1 }; + int data1_dim2[DIM_ARRY][1] = { { 0 }, { 0 }, { 0 } }; int rank_attr; - char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"}; - herr_t status = SUCCEED; - void *dset_data_ptr1=NULL; - void *dset_data_ptr2=NULL; - void *dset_data_ptr3=NULL; - void *attr_data_ptr1=NULL; - void *attr_data_ptr2=NULL; - void *attr_data_ptr3=NULL; - void *attr_data_ptr4=NULL; - void *attr2_dim_ptr=NULL; - void *attr3_dim_ptr=NULL; + char data1_str[DIM_ARRY][STR_SIZE] = { "ab", "cd", "ef" }; + herr_t status = SUCCEED; + void *dset_data_ptr1 = NULL; + void *dset_data_ptr2 = NULL; + void *dset_data_ptr3 = NULL; + void *attr_data_ptr1 = NULL; + void *attr_data_ptr2 = NULL; + void *attr_data_ptr3 = NULL; + void *attr_data_ptr4 = NULL; + void *attr2_dim_ptr = NULL; + void *attr3_dim_ptr = NULL; /* init */ - tid_dset1=H5Tcopy(H5T_NATIVE_INT); - dset_data_ptr1=(int*)&data1; - dset_data_ptr2=(int*)&data1; - dset_data_ptr3=(int*)&data1; - tid_attr1=H5Tcopy(H5T_NATIVE_INT); - attr_data_ptr1=(int*)&data1; - attr_data_ptr3=(int*)&data1; - attr_data_ptr4=(int*)&data1; - attr2_dim_ptr=(hsize_t*)&dims1_1; - attr3_dim_ptr=(hsize_t*)&dims1_1; - rank_attr=1; - - if (make_diffs) - { + tid_dset1 = H5Tcopy(H5T_NATIVE_INT); + dset_data_ptr1 = (int*) &data1; + dset_data_ptr2 = (int*) &data1; + dset_data_ptr3 = (int*) &data1; + tid_attr1 = H5Tcopy(H5T_NATIVE_INT); + attr_data_ptr1 = (int*) &data1; + attr_data_ptr3 = (int*) &data1; + attr_data_ptr4 = (int*) &data1; + attr2_dim_ptr = (hsize_t*) &dims1_1; + attr3_dim_ptr = (hsize_t*) &dims1_1; + rank_attr = 1; + + if (make_diffs) { /* ------------ - * group1 */ - tid_dset1=H5Tcopy(H5T_C_S1); - H5Tset_size(tid_dset1, (size_t)STR_SIZE); - dset_data_ptr1=(char*)&data1_str; - dset_data_ptr2=(int*)&data2; - attr_data_ptr1=(int*)&data2; + * group1 */ + tid_dset1 = H5Tcopy(H5T_C_S1); + H5Tset_size(tid_dset1, (size_t) STR_SIZE); + dset_data_ptr1 = (char*) &data1_str; + dset_data_ptr2 = (int*) &data2; + attr_data_ptr1 = (int*) &data2; /* ----------- - * group2 - */ - dset_data_ptr3=(int*)&data2; + * group2 + */ + dset_data_ptr3 = (int*) &data2; /* dset1/attr1 */ - tid_attr1=H5Tcopy(H5T_C_S1); - H5Tset_size(tid_attr1, (size_t)STR_SIZE); - attr_data_ptr2=(char*)&data1_str; + tid_attr1 = H5Tcopy(H5T_C_S1); + H5Tset_size(tid_attr1, (size_t) STR_SIZE); + attr_data_ptr2 = (char*) &data1_str; /* dset1/attr2 */ - attr2_dim_ptr=(hsize_t*)&dims1_2; + attr2_dim_ptr = (hsize_t*) &dims1_2; /* dset1/attr3 */ - attr_data_ptr3=(int*)&data1_dim2; - attr3_dim_ptr=(hsize_t*)&dims2; - rank_attr=2; + attr_data_ptr3 = (int*) &data1_dim2; + attr3_dim_ptr = (hsize_t*) &dims2; + rank_attr = 2; /* dset1/attr4 */ - attr_data_ptr4=(int*)&data2; + attr_data_ptr4 = (int*) &data2; } - - /*----------------------------------------------------------------------- + /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid < 0) - { + fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid < 0) { fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname); status = FAIL; goto out; @@ -5064,16 +4797,14 @@ static void test_data_nocomparables (const char * fname, int make_diffs) * Groups *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); status = FAIL; goto out; } gid2 = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); status = FAIL; goto out; @@ -5082,29 +4813,26 @@ static void test_data_nocomparables (const char * fname, int make_diffs) /*----------------------------------------------------------------------- * Datasets in /g1 *------------------------------------------------------------------------*/ - if((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0) - goto out; + if ((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0) + goto out; /* dset1 */ - if((did1 = H5Dcreate2(gid1, "dset1", tid_dset1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + if ((did1 = H5Dcreate2(gid1, "dset1", tid_dset1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); status = FAIL; goto out; } - if(H5Dwrite(did1, tid_dset1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr1) < 0) - { + if (H5Dwrite(did1, tid_dset1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr1) < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); status = FAIL; goto out; } - write_attr(did1,1,dims1_1,"attr", H5T_NATIVE_INT, attr_data_ptr1); + write_attr(did1, 1, dims1_1, "attr", H5T_NATIVE_INT, attr_data_ptr1); /* dset2 */ - status = write_dset(gid1, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr2); - if (status == FAIL) - { + status = write_dset(gid1, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname); goto out; } @@ -5113,108 +4841,100 @@ static void test_data_nocomparables (const char * fname, int make_diffs) * Datasets in /g2 *------------------------------------------------------------------------*/ /* --------- - * dset1 */ - if((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - { + * dset1 */ + if ((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); status = FAIL; goto out; } - if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr3) < 0) - { + if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr3) < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); status = FAIL; goto out; } /* attr1 - non-compatible : different type */ - write_attr(did2,1,dims1_1,"attr1", tid_attr1, attr_data_ptr2); - + write_attr(did2, 1, dims1_1, "attr1", tid_attr1, attr_data_ptr2); /* attr2 - non-compatible : same rank, different dimention */ - write_attr(did2,1,(hsize_t *)attr2_dim_ptr,"attr2", H5T_NATIVE_INT, data3); + write_attr(did2, 1, (hsize_t *) attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3); /* attr3 - non-compatible : different rank */ - write_attr(did2, rank_attr,(hsize_t *)attr3_dim_ptr,"attr3", H5T_NATIVE_INT, attr_data_ptr3); + write_attr(did2, rank_attr, (hsize_t *) attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3); /* attr4 - compatible : different data values */ - write_attr(did2,1,dims1_1,"attr4", H5T_NATIVE_INT, attr_data_ptr4); + write_attr(did2, 1, dims1_1, "attr4", H5T_NATIVE_INT, attr_data_ptr4); /*---------- - * dset2 */ - status = write_dset(gid2, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr3); - if (status == FAIL) - { + * dset2 */ + status = write_dset(gid2, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr3); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname); goto out; } - - out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if(fid) + if (fid) H5Fclose(fid); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(did1) + if (did1) H5Dclose(did1); - if(did2) + if (did2) H5Dclose(did2); - if(sid1) + if (sid1) H5Sclose(sid1); - if(tid_dset1) + if (tid_dset1) H5Tclose(tid_dset1); - if(tid_attr1) + if (tid_attr1) H5Tclose(tid_attr1); } /*------------------------------------------------------------------------- -* Function: test_objs_nocomparables -* -* Purpose: -* Create test files with common objects (same name) but different object -* types. -* h5diff should show non-comparable output from these common objects. -*-------------------------------------------------------------------------*/ + * Function: test_objs_nocomparables + * + * Purpose: + * Create test files with common objects (same name) but different object + * types. + * h5diff should show non-comparable output from these common objects. + *-------------------------------------------------------------------------*/ static void test_objs_nocomparables(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; - hid_t fid1=0; - hid_t fid2=0; - hid_t topgid1=0; - hid_t topgid2=0; - hid_t gid1=0; - hid_t did1=0; - hid_t tid1=0; - hid_t gid2=0; - hid_t did2=0; - hid_t tid2=0; - hsize_t dims[1] = {DIM_ARRY}; - int data1[DIM_ARRY] = {1,1,1}; - int data2[DIM_ARRY] = {2,2,2}; - - /*----------------------------------------------------------------------- + herr_t status = SUCCEED; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t topgid1 = -1; + hid_t topgid2 = -1; + hid_t gid1 = -1; + hid_t did1 = -1; + hid_t tid1 = -1; + hid_t gid2 = -1; + hid_t did2 = -1; + hid_t tid2 = -1; + hsize_t dims[1] = { DIM_ARRY }; + int data1[DIM_ARRY] = { 1, 1, 1 }; + int data2[DIM_ARRY] = { 2, 2, 2 }; + + /*----------------------------------------------------------------------- * Open file(s) to add objects *------------------------------------------------------------------------*/ /* file1 */ - fid1 = H5Fopen (fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) - { + fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid1 < 0) { fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); status = FAIL; goto out; } /* file2 */ - fid2 = H5Fopen (fname2, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid2 < 0) - { + fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid2 < 0) { fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); status = FAIL; goto out; @@ -5225,25 +4945,22 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* parent group */ topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid1 < 0) - { + if (topgid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } /* dataset */ - status = write_dset(topgid1, 1, dims,"obj1", H5T_NATIVE_INT, data1); - if (status == FAIL) - { + status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname1); goto out; } /* group */ gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) - { + if (gid1 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; @@ -5252,8 +4969,7 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) /* committed type */ tid1 = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); goto out; } @@ -5263,8 +4979,7 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* parent group */ topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid2 < 0) - { + if (topgid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -5272,8 +4987,7 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) /* group */ gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) - { + if (gid2 < 0) { fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; @@ -5282,16 +4996,14 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) /* committed type */ tid2 = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { + if (status < 0) { fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); goto out; } /* dataset */ - status = write_dset(topgid2, 1, dims,"obj3", H5T_NATIVE_INT, data2); - if (status == FAIL) - { + status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2); + if (status == FAIL) { fprintf(stderr, "Error: %s> write_dset failed\n", fname2); goto out; } @@ -5300,113 +5012,109 @@ out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); - if(topgid1) + if (topgid1) H5Gclose(topgid1); - if(topgid2) + if (topgid2) H5Gclose(topgid2); - if(did1) + if (did1) H5Dclose(did1); - if(did2) + if (did2) H5Dclose(did2); - if(gid1) + if (gid1) H5Gclose(gid1); - if(gid2) + if (gid2) H5Gclose(gid2); - if(tid1) + if (tid1) H5Tclose(tid1); - if(tid2) + if (tid2) H5Tclose(tid2); } -static hid_t mkstr(int size, H5T_str_t pad) { +static hid_t mkstr(int size, H5T_str_t pad) +{ hid_t type; - if((type=H5Tcopy(H5T_C_S1)) < 0) return -1; - if(H5Tset_size(type, (size_t)size) < 0) return -1; - if(H5Tset_strpad(type, pad) < 0) return -1; + if ((type = H5Tcopy(H5T_C_S1)) < 0) + return -1; + if (H5Tset_size(type, (size_t) size) < 0) + return -1; + if (H5Tset_strpad(type, pad) < 0) + return -1; return type; } /*------------------------------------------------------------------------- -* Function: test_objs_strings -* -* Purpose: -* Create test files with common objects (same name) but different string -* types. -* h5diff should show differences output from these common objects. -*-------------------------------------------------------------------------*/ + * Function: test_objs_strings + * + * Purpose: + * Create test files with common objects (same name) but different string + * types. + * h5diff should show differences output from these common objects. + *-------------------------------------------------------------------------*/ static void test_objs_strings(const char *fname1, const char *fname2) { - hid_t fid1=0; - hid_t fid2=0; - hid_t dataset=0; - hid_t space=0; - hid_t f_type=0; - hid_t m_type=0; - hsize_t dims1[] = {3, 4}; - char string1A[12][3] = {"s1","s2","s3","s4","s5","s6","s","s","s9", - "s0","s1","s2"}; - char string1B[12][3] = {"s1","s2","s3","s4","s","s","s7","s8","s9", - "s0","s1","s2"}; - - hsize_t dims2[]={20}; - char string2A[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", - "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", - "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6", - "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; - char string2B[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", - "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", - "ab cd 3", "ab cd 4", "ab cd 5", "ab cd 6", - "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; - - hsize_t dims3[] = {27}; - char string3A[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", - "abcd4", "abcd5", "abcd6", "abcd7", - "abcd8", "abcd9", "abcd0", "abcd1", - "abd2", "abc3", "bcd4", "acd5", - "abcd6", "abcd7", "abcd8", "abcd9", - "abcd0", "abcd1", "abcd2", "abcd3", - "abc4", "abc5", "abc6"}; - char string3B[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", - "abcd4", "abcd5", "abcd6", "abcd7", - "abcd8", "abcd9", "abcd0", "abcd1", - "abcd2", "abcd3", "abcd4", "abcd5", - "abd6", "abc7", "bcd8", "acd9", - "abcd0", "abcd1", "abcd2", "abcd3", - "abd4", "abd5", "abd6"}; - - hsize_t dims4[] = {3}; + hid_t fid1 = -1; + hid_t fid2 = -1; + hid_t dataset = -1; + hid_t space = -1; + hid_t f_type = -1; + hid_t m_type = -1; + hsize_t dims1[] = { 3, 4 }; + char string1A[12][3] = { "s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9", + "s0", "s1", "s2" }; + char string1B[12][3] = { "s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9", + "s0", "s1", "s2" }; + + hsize_t dims2[] = { 20 }; + char string2A[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3", + "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", "ab cd ef3", + "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0" }; + char string2B[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3", + "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", "ab cd 3", + "ab cd 4", "ab cd 5", "ab cd 6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0" }; + + hsize_t dims3[] = { 27 }; + char string3A[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", + "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1", + "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7", "abcd8", "abcd9", + "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6" }; + char string3B[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", + "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1", + "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7", "bcd8", "acd9", + "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6" }; + + hsize_t dims4[] = { 3 }; char string4A[3][21] = { "s1234567890123456789", "s1234567890123456789", - "s12345678901234567"}; + "s12345678901234567" }; char string4B[3][21] = { "s1234567890123456789", "s12345678901234567", - "s1234567890123456789"}; + "s1234567890123456789" }; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ - /* file1 */ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) - { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); - goto out; - } - - /* file2 */ - fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid2 < 0) - { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); - goto out; - } + * Create file(s) + *------------------------------------------------------------------------*/ + /* file1 */ + fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + goto out; + } + + /* file2 */ + fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + goto out; + } /* string 1 : nullterm string */ space = H5Screate_simple(2, dims1, NULL); @@ -5496,88 +5204,82 @@ out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if(fid1) + if (fid1) H5Fclose(fid1); - if(fid2) + if (fid2) H5Fclose(fid2); } /*------------------------------------------------------------------------- -* Function: write_attr_in -* -* Purpose: write attributes in LOC_ID (dataset, group, named datatype) -* -*------------------------------------------------------------------------- -*/ + * Function: write_attr_strings + * + * Purpose: write attributes in LOC_ID (dataset, group, named datatype) + * swap VL strings + * + *------------------------------------------------------------------------- + */ static -void write_attr_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t fid, - int make_diffs /* flag to modify data buffers */) +void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t - { - char a; + typedef struct s_t { + char a; double b; } s_t; - typedef enum - { - RED, - GREEN + typedef enum { + RED, GREEN } e_t; - hid_t aid; - hid_t sid; - hid_t tid; - herr_t status; - int val, i, j, k, l, n; - float f; + hid_t aid = -1; + hid_t sid = -1; + hid_t tid = -1; + herr_t status; + int val, i, j, k, l, n; + float f; /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ - char *buf1a[2]; /* VL string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2]= {RED,RED}; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1.0F, 2.0F}; /* float */ + hsize_t dims[1] = { 2 }; + char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ + char *buf1a[2]; /* VL string */ + char buf2[2] = { 1, 2 }; /* bitfield, opaque */ + s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = { RED, RED }; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = { 3 }; /* array dimension */ + int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ + int buf7[2] = { 1, 2 }; /* integer */ + float buf8[2] = { 1.0F, 2.0F }; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - e_t buf452[3][2]; /* enum */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */ + hsize_t dims2[2] = { 3, 2 }; + char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ + char *buf12a[3][2]; /* VL string */ + char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ + s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ + int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ + float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, - {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, - {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, - {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ - char *buf13a[4][3][2]; /* VL string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - e_t buf453[4][3][2]; /* enum */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - + hsize_t dims3[3] = { 4, 3, 2 }; + char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, + { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, + { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, + { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ + char *buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + e_t buf453[4][3][2]; /* enum */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ /*------------------------------------------------------------------------- * 1D attributes @@ -5590,15 +5292,10 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - for (j=0; j<2; j++) - { - buf1[i][j]='z'; - } - } - } + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + buf1[i][j] = 'z'; + /* buf1[2][2]= {"ab","de"}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -5611,16 +5308,17 @@ void write_attr_in(hid_t loc_id, [ 1 ] d z [ 1 ] e z */ + for (i = 0; i < 2; i++) + buf1a[i] = buf1[i]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t)STR_SIZE); - write_attr(loc_id,1,dims,"string",tid,buf1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 1, dims, "string", tid, buf1a); status = H5Tclose(tid); - for (i=0; i<2; i++) - buf1a[i]=buf1[i]; tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_attr(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tset_size(tid, (size_t)STR_SIZE); + write_attr(loc_id, 1, dims, "VLstring", tid, buf1); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5629,10 +5327,8 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - buf2[i]=buf2[1]=0; - } + for (i = 0; i < 2; i++) + buf2[i] = buf2[1] = 0; /* buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v @@ -5646,7 +5342,7 @@ void write_attr_in(hid_t loc_id, */ tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,1,dims,"bitfield",tid,buf2); + write_attr(loc_id, 1, dims, "bitfield", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5666,9 +5362,9 @@ void write_attr_in(hid_t loc_id, [ 1 ] 2 0 2 */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,1,dims,"opaque",tid,buf2); + write_attr(loc_id, 1, dims, "opaque", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5677,12 +5373,10 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - buf3[i].a=0; buf3[i].b=0; + for (i = 0; i < 2; i++) { + buf3[i].a = 0; + buf3[i].b = 0; } - } /* buf3[2]= {{1,2},{3,4}}; @@ -5697,10 +5391,10 @@ void write_attr_in(hid_t loc_id, [ 1 ] 4 5 1 */ - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,1,dims,"compound",tid,buf3); + write_attr(loc_id, 1, dims, "compound", tid, buf3); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5708,70 +5402,64 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); - write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + if (dset_name) { + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ + * H5T_ENUM + *------------------------------------------------------------------------- + */ if (make_diffs) - { - for (i=0; i<2; i++) - { - buf45[i]=GREEN; - } - } + for (i = 0; i < 2; i++) + buf45[i] = GREEN; /* - buf45[2]= {RED,RED}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: and - Attribute: and - position enum of enum of difference - ------------------------------------------------------------ - [ 0 ] RED GREEN - [ 1 ] RED GREEN - */ + buf45[2]= {RED,RED}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position enum of enum of difference + ------------------------------------------------------------ + [ 0 ] RED GREEN + [ 1 ] RED GREEN + */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,1,dims,"enum",tid,buf45); + write_attr(loc_id, 1, dims, "enum", tid, buf45); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + * H5T_VLEN + *------------------------------------------------------------------------- + */ /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *) buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0]=2; - ((int *)buf5[1].p)[1]=3; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *) buf5[1].p)[0] = 2; + ((int *) buf5[1].p)[1] = 3; - if (make_diffs) - { - ((int *)buf5[0].p)[0]=0; - ((int *)buf5[1].p)[0]=0; - ((int *)buf5[1].p)[1]=0; + if (make_diffs) { + ((int *) buf5[0].p)[0] = 0; + ((int *) buf5[1].p)[0] = 0; + ((int *) buf5[1].p)[1] = 0; } /* - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: and - position vlen of vlen of difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - [ 1 ] 3 0 3 - */ + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + position vlen of vlen of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + [ 1 ] 3 0 3 + */ sid = H5Screate_simple(1, dims, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); @@ -5785,31 +5473,1016 @@ void write_attr_in(hid_t loc_id, status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ + * H5T_ARRAY + *------------------------------------------------------------------------- + */ if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<3; j++) - { - buf6[i][j]=0; - } - } + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + buf6[i][j] = 0; /* - buf6[2][3]= {{1,2,3},{4,5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: and - Attribute: and - position array of array of difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 0 ] 2 0 2 - [ 0 ] 3 0 3 - [ 1 ] 4 0 4 - [ 1 ] 5 0 5 - [ 1 ] 6 0 6 + buf6[2][3]= {{1,2,3},{4,5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position array of array of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 0 ] 2 0 2 + [ 0 ] 3 0 3 + [ 1 ] 4 0 4 + [ 1 ] 5 0 5 + [ 1 ] 6 0 6 + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 1, dims, "array", tid, buf6); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) { + buf7[i] = 0; + buf8[i] = 0; + } + /* + buf7[2]= {1,2}; + buf8[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + position integer of integer of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + position float of float of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); + + /*------------------------------------------------------------------------- + * 2D attributes + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + if (make_diffs) + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + for (k = 0; k < 2; k++) + buf12[i][j][k] = 'z'; + + /* + buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position string2D of string2D of difference + ------------------------------------------------------------ + [ 0 0 ] a z + [ 0 0 ] b z + [ 0 1 ] c z + [ 0 1 ] d z + [ 1 0 ] e z + [ 1 0 ] f z + [ 1 1 ] g z + [ 1 1 ] h z + [ 2 0 ] i z + [ 2 0 ] j z + [ 2 1 ] k z + [ 2 1 ] l z + */ + + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + buf12a[i][j] = buf12[i][j]; + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 2, dims2, "string2D", tid, buf12a); + status = H5Tclose(tid); + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + + if (make_diffs) + memset(buf22, 0, sizeof buf22); + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position bitfield2D of bitfield2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position opaque2D of opaque2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + if (make_diffs) + memset(buf32, 0, sizeof buf32); + + /* + buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position opaque2D of opaque2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id, 2, dims2, "compound2D", tid, buf32); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if (dset_name) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, + (hid_t) -1); + write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); + } + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + if (make_diffs) + buf452[i][j] = GREEN; + else + buf452[i][j] = RED; + + /* + Attribute: and + position enum2D of enum2D of difference + ------------------------------------------------------------ + [ 0 0 ] RED GREEN + [ 0 1 ] RED GREEN + [ 1 0 ] RED GREEN + [ 1 1 ] RED GREEN + [ 2 0 ] RED GREEN + [ 2 1 ] RED GREEN + */ + + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id, 2, dims2, "enum2D", tid, buf452); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + n = 0; + for (i = 0; i < 3; i++) { + for (j = 0; j < 2; j++) { + buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].len = (size_t)(i + 1); + for (l = 0; l < i + 1; l++) + if (make_diffs) + ((int *) buf52[i][j].p)[l] = 0; + else + ((int *) buf52[i][j].p)[l] = n++; + } + } + + /* + position vlen2D of vlen2D of difference + ------------------------------------------------------------ + [ 0 1 ] 1 0 1 + [ 1 0 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 1 1 ] 5 0 5 + [ 2 0 ] 6 0 6 + [ 2 0 ] 7 0 7 + [ 2 0 ] 8 0 8 + [ 2 1 ] 9 0 9 + [ 2 1 ] 10 0 10 + [ 2 1 ] 11 0 11 + */ + + sid = H5Screate_simple(2, dims2, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf52); + assert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); + assert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + + if (make_diffs) + memset(buf62, 0, sizeof buf62); + /* + buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position array2D of array2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 0 ] 2 0 2 + [ 0 0 ] 3 0 3 + [ 0 1 ] 4 0 4 + [ 0 1 ] 5 0 5 + [ 0 1 ] 6 0 6 + [ 1 0 ] 7 0 7 + [ 1 0 ] 8 0 8 + [ 1 0 ] 9 0 9 + [ 1 1 ] 10 0 10 + [ 1 1 ] 11 0 11 + [ 1 1 ] 12 0 12 + [ 2 0 ] 13 0 13 + [ 2 0 ] 14 0 14 + [ 2 0 ] 15 0 15 + [ 2 1 ] 16 0 16 + [ 2 1 ] 17 0 17 + [ 2 1 ] 18 0 18 + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 2, dims2, "array2D", tid, buf62); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + + if (make_diffs) { + memset(buf72, 0, sizeof buf72); + memset(buf82, 0, sizeof buf82); + } + /* + Attribute: and + position integer2D of integer2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + 6 differences found + Attribute: and + position float2D of float2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72); + write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); + + /*------------------------------------------------------------------------- + * 3D attributes + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + for (l = 0; l < 2; l++) + buf13[i][j][k][l] = 'z'; + + /* + buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + "rs","tu","vw","xz","AB","CD","EF","GH", + "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; + + Attribute: and + position string3D of string3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] a z + [ 0 0 0 ] b z + [ 0 0 1 ] c z + [ 0 0 1 ] d z + [ 0 1 0 ] e z + [ 0 1 0 ] f z + [ 0 1 1 ] g z + [ 0 1 1 ] h z + [ 0 2 0 ] i z + [ 0 2 0 ] j z + [ 0 2 1 ] k z + [ 0 2 1 ] l z + [ 1 0 0 ] m z + [ 1 0 0 ] n z + [ 1 0 1 ] p z + [ 1 0 1 ] q z + [ 1 1 0 ] r z + [ 1 1 0 ] s z + [ 1 1 1 ] t z + [ 1 1 1 ] u z + [ 1 2 0 ] v z + [ 1 2 0 ] w z + [ 1 2 1 ] x z + [ 2 0 0 ] A z + [ 2 0 0 ] B z + [ 2 0 1 ] C z + [ 2 0 1 ] D z + [ 2 1 0 ] E z + [ 2 1 0 ] F z + [ 2 1 1 ] G z + [ 2 1 1 ] H z + [ 2 2 0 ] I z + [ 2 2 0 ] J z + [ 2 2 1 ] K z + [ 2 2 1 ] L z + [ 3 0 0 ] M z + [ 3 0 0 ] N z + [ 3 0 1 ] P z + [ 3 0 1 ] Q z + [ 3 1 0 ] R z + [ 3 1 0 ] S z + [ 3 1 1 ] T z + [ 3 1 1 ] U z + [ 3 2 0 ] V z + [ 3 2 0 ] W z + [ 3 2 1 ] X z + [ 3 2 1 ] Z z + */ + + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + buf13a[i][j][k] = buf13[i][j][k]; + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 3, dims3, "string3D", tid, buf13a); + status = H5Tclose(tid); + + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + if (make_diffs) + buf23[i][j][k] = 0; + else + buf23[i][j][k] = (char) n++; + + /* + position bitfield3D of bitfield3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + [ 1 2 0 ] 11 0 11 + [ 1 2 1 ] 12 0 12 + [ 2 0 0 ] 13 0 13 + [ 2 0 1 ] 14 0 14 + [ 2 1 0 ] 15 0 15 + [ 2 1 1 ] 16 0 16 + [ 2 2 0 ] 17 0 17 + [ 2 2 1 ] 18 0 18 + [ 3 0 0 ] 19 0 19 + [ 3 0 1 ] 20 0 20 + [ 3 1 0 ] 21 0 21 + [ 3 1 1 ] 22 0 22 + [ 3 2 0 ] 23 0 23 + [ 3 2 1 ] 24 0 24 + */ + + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + if (make_diffs) { + buf33[i][j][k].a = 0; + buf33[i][j][k].b = 0.0F; + } else { + buf33[i][j][k].a = (char) n++; + buf33[i][j][k].b = n++; + } + /*position compound3D of compound3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 1 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 1 0 ] 5 0 5 + [ 0 1 0 ] 6 0 6 + [ 0 1 1 ] 7 0 7 + [ 0 1 1 ] 8 0 8 + [ 0 2 0 ] 9 0 9 + [ 0 2 0 ] 10 0 10 + [ 0 2 1 ] 11 0 11 + [ 0 2 1 ] 12 0 12 + [ 1 0 0 ] 13 0 13 + [ 1 0 0 ] 14 0 14 + [ 1 0 1 ] 15 0 15 + [ 1 0 1 ] 16 0 16 + [ 1 1 0 ] 17 0 17 + [ 1 1 0 ] 18 0 18 + [ 1 1 1 ] 19 0 19 + [ 1 1 1 ] 20 0 20 + [ 1 2 0 ] 21 0 21 + [ 1 2 0 ] 22 0 22 + [ 1 2 1 ] 23 0 23 + [ 1 2 1 ] 24 0 24 + [ 2 0 0 ] 25 0 25 + [ 2 0 0 ] 26 0 26 + [ 2 0 1 ] 27 0 27 + [ 2 0 1 ] 28 0 28 + [ 2 1 0 ] 29 0 29 + [ 2 1 0 ] 30 0 30 + [ 2 1 1 ] 31 0 31 + [ 2 1 1 ] 32 0 32 + [ 2 2 0 ] 33 0 33 + [ 2 2 0 ] 34 0 34 + [ 2 2 1 ] 35 0 35 + [ 2 2 1 ] 36 0 36 + [ 3 0 0 ] 37 0 37 + [ 3 0 0 ] 38 0 38 + [ 3 0 1 ] 39 0 39 + [ 3 0 1 ] 40 0 40 + [ 3 1 0 ] 41 0 41 + [ 3 1 0 ] 42 0 42 + [ 3 1 1 ] 43 0 43 + [ 3 1 1 ] 44 0 44 + [ 3 2 0 ] 45 0 45 + [ 3 2 0 ] 46 0 46 + [ 3 2 1 ] 47 0 47 + [ 3 2 1 ] 48 0 48 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id, 3, dims3, "compound3D", tid, buf33); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if (dset_name) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, + H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); + } + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + if (make_diffs) + buf453[i][j][k] = RED; + else + buf453[i][j][k] = GREEN; + + /* + position enum3D of enum3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] GREEN RED + [ 0 0 1 ] GREEN RED + [ 0 1 0 ] GREEN RED + [ 0 1 1 ] GREEN RED + [ 0 2 0 ] GREEN RED + [ 0 2 1 ] GREEN RED + [ 1 0 0 ] GREEN RED + [ 1 0 1 ] GREEN RED + [ 1 1 0 ] GREEN RED + [ 1 1 1 ] GREEN RED + [ 1 2 0 ] GREEN RED + [ 1 2 1 ] GREEN RED + [ 2 0 0 ] GREEN RED + [ 2 0 1 ] GREEN RED + [ 2 1 0 ] GREEN RED + [ 2 1 1 ] GREEN RED + [ 2 2 0 ] GREEN RED + [ 2 2 1 ] GREEN RED + [ 3 0 0 ] GREEN RED + [ 3 0 1 ] GREEN RED + [ 3 1 0 ] GREEN RED + [ 3 1 1 ] GREEN RED + [ 3 2 0 ] GREEN RED + [ 3 2 1 ] GREEN RED + */ + + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id, 3, dims3, "enum3D", tid, buf453); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + n = 0; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) { + buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].len = (size_t)(i + 1); + for (l = 0; l < i + 1; l++) + if (make_diffs) + ((int *) buf53[i][j][k].p)[l] = 0; + else + ((int *) buf53[i][j][k].p)[l] = n++; + } + /* + position vlen3D of vlen3D of difference + ------------------------------------------------------------ + [ 0 0 1 ] 1 0 1 + [ 0 1 0 ] 2 0 2 + [ 0 1 1 ] 3 0 3 + [ 0 2 0 ] 4 0 4 + [ 0 2 1 ] 5 0 5 + [ 1 0 0 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 0 1 ] 9 0 9 + [ 1 1 0 ] 10 0 10 + etc + */ + sid = H5Screate_simple(3, dims3, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf53); + assert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); + assert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + n = 1; + for (i = 0; i < 24; i++) { + for (j = 0; j < (int) dimarray[0]; j++) { + if (make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; + } + } + /* + position array3D of array3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 0 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 0 1 ] 5 0 5 + [ 0 0 1 ] 6 0 6 + [ 0 1 0 ] 7 0 7 + etc + */ + + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 3, dims3, "array3D", tid, buf63); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + n = 1; + f = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) { + if (make_diffs) { + buf73[i][j][k] = 0; + buf83[i][j][k] = 0.0F; + } + else { + buf73[i][j][k] = n++; + buf83[i][j][k] = f++; + } + } + + /* + position integer3D of integer3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + etc + */ + write_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73); + write_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83); +} + +/*------------------------------------------------------------------------- + * Function: write_attr_in + * + * Purpose: write attributes in LOC_ID (dataset, group, named datatype) + * + *------------------------------------------------------------------------- + */ +static +void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) +{ + /* Compound datatype */ + typedef struct s_t { + char a; + double b; + } s_t; + + typedef enum { + RED, GREEN + } e_t; + + hid_t aid = -1; + hid_t sid = -1; + hid_t tid = -1; + herr_t status; + int val, i, j, k, l, n; + float f; + + /* create 1D attributes with dimension [2], 2 elements */ + hsize_t dims[1] = { 2 }; + char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ + char *buf1a[2]; /* VL string */ + char buf2[2] = { 1, 2 }; /* bitfield, opaque */ + s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = { RED, RED }; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = { 3 }; /* array dimension */ + int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ + int buf7[2] = { 1, 2 }; /* integer */ + float buf8[2] = { 1.0F, 2.0F }; /* float */ + + /* create 2D attributes with dimension [3][2], 6 elements */ + hsize_t dims2[2] = { 3, 2 }; + char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ + char *buf12a[3][2]; /* VL string */ + char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ + s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ + int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ + float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ + + /* create 3D attributes with dimension [4][3][2], 24 elements */ + hsize_t dims3[3] = { 4, 3, 2 }; + char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, + { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, + { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, + { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ + char *buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + e_t buf453[4][3][2]; /* enum */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ + + /*------------------------------------------------------------------------- + * 1D attributes + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + buf1[i][j] = 'z'; + /* + buf1[2][2]= {"ab","de"}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position string of string of difference + ------------------------------------------------------------ + [ 0 ] a z + [ 0 ] b z + [ 1 ] d z + [ 1 ] e z + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 1, dims, "string", tid, buf1); + status = H5Tclose(tid); + + for (i = 0; i < 2; i++) + buf1a[i] = buf1[i]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 1, dims, "VLstring", tid, buf1a); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) + buf2[i] = buf2[1] = 0; + /* + buf2[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position bitfield of bitfield of difference + position opaque of opaque of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id, 1, dims, "bitfield", tid, buf2); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + + /* + buf2[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position opaque of opaque of difference + position opaque of opaque of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id, 1, dims, "opaque", tid, buf2); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + + if (make_diffs) + for (i = 0; i < 2; i++) { + buf3[i].a = 0; + buf3[i].b = 0; + } + /* + buf3[2]= {{1,2},{3,4}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position compound of compound of difference + ------------------------------------------------------------ + [ 0 ] 1 5 4 + [ 0 ] 2 5 3 + [ 1 ] 3 5 2 + [ 1 ] 4 5 1 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id, 1, dims, "compound", tid, buf3); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if (dset_name) { + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); + } + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + if (make_diffs) + for (i = 0; i < 2; i++) + buf45[i] = GREEN; + /* + buf45[2]= {RED,RED}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position enum of enum of difference + ------------------------------------------------------------ + [ 0 ] RED GREEN + [ 1 ] RED GREEN + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id, 1, dims, "enum", tid, buf45); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + + buf5[0].len = 1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *) buf5[0].p)[0] = 1; + buf5[1].len = 2; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *) buf5[1].p)[0] = 2; + ((int *) buf5[1].p)[1] = 3; + + if (make_diffs) { + ((int *) buf5[0].p)[0] = 0; + ((int *) buf5[1].p)[0] = 0; + ((int *) buf5[1].p)[1] = 0; + } + /* + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + position vlen of vlen of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + [ 1 ] 3 0 3 + */ + + sid = H5Screate_simple(1, dims, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf5); + assert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); + assert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + + if (make_diffs) { + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + buf6[i][j] = 0; + } + /* + buf6[2][3]= {{1,2,3},{4,5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position array of array of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 0 ] 2 0 2 + [ 0 ] 3 0 3 + [ 1 ] 4 0 4 + [ 1 ] 5 0 5 + [ 1 ] 6 0 6 */ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_attr(loc_id, 1, dims, "array", tid, buf6); @@ -5820,31 +6493,28 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf7[i]=0; - buf8[i]=0; + if (make_diffs) { + for (i = 0; i < 2; i++) { + buf7[i] = 0; + buf8[i] = 0; } } /* - buf7[2]= {1,2}; - buf8[2]= {1,2}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: and - position integer of integer of difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - position float of float of difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - */ - write_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - write_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); - + buf7[2]= {1,2}; + buf8[2]= {1,2}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + position integer of integer of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + position float of float of difference + ------------------------------------------------------------ + [ 0 ] 1 0 1 + [ 1 ] 2 0 2 + */ + write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); /*------------------------------------------------------------------------- * 2D attributes @@ -5855,50 +6525,45 @@ void write_attr_in(hid_t loc_id, * H5T_STRING *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<3; i++) - for (j=0; j<2; j++) - for (k=0; k<2; k++) - buf12[i][j][k]='z'; + if (make_diffs) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + for (k = 0; k < 2; k++) + buf12[i][j][k] = 'z'; } /* - buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: and - position string2D of string2D of difference - ------------------------------------------------------------ - [ 0 0 ] a z - [ 0 0 ] b z - [ 0 1 ] c z - [ 0 1 ] d z - [ 1 0 ] e z - [ 1 0 ] f z - [ 1 1 ] g z - [ 1 1 ] h z - [ 2 0 ] i z - [ 2 0 ] j z - [ 2 1 ] k z - [ 2 1 ] l z + buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position string2D of string2D of difference + ------------------------------------------------------------ + [ 0 0 ] a z + [ 0 0 ] b z + [ 0 1 ] c z + [ 0 1 ] d z + [ 1 0 ] e z + [ 1 0 ] f z + [ 1 1 ] g z + [ 1 1 ] h z + [ 2 0 ] i z + [ 2 0 ] j z + [ 2 1 ] k z + [ 2 1 ] l z */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t)STR_SIZE); - write_attr(loc_id,2,dims2,"string2D",tid,buf12); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 2, dims2, "string2D", tid, buf12); status = H5Tclose(tid); - for (i=0; i<3; i++) - { - for (j=0; j<2; j++) - { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + buf12a[i][j] = buf12[i][j]; - buf12a[i][j]=buf12[i][j]; - } - } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_attr(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5907,27 +6572,23 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf22,0,sizeof buf22); - } - + memset(buf22, 0, sizeof buf22); /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: and - position bitfield2D of bitfield2D of difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position bitfield2D of bitfield2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 */ - tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22); + write_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5936,21 +6597,21 @@ void write_attr_in(hid_t loc_id, */ /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: and - position opaque2D of opaque2D of difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + buf22[3][2]= {{1,2},{3,4},{5,6}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position opaque2D of opaque2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,2,dims2,"opaque2D",tid,buf22); + write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5958,29 +6619,25 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ if (make_diffs) - { - memset(buf32,0,sizeof buf32); - } - + memset(buf32, 0, sizeof buf32); /* - buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: and - position opaque2D of opaque2D of difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - - - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Attribute: and + position opaque2D of opaque2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,2,dims2,"compound2D",tid,buf32); + write_attr(loc_id, 2, dims2, "compound2D", tid, buf32); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -5988,44 +6645,41 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 3; i++) { - for (j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + if (dset_name) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); } /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ - for (i=0; i<3; i++) - { - for (j=0; j<2; j++) - { - if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) { + if (make_diffs) + buf452[i][j] = GREEN; + else + buf452[i][j] = RED; } - } /* - Attribute: and - position enum2D of enum2D of difference - ------------------------------------------------------------ - [ 0 0 ] RED GREEN - [ 0 1 ] RED GREEN - [ 1 0 ] RED GREEN - [ 1 1 ] RED GREEN - [ 2 0 ] RED GREEN - [ 2 1 ] RED GREEN + Attribute: and + position enum2D of enum2D of difference + ------------------------------------------------------------ + [ 0 0 ] RED GREEN + [ 0 1 ] RED GREEN + [ 1 0 ] RED GREEN + [ 1 1 ] RED GREEN + [ 2 0 ] RED GREEN + [ 2 1 ] RED GREEN */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,2,dims2,"enum2D",tid,buf452); + write_attr(loc_id, 2, dims2, "enum2D", tid, buf452); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6034,33 +6688,33 @@ void write_attr_in(hid_t loc_id, */ /* Allocate and initialize VL dataset to write */ - n=0; - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { + n = 0; + for (i = 0; i < 3; i++) { + for (j = 0; j < 2; j++) { buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) - if(make_diffs) - ((int *)buf52[i][j].p)[l] = 0; + for (l = 0; l < i + 1; l++) + if (make_diffs) + ((int *) buf52[i][j].p)[l] = 0; else - ((int *)buf52[i][j].p)[l] = n++; + ((int *) buf52[i][j].p)[l] = n++; } } /* - position vlen2D of vlen2D of difference - ------------------------------------------------------------ - [ 0 1 ] 1 0 1 - [ 1 0 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 1 1 ] 5 0 5 - [ 2 0 ] 6 0 6 - [ 2 0 ] 7 0 7 - [ 2 0 ] 8 0 8 - [ 2 1 ] 9 0 9 - [ 2 1 ] 10 0 10 - [ 2 1 ] 11 0 11 + position vlen2D of vlen2D of difference + ------------------------------------------------------------ + [ 0 1 ] 1 0 1 + [ 1 0 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 1 1 ] 5 0 5 + [ 2 0 ] 6 0 6 + [ 2 0 ] 7 0 7 + [ 2 0 ] 8 0 8 + [ 2 1 ] 9 0 9 + [ 2 1 ] 10 0 10 + [ 2 1 ] 11 0 11 */ sid = H5Screate_simple(2, dims2, NULL); @@ -6080,34 +6734,32 @@ void write_attr_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf62,0,sizeof buf62); - } + memset(buf62, 0, sizeof buf62); /* - buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: and - Attribute: and - position array2D of array2D of difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 0 ] 2 0 2 - [ 0 0 ] 3 0 3 - [ 0 1 ] 4 0 4 - [ 0 1 ] 5 0 5 - [ 0 1 ] 6 0 6 - [ 1 0 ] 7 0 7 - [ 1 0 ] 8 0 8 - [ 1 0 ] 9 0 9 - [ 1 1 ] 10 0 10 - [ 1 1 ] 11 0 11 - [ 1 1 ] 12 0 12 - [ 2 0 ] 13 0 13 - [ 2 0 ] 14 0 14 - [ 2 0 ] 15 0 15 - [ 2 1 ] 16 0 16 - [ 2 1 ] 17 0 17 - [ 2 1 ] 18 0 18 + buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; + $h5diff file7.h5 file6.h5 g1 g1 -v + Group: and + Attribute: and + position array2D of array2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 0 ] 2 0 2 + [ 0 0 ] 3 0 3 + [ 0 1 ] 4 0 4 + [ 0 1 ] 5 0 5 + [ 0 1 ] 6 0 6 + [ 1 0 ] 7 0 7 + [ 1 0 ] 8 0 8 + [ 1 0 ] 9 0 9 + [ 1 1 ] 10 0 10 + [ 1 1 ] 11 0 11 + [ 1 1 ] 12 0 12 + [ 2 0 ] 13 0 13 + [ 2 0 ] 14 0 14 + [ 2 0 ] 15 0 15 + [ 2 1 ] 16 0 16 + [ 2 1 ] 17 0 17 + [ 2 1 ] 18 0 18 */ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_attr(loc_id, 2, dims2, "array2D", tid, buf62); @@ -6118,36 +6770,34 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - memset(buf72,0,sizeof buf72); - memset(buf82,0,sizeof buf82); + if (make_diffs) { + memset(buf72, 0, sizeof buf72); + memset(buf82, 0, sizeof buf82); } /* - Attribute: and - position integer2D of integer2D of difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - 6 differences found - Attribute: and - position float2D of float2D of difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - - write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); - write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + Attribute: and + position integer2D of integer2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + 6 differences found + Attribute: and + position float2D of float2D of difference + ------------------------------------------------------------ + [ 0 0 ] 1 0 1 + [ 0 1 ] 2 0 2 + [ 1 0 ] 3 0 3 + [ 1 1 ] 4 0 4 + [ 2 0 ] 5 0 5 + [ 2 1 ] 6 0 6 + */ + + write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72); + write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); /*------------------------------------------------------------------------- * 3D attributes @@ -6159,90 +6809,83 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<4; i++) - for (j=0; j<3; j++) - for (k=0; k<2; k++) - for (l=0; l<2; l++) - buf13[i][j][k][l]='z'; + if (make_diffs) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + for (l = 0; l < 2; l++) + buf13[i][j][k][l] = 'z'; } /* - buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; - - Attribute: and - position string3D of string3D of difference - ------------------------------------------------------------ - [ 0 0 0 ] a z - [ 0 0 0 ] b z - [ 0 0 1 ] c z - [ 0 0 1 ] d z - [ 0 1 0 ] e z - [ 0 1 0 ] f z - [ 0 1 1 ] g z - [ 0 1 1 ] h z - [ 0 2 0 ] i z - [ 0 2 0 ] j z - [ 0 2 1 ] k z - [ 0 2 1 ] l z - [ 1 0 0 ] m z - [ 1 0 0 ] n z - [ 1 0 1 ] p z - [ 1 0 1 ] q z - [ 1 1 0 ] r z - [ 1 1 0 ] s z - [ 1 1 1 ] t z - [ 1 1 1 ] u z - [ 1 2 0 ] v z - [ 1 2 0 ] w z - [ 1 2 1 ] x z - [ 2 0 0 ] A z - [ 2 0 0 ] B z - [ 2 0 1 ] C z - [ 2 0 1 ] D z - [ 2 1 0 ] E z - [ 2 1 0 ] F z - [ 2 1 1 ] G z - [ 2 1 1 ] H z - [ 2 2 0 ] I z - [ 2 2 0 ] J z - [ 2 2 1 ] K z - [ 2 2 1 ] L z - [ 3 0 0 ] M z - [ 3 0 0 ] N z - [ 3 0 1 ] P z - [ 3 0 1 ] Q z - [ 3 1 0 ] R z - [ 3 1 0 ] S z - [ 3 1 1 ] T z - [ 3 1 1 ] U z - [ 3 2 0 ] V z - [ 3 2 0 ] W z - [ 3 2 1 ] X z - [ 3 2 1 ] Z z + buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + "rs","tu","vw","xz","AB","CD","EF","GH", + "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; + + Attribute: and + position string3D of string3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] a z + [ 0 0 0 ] b z + [ 0 0 1 ] c z + [ 0 0 1 ] d z + [ 0 1 0 ] e z + [ 0 1 0 ] f z + [ 0 1 1 ] g z + [ 0 1 1 ] h z + [ 0 2 0 ] i z + [ 0 2 0 ] j z + [ 0 2 1 ] k z + [ 0 2 1 ] l z + [ 1 0 0 ] m z + [ 1 0 0 ] n z + [ 1 0 1 ] p z + [ 1 0 1 ] q z + [ 1 1 0 ] r z + [ 1 1 0 ] s z + [ 1 1 1 ] t z + [ 1 1 1 ] u z + [ 1 2 0 ] v z + [ 1 2 0 ] w z + [ 1 2 1 ] x z + [ 2 0 0 ] A z + [ 2 0 0 ] B z + [ 2 0 1 ] C z + [ 2 0 1 ] D z + [ 2 1 0 ] E z + [ 2 1 0 ] F z + [ 2 1 1 ] G z + [ 2 1 1 ] H z + [ 2 2 0 ] I z + [ 2 2 0 ] J z + [ 2 2 1 ] K z + [ 2 2 1 ] L z + [ 3 0 0 ] M z + [ 3 0 0 ] N z + [ 3 0 1 ] P z + [ 3 0 1 ] Q z + [ 3 1 0 ] R z + [ 3 1 0 ] S z + [ 3 1 1 ] T z + [ 3 1 1 ] U z + [ 3 2 0 ] V z + [ 3 2 0 ] W z + [ 3 2 1 ] X z + [ 3 2 1 ] Z z */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t)STR_SIZE); - write_attr(loc_id,3,dims3,"string3D",tid,buf13); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_attr(loc_id, 3, dims3, "string3D", tid, buf13); status = H5Tclose(tid); - for (i=0; i<4; i++) - { - for (j=0; j<3; j++) - { - for (k=0; k<2; k++) - { - buf13a[i][j][k]=buf13[i][j][k]; - } - } - } + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + buf13a[i][j][k] = buf13[i][j][k]; tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_attr(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6250,58 +6893,55 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - if(make_diffs) + if (make_diffs) buf23[i][j][k] = 0; else - buf23[i][j][k] = (char)n++; + buf23[i][j][k] = (char) n++; } - } - } - /* - position bitfield3D of bitfield3D of difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 1 ] 2 0 2 - [ 0 1 0 ] 3 0 3 - [ 0 1 1 ] 4 0 4 - [ 0 2 0 ] 5 0 5 - [ 0 2 1 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 1 0 ] 9 0 9 - [ 1 1 1 ] 10 0 10 - [ 1 2 0 ] 11 0 11 - [ 1 2 1 ] 12 0 12 - [ 2 0 0 ] 13 0 13 - [ 2 0 1 ] 14 0 14 - [ 2 1 0 ] 15 0 15 - [ 2 1 1 ] 16 0 16 - [ 2 2 0 ] 17 0 17 - [ 2 2 1 ] 18 0 18 - [ 3 0 0 ] 19 0 19 - [ 3 0 1 ] 20 0 20 - [ 3 1 0 ] 21 0 21 - [ 3 1 1 ] 22 0 22 - [ 3 2 0 ] 23 0 23 - [ 3 2 1 ] 24 0 24 + position bitfield3D of bitfield3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + [ 1 2 0 ] 11 0 11 + [ 1 2 1 ] 12 0 12 + [ 2 0 0 ] 13 0 13 + [ 2 0 1 ] 14 0 14 + [ 2 1 0 ] 15 0 15 + [ 2 1 1 ] 16 0 16 + [ 2 2 0 ] 17 0 17 + [ 2 2 1 ] 18 0 18 + [ 3 0 0 ] 19 0 19 + [ 3 0 1 ] 20 0 20 + [ 3 1 0 ] 21 0 21 + [ 3 1 1 ] 22 0 22 + [ 3 2 0 ] 23 0 23 + [ 3 2 1 ] 24 0 24 */ tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23); + write_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,3,dims3,"opaque3D",tid,buf23); + write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6309,77 +6949,75 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; buf33[i][j][k].b = 0.0F; } else { - buf33[i][j][k].a = (char)n++; + buf33[i][j][k].a = (char) n++; buf33[i][j][k].b = n++; } } - } - } /*position compound3D of compound3D of difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 0 ] 2 0 2 - [ 0 0 1 ] 3 0 3 - [ 0 0 1 ] 4 0 4 - [ 0 1 0 ] 5 0 5 - [ 0 1 0 ] 6 0 6 - [ 0 1 1 ] 7 0 7 - [ 0 1 1 ] 8 0 8 - [ 0 2 0 ] 9 0 9 - [ 0 2 0 ] 10 0 10 - [ 0 2 1 ] 11 0 11 - [ 0 2 1 ] 12 0 12 - [ 1 0 0 ] 13 0 13 - [ 1 0 0 ] 14 0 14 - [ 1 0 1 ] 15 0 15 - [ 1 0 1 ] 16 0 16 - [ 1 1 0 ] 17 0 17 - [ 1 1 0 ] 18 0 18 - [ 1 1 1 ] 19 0 19 - [ 1 1 1 ] 20 0 20 - [ 1 2 0 ] 21 0 21 - [ 1 2 0 ] 22 0 22 - [ 1 2 1 ] 23 0 23 - [ 1 2 1 ] 24 0 24 - [ 2 0 0 ] 25 0 25 - [ 2 0 0 ] 26 0 26 - [ 2 0 1 ] 27 0 27 - [ 2 0 1 ] 28 0 28 - [ 2 1 0 ] 29 0 29 - [ 2 1 0 ] 30 0 30 - [ 2 1 1 ] 31 0 31 - [ 2 1 1 ] 32 0 32 - [ 2 2 0 ] 33 0 33 - [ 2 2 0 ] 34 0 34 - [ 2 2 1 ] 35 0 35 - [ 2 2 1 ] 36 0 36 - [ 3 0 0 ] 37 0 37 - [ 3 0 0 ] 38 0 38 - [ 3 0 1 ] 39 0 39 - [ 3 0 1 ] 40 0 40 - [ 3 1 0 ] 41 0 41 - [ 3 1 0 ] 42 0 42 - [ 3 1 1 ] 43 0 43 - [ 3 1 1 ] 44 0 44 - [ 3 2 0 ] 45 0 45 - [ 3 2 0 ] 46 0 46 - [ 3 2 1 ] 47 0 47 - [ 3 2 1 ] 48 0 48 - */ - - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 1 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 1 0 ] 5 0 5 + [ 0 1 0 ] 6 0 6 + [ 0 1 1 ] 7 0 7 + [ 0 1 1 ] 8 0 8 + [ 0 2 0 ] 9 0 9 + [ 0 2 0 ] 10 0 10 + [ 0 2 1 ] 11 0 11 + [ 0 2 1 ] 12 0 12 + [ 1 0 0 ] 13 0 13 + [ 1 0 0 ] 14 0 14 + [ 1 0 1 ] 15 0 15 + [ 1 0 1 ] 16 0 16 + [ 1 1 0 ] 17 0 17 + [ 1 1 0 ] 18 0 18 + [ 1 1 1 ] 19 0 19 + [ 1 1 1 ] 20 0 20 + [ 1 2 0 ] 21 0 21 + [ 1 2 0 ] 22 0 22 + [ 1 2 1 ] 23 0 23 + [ 1 2 1 ] 24 0 24 + [ 2 0 0 ] 25 0 25 + [ 2 0 0 ] 26 0 26 + [ 2 0 1 ] 27 0 27 + [ 2 0 1 ] 28 0 28 + [ 2 1 0 ] 29 0 29 + [ 2 1 0 ] 30 0 30 + [ 2 1 1 ] 31 0 31 + [ 2 1 1 ] 32 0 32 + [ 2 2 0 ] 33 0 33 + [ 2 2 0 ] 34 0 34 + [ 2 2 1 ] 35 0 35 + [ 2 2 1 ] 36 0 36 + [ 3 0 0 ] 37 0 37 + [ 3 0 0 ] 38 0 38 + [ 3 0 1 ] 39 0 39 + [ 3 0 1 ] 40 0 40 + [ 3 1 0 ] 41 0 41 + [ 3 1 0 ] 42 0 42 + [ 3 1 1 ] 43 0 43 + [ 3 1 1 ] 44 0 44 + [ 3 2 0 ] 45 0 45 + [ 3 2 0 ] 46 0 46 + [ 3 2 1 ] 47 0 47 + [ 3 2 1 ] 48 0 48 + */ + + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,3,dims3,"compound3D",tid,buf33); + write_attr(loc_id, 3, dims3, "compound3D", tid, buf33); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6387,15 +7025,13 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + if (dset_name) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, + H5R_OBJECT, (hid_t) -1); + write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); } /*------------------------------------------------------------------------- @@ -6403,48 +7039,47 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - if (make_diffs) buf453[i][j][k]=RED; else buf453[i][j][k]=GREEN; + if (make_diffs) + buf453[i][j][k] = RED; + else + buf453[i][j][k] = GREEN; } - } - } - /* - position enum3D of enum3D of difference - ------------------------------------------------------------ - [ 0 0 0 ] GREEN RED - [ 0 0 1 ] GREEN RED - [ 0 1 0 ] GREEN RED - [ 0 1 1 ] GREEN RED - [ 0 2 0 ] GREEN RED - [ 0 2 1 ] GREEN RED - [ 1 0 0 ] GREEN RED - [ 1 0 1 ] GREEN RED - [ 1 1 0 ] GREEN RED - [ 1 1 1 ] GREEN RED - [ 1 2 0 ] GREEN RED - [ 1 2 1 ] GREEN RED - [ 2 0 0 ] GREEN RED - [ 2 0 1 ] GREEN RED - [ 2 1 0 ] GREEN RED - [ 2 1 1 ] GREEN RED - [ 2 2 0 ] GREEN RED - [ 2 2 1 ] GREEN RED - [ 3 0 0 ] GREEN RED - [ 3 0 1 ] GREEN RED - [ 3 1 0 ] GREEN RED - [ 3 1 1 ] GREEN RED - [ 3 2 0 ] GREEN RED - [ 3 2 1 ] GREEN RED + position enum3D of enum3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] GREEN RED + [ 0 0 1 ] GREEN RED + [ 0 1 0 ] GREEN RED + [ 0 1 1 ] GREEN RED + [ 0 2 0 ] GREEN RED + [ 0 2 1 ] GREEN RED + [ 1 0 0 ] GREEN RED + [ 1 0 1 ] GREEN RED + [ 1 1 0 ] GREEN RED + [ 1 1 1 ] GREEN RED + [ 1 2 0 ] GREEN RED + [ 1 2 1 ] GREEN RED + [ 2 0 0 ] GREEN RED + [ 2 0 1 ] GREEN RED + [ 2 1 0 ] GREEN RED + [ 2 1 1 ] GREEN RED + [ 2 2 0 ] GREEN RED + [ 2 2 1 ] GREEN RED + [ 3 0 0 ] GREEN RED + [ 3 0 1 ] GREEN RED + [ 3 1 0 ] GREEN RED + [ 3 1 1 ] GREEN RED + [ 3 2 0 ] GREEN RED + [ 3 2 1 ] GREEN RED */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,3,dims3,"enum3D",tid,buf453); + write_attr(loc_id, 3, dims3, "enum3D", tid, buf453); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6453,34 +7088,32 @@ void write_attr_in(hid_t loc_id, */ /* Allocate and initialize VL dataset to write */ - n=0; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 0; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) - if(make_diffs) - ((int *)buf53[i][j][k].p)[l] = 0; + if (make_diffs) + ((int *) buf53[i][j][k].p)[l] = 0; else - ((int *)buf53[i][j][k].p)[l] = n++; + ((int *) buf53[i][j][k].p)[l] = n++; } - } - } /* - position vlen3D of vlen3D of difference - ------------------------------------------------------------ - [ 0 0 1 ] 1 0 1 - [ 0 1 0 ] 2 0 2 - [ 0 1 1 ] 3 0 3 - [ 0 2 0 ] 4 0 4 - [ 0 2 1 ] 5 0 5 - [ 1 0 0 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 0 1 ] 9 0 9 - [ 1 1 0 ] 10 0 10 - etc + position vlen3D of vlen3D of difference + ------------------------------------------------------------ + [ 0 0 1 ] 1 0 1 + [ 0 1 0 ] 2 0 2 + [ 0 1 1 ] 3 0 3 + [ 0 2 0 ] 4 0 4 + [ 0 2 1 ] 5 0 5 + [ 1 0 0 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 0 1 ] 9 0 9 + [ 1 1 0 ] 10 0 10 + etc */ sid = H5Screate_simple(3, dims3, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); @@ -6497,24 +7130,25 @@ void write_attr_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 24; i++) { - for (j = 0; j < (int)dimarray[0]; j++) { - if (make_diffs) buf63[i][j]=0; - else buf63[i][j]=n++; + n = 1; + for (i = 0; i < 24; i++) + for (j = 0; j < (int) dimarray[0]; j++) { + if (make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; } - } /* - position array3D of array3D of difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 0 ] 2 0 2 - [ 0 0 0 ] 3 0 3 - [ 0 0 1 ] 4 0 4 - [ 0 0 1 ] 5 0 5 - [ 0 0 1 ] 6 0 6 - [ 0 1 0 ] 7 0 7 - etc + position array3D of array3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 0 ] 2 0 2 + [ 0 0 0 ] 3 0 3 + [ 0 0 1 ] 4 0 4 + [ 0 0 1 ] 5 0 5 + [ 0 0 1 ] 6 0 6 + [ 0 1 0 ] 7 0 7 + etc */ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); @@ -6525,132 +7159,120 @@ void write_attr_in(hid_t loc_id, * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - n=1; f=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + f = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { - buf73[i][j][k]=0; - buf83[i][j][k]=0.0F; + buf73[i][j][k] = 0; + buf83[i][j][k] = 0.0F; } else { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; + buf73[i][j][k] = n++; + buf83[i][j][k] = f++; } } - } - } /* - position integer3D of integer3D of difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 1 ] 2 0 2 - [ 0 1 0 ] 3 0 3 - [ 0 1 1 ] 4 0 4 - [ 0 2 0 ] 5 0 5 - [ 0 2 1 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 1 0 ] 9 0 9 - [ 1 1 1 ] 10 0 10 - etc - */ - write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); + position integer3D of integer3D of difference + ------------------------------------------------------------ + [ 0 0 0 ] 1 0 1 + [ 0 0 1 ] 2 0 2 + [ 0 1 0 ] 3 0 3 + [ 0 1 1 ] 4 0 4 + [ 0 2 0 ] 5 0 5 + [ 0 2 1 ] 6 0 6 + [ 1 0 0 ] 7 0 7 + [ 1 0 1 ] 8 0 8 + [ 1 1 0 ] 9 0 9 + [ 1 1 1 ] 10 0 10 + etc + */ + write_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73); + write_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83); } - - /*------------------------------------------------------------------------- -* Function: write_dset_in -* -* Purpose: write datasets in LOC_ID -* -*------------------------------------------------------------------------- -*/ + * Function: write_dset_in + * + * Purpose: write datasets in LOC_ID + * + *------------------------------------------------------------------------- + */ static -void write_dset_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t fid, - int make_diffs /* flag to modify data buffers */) +void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t - { - char a; + typedef struct s_t { + char a; double b; } s_t; - typedef enum - { - RED, - GREEN + typedef enum { + RED, GREEN } e_t; - hid_t did; - hid_t sid; - hid_t tid; - hid_t dcpl; - herr_t status; - int val, i, j, k, l, n; - float f; - int fillvalue=2; - int scalar_data = 2; + hid_t did = -1; + hid_t sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; + herr_t status; + int val, i, j, k, l, n; + float f; + int fillvalue = 2; + int scalar_data = 2; /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ - char *buf1a[2]; /* VL string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2]= {RED,GREEN}; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1.0F,2.0F}; /* float */ + hsize_t dims[1] = { 2 }; + char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ + char *buf1a[2]; /* VL string */ + char buf2[2] = { 1, 2 }; /* bitfield, opaque */ + s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = { RED, GREEN }; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = { 3 }; /* array dimension */ + int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ + int buf7[2] = { 1, 2 }; /* integer */ + float buf8[2] = { 1.0F, 2.0F }; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */ + hsize_t dims2[2] = { 3, 2 }; + char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ + char *buf12a[3][2]; /* VL string */ + char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ + s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ + int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ + float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, - {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, - {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, - {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ - char *buf13a[4][3][2]; /* VL string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - - if(make_diffs == 2) { + hsize_t dims3[3] = { 4, 3, 2 }; + char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, + { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, + { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, + { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ + char *buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ + + if (make_diffs == 2) dimarray[0] = 4; - } /*------------------------------------------------------------------------- * H5S_SCALAR *------------------------------------------------------------------------- */ - - - if(make_diffs) + if (make_diffs) scalar_data = 1; /* create a space */ @@ -6666,7 +7288,6 @@ void write_dset_in(hid_t loc_id, H5Dclose(did); H5Sclose(sid); - /*------------------------------------------------------------------------- * 1D *------------------------------------------------------------------------- @@ -6677,27 +7298,22 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<2; j++) - buf1[i][j]='z'; - } - + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + buf1[i][j] = 'z'; tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,(size_t)STR_SIZE); - write_dset(loc_id,1,dims,"string",tid,buf1); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_dset(loc_id, 1, dims, "string", tid, buf1); status = H5Tclose(tid); - for (i=0; i<2; i++) - { - buf1a[i]=buf1[i]; - } + for (i = 0; i < 2; i++) + buf1a[i] = buf1[i]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_dset(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id, 1, dims, "VLstring", tid, buf1a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6706,13 +7322,11 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - buf2[i]=buf2[1]=0; - } + for (i = 0; i < 2; i++) + buf2[i] = buf2[1] = 0; tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,1,dims,"bitfield",tid,buf2); + write_dset(loc_id, 1, dims, "bitfield", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6721,16 +7335,14 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - buf3[i].a=0; buf3[i].b=0; + for (i = 0; i < 2; i++) { + buf3[i].a = 0; + buf3[i].b = 0; } - } - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,1,dims,"opaque",tid,buf2); + write_dset(loc_id, 1, dims, "opaque", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6738,19 +7350,14 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf45[i]=GREEN; - } - } + for (i = 0; i < 2; i++) + buf45[i] = GREEN; - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,1,dims,"compound",tid,buf3); + write_dset(loc_id, 1, dims, "compound", tid, buf3); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6758,11 +7365,10 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); - write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + if (dset_name) { + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_dset(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } /*------------------------------------------------------------------------- @@ -6770,16 +7376,16 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - gen_datareg(fid,make_diffs); + gen_datareg(fid, make_diffs); /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,1,dims,"enum",tid,buf45); + write_dset(loc_id, 1, dims, "enum", tid, buf45); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6790,22 +7396,23 @@ void write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *) buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0]=2; - ((int *)buf5[1].p)[1]=3; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *) buf5[1].p)[0] = 2; + ((int *) buf5[1].p)[1] = 3; - if(make_diffs) { - ((int *)buf5[0].p)[0] = 0; - ((int *)buf5[1].p)[0] = 0; - ((int *)buf5[1].p)[1]=0; + if (make_diffs) { + ((int *) buf5[0].p)[0] = 0; + ((int *) buf5[1].p)[0] = 0; + ((int *) buf5[1].p)[1] = 0; } sid = H5Screate_simple(1, dims, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); @@ -6820,37 +7427,32 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<3; j++) - { - buf6[i][j]=0; - } - } + for (i = 0; i < 2; i++) + for (j = 0; j < 3; j++) + buf6[i][j] = 0; tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); { - double *dbuf; /* information to write */ - hid_t ldid; /* dataset ID */ - hid_t lsid; /* dataspace ID */ - hid_t ltid; /* datatype ID */ - size_t size; - hsize_t sdims[] = {1}; - hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1}; - size_t jj; + double *dbuf; /* information to write */ + hid_t ldid = -1; /* dataset ID */ + hid_t lsid = -1; /* dataspace ID */ + hid_t ltid = -1; /* datatype ID */ + size_t size; + hsize_t sdims[] = { 1 }; + hsize_t tdims[] = { H5TOOLS_MALLOCSIZE / sizeof(double) + 1 }; + size_t jj; /* allocate and initialize array data to write */ - size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double); - dbuf = (double *)HDmalloc(size); + size = (H5TOOLS_MALLOCSIZE / sizeof(double) + 1) * sizeof(double); + dbuf = (double *) HDmalloc(size); - for(jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++) - dbuf[jj] = (double)jj; + for (jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++) + dbuf[jj] = (double) jj; - if (make_diffs) - { + if (make_diffs) { dbuf[5] = 0; dbuf[6] = 0; } @@ -6877,17 +7479,13 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - for (i=0; i<2; i++) - { - buf7[i]=0; - buf8[i]=0; + for (i = 0; i < 2; i++) { + buf7[i] = 0; + buf8[i] = 0; } - } - - write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); + write_dset(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); /*------------------------------------------------------------------------- * 2D @@ -6899,30 +7497,25 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<3; i++) - for (j=0; j<2; j++) - for (k=0; k<2; k++) - buf12[i][j][k]='z'; + if (make_diffs) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + for (k = 0; k < 2; k++) + buf12[i][j][k] = 'z'; } - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,(size_t)STR_SIZE); - write_dset(loc_id,2,dims2,"string2D",tid,buf12); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_dset(loc_id, 2, dims2, "string2D", tid, buf12); status = H5Tclose(tid); - for (i=0; i<3; i++) - { - for (j=0; j<2; j++) - { - buf12a[i][j]=buf12[i][j]; - } - } + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + buf12a[i][j] = buf12[i][j]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_dset(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id, 2, dims2, "VLstring2D", tid, buf12a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6930,23 +7523,20 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - memset(buf22,0,sizeof buf22); - } + memset(buf22, 0, sizeof buf22); tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22); + write_dset(loc_id, 2, dims2, "bitfield2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,2,dims2,"opaque2D",tid,buf22); + write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6955,14 +7545,12 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf32,0,sizeof buf32); - } + memset(buf32, 0, sizeof buf32); - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,2,dims2,"compound2D",tid,buf32); + write_dset(loc_id, 2, dims2, "compound2D", tid, buf32); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6970,14 +7558,11 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 3; i++) { - for (j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + if (dset_name) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_dset(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); } /*------------------------------------------------------------------------- @@ -6986,9 +7571,9 @@ void write_dset_in(hid_t loc_id, */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,2,dims2,"enum2D",tid,0); + write_dset(loc_id, 2, dims2, "enum2D", tid, 0); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -6998,18 +7583,17 @@ void write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ n = 0; - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { + for (i = 0; i < 3; i++) + for (j = 0; j < 2; j++) { buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) { - if(make_diffs) - ((int *)buf52[i][j].p)[l] = 0; + for (l = 0; l < i + 1; l++) { + if (make_diffs) + ((int *) buf52[i][j].p)[l] = 0; else - ((int *)buf52[i][j].p)[l] = n++; + ((int *) buf52[i][j].p)[l] = n++; } } - } sid = H5Screate_simple(2, dims2, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); @@ -7028,10 +7612,7 @@ void write_dset_in(hid_t loc_id, */ if (make_diffs) - { - memset(buf62,0,sizeof buf62); - } - + memset(buf62, 0, sizeof buf62); tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 2, dims2, "array2D", tid, buf62); @@ -7042,14 +7623,11 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - if (make_diffs) - { + if (make_diffs) { memset(buf72, 0, sizeof buf72); memset(buf82, 0, sizeof buf82); } - dcpl = H5Pcreate(H5P_DATASET_CREATE); status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue); sid = H5Screate_simple(2, dims2, NULL); @@ -7064,8 +7642,7 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); /*------------------------------------------------------------------------- * 3D @@ -7077,33 +7654,27 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<4; i++) - for (j=0; j<3; j++) - for (k=0; k<2; k++) - for (l=0; l<2; l++) - buf13[i][j][k][l]='z'; + if (make_diffs) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + for (l = 0; l < 2; l++) + buf13[i][j][k][l] = 'z'; } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,(size_t)STR_SIZE); - write_dset(loc_id,3,dims3,"string3D",tid,buf13); + status = H5Tset_size(tid, (size_t) STR_SIZE); + write_dset(loc_id, 3, dims3, "string3D", tid, buf13); status = H5Tclose(tid); - for (i=0; i<4; i++) - { - for (j=0; j<3; j++) - { - for (k=0; k<2; k++) - { - buf13a[i][j][k]=buf13[i][j][k]; - } - } - } + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) + buf13a[i][j][k] = buf13[i][j][k]; + tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, H5T_VARIABLE); - write_dset(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id, 3, dims3, "VLstring3D", tid, buf13a); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7111,31 +7682,27 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - if(make_diffs) + if (make_diffs) buf23[i][j][k] = 0; else - buf23[i][j][k] = (char)n++; + buf23[i][j][k] = (char) n++; } - } - } - tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23); + write_dset(loc_id, 3, dims3, "bitfield3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, (size_t)1); + tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,3,dims3,"opaque3D",tid,buf23); + write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7143,27 +7710,24 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; buf33[i][j][k].b = 0.0F; } else { - buf33[i][j][k].a = (char)n++; + buf33[i][j][k].a = (char) n++; buf33[i][j][k].b = n++; } } - } - } - - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t)); H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,3,dims3,"compound3D",tid,buf33); + write_dset(loc_id, 3, dims3, "compound3D", tid, buf33); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7171,15 +7735,12 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + if (dset_name) { + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); - } - } - write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t) -1); + write_dset(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); } /*------------------------------------------------------------------------- @@ -7188,9 +7749,9 @@ void write_dset_in(hid_t loc_id, */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,3,dims3,"enum3D",tid,0); + write_dset(loc_id, 3, dims3, "enum3D", tid, 0); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -7199,21 +7760,19 @@ void write_dset_in(hid_t loc_id, */ /* Allocate and initialize VL dataset to write */ - n=0; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { + n = 0; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) + for (k = 0; k < 2; k++) { buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) { - if(make_diffs) - ((int *)buf53[i][j][k].p)[l] = 0; + for (l = 0; l < i + 1; l++) { + if (make_diffs) + ((int *) buf53[i][j][k].p)[l] = 0; else - ((int *)buf53[i][j][k].p)[l] = n++; + ((int *) buf53[i][j][k].p)[l] = n++; } } - } - } sid = H5Screate_simple(3, dims3, NULL); tid = H5Tvlen_create(H5T_NATIVE_INT); @@ -7231,14 +7790,14 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - - n=1; - for (i = 0; i < 24; i++) { + n = 1; + for (i = 0; i < 24; i++) for (j = 0; j < 3; j++) { - if (make_diffs) buf63[i][j]=0; - else buf63[i][j]=n++; + if (make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; } - } tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 3, dims3, "array3D", tid, buf63); @@ -7248,82 +7807,86 @@ void write_dset_in(hid_t loc_id, * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - n=1; f=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { + n = 1; + f = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { if (make_diffs) { - buf73[i][j][k]=0; - buf83[i][j][k]=0.0F; + buf73[i][j][k] = 0; + buf83[i][j][k] = 0.0F; } else { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; + buf73[i][j][k] = n++; + buf83[i][j][k] = f++; } } - } - } - write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); + + write_dset(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73); + write_dset(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83); } /*------------------------------------------------------------------------- -* Function: gen_datareg -* -* Purpose: generate a dataset region and its reference -* -* Date: April 19, 2006 -* -*------------------------------------------------------------------------- -*/ + * Function: gen_datareg + * + * Purpose: generate a dataset region and its reference + * + * Date: April 19, 2006 + * + *------------------------------------------------------------------------- + */ static -void gen_datareg(hid_t fid, - int make_diffs /* flag to modify data buffers */) +void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) { /* data dataset */ - hid_t did1; /* dataset ID */ - hid_t sid1; /* dataspace ID */ - hsize_t dims1[2] = {10,10};/* dimensions */ - int *buf; /* dataset buffer */ + hid_t did1 = -1; /* dataset ID */ + hid_t sid1 = -1; /* dataspace ID */ + hsize_t dims1[2] = { 10, 10 };/* dimensions */ + int *buf; /* dataset buffer */ /* reference dataset */ - hid_t did2; /* dataset ID */ - hid_t sid2; /* dataspace ID */ - hsize_t dims2[] = {2}; /* 2 references */ - hdset_reg_ref_t *rbuf; /* buffer for write the references */ - hsize_t start[10]; /* starting location of hyperslab */ - hsize_t count[10]; /* element count of hyperslab */ - hsize_t coord[5][2]; /* coordinates for point selection */ - herr_t status; - int i; + hid_t did2 = -1; /* dataset ID */ + hid_t sid2 = -1; /* dataspace ID */ + hsize_t dims2[] = { 2 }; /* 2 references */ + hdset_reg_ref_t *rbuf; /* buffer for write the references */ + hsize_t start[10]; /* starting location of hyperslab */ + hsize_t count[10]; /* element count of hyperslab */ + hsize_t coord[5][2]; /* coordinates for point selection */ + herr_t status; + int i; /* allocate the buffer for write the references */ - rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); + rbuf = (hdset_reg_ref_t *) HDcalloc((size_t )2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ - buf = (int *)HDmalloc(10 * 10 * sizeof(int)); + buf = (int *) HDmalloc(10 * 10 * sizeof(int)); - for(i = 0; i < 10 * 10; i++) + for (i = 0; i < 10 * 10; i++) buf[i] = i; /* create the data dataset */ - sid1 = H5Screate_simple(2, dims1, NULL); - did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid1 = H5Screate_simple(2, dims1, NULL); + did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); HDassert(status >= 0); /* create the reference dataset */ - sid2 = H5Screate_simple(1, dims2, NULL); - did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid2 = H5Screate_simple(1, dims2, NULL); + did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); /* create the references */ /* select hyperslab for first reference */ - start[0] = 2; start[1] = 2; - count[0] = 6; count[1] = 6; - if(make_diffs) { - start[0] = 0; start[1] = 0; - count[0] = 3; count[1] = 3; + start[0] = 2; + start[1] = 2; + count[0] = 6; + count[1] = 6; + if (make_diffs) { + start[0] = 0; + start[1] = 0; + count[0] = 3; + count[1] = 3; } status = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL); @@ -7335,25 +7898,32 @@ void gen_datareg(hid_t fid, HDassert(status >= 0); /* select sequence of five points for second reference */ - coord[0][0]=6; coord[0][1]=9; - coord[1][0]=2; coord[1][1]=2; - coord[2][0]=8; coord[2][1]=4; - coord[3][0]=1; coord[3][1]=6; - coord[4][0]=2; coord[4][1]=8; - if (make_diffs) - { - coord[1][0]=3; coord[1][1]=3; - coord[3][0]=2; coord[3][1]=5; - coord[4][0]=1; coord[4][1]=7; - } - H5Sselect_elements(sid1,H5S_SELECT_SET,(size_t)5,(const hsize_t *)coord); + coord[0][0] = 6; + coord[0][1] = 9; + coord[1][0] = 2; + coord[1][1] = 2; + coord[2][0] = 8; + coord[2][1] = 4; + coord[3][0] = 1; + coord[3][1] = 6; + coord[4][0] = 2; + coord[4][1] = 8; + if (make_diffs) { + coord[1][0] = 3; + coord[1][1] = 3; + coord[3][0] = 2; + coord[3][1] = 5; + coord[4][0] = 1; + coord[4][1] = 7; + } + H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t) 5, (const hsize_t *) coord); H5Sget_select_npoints(sid1); /* store second dataset region */ - H5Rcreate(&rbuf[1],fid,"dsetref",H5R_DATASET_REGION,sid1); + H5Rcreate(&rbuf[1], fid, "dsetref", H5R_DATASET_REGION, sid1); /* write */ - status = H5Dwrite(did2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); + status = H5Dwrite(did2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); HDassert(status >= 0); /* close, free memory buffers */ @@ -7370,60 +7940,58 @@ void gen_datareg(hid_t fid, HDfree(buf); } - /*------------------------------------------------------------------------- -* Function: test_hyperslab -* -* Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions -* by iterating trough 1KB hyperslabs -* -*------------------------------------------------------------------------- -*/ + * Function: test_hyperslab + * + * Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions + * by iterating trough 1KB hyperslabs + * + *------------------------------------------------------------------------- + */ static -int test_hyperslab(const char *fname, - int make_diffs /* flag to modify data buffers */) +int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */) { - hid_t did=-1; - hid_t fid=-1; - hid_t f_sid=-1; - hid_t m_sid=-1; - hid_t tid=-1; - hid_t dcpl=-1; - hsize_t dims[1]={GBLL}; /* dataset dimensions */ - hsize_t hs_size[1]={GBLL/(1024*1024)}; /* hyperslab dimensions */ - hsize_t chunk_dims[1]={GBLL/1024}; /* chunk dimensions */ + hid_t did = -1; + hid_t fid = -1; + hid_t f_sid = -1; + hid_t m_sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; + hsize_t dims[1] = { GBLL }; /* dataset dimensions */ + hsize_t hs_size[1] = { GBLL / (1024 * 1024) }; /* hyperslab dimensions */ + hsize_t chunk_dims[1] = { GBLL / 1024 }; /* chunk dimensions */ hsize_t hs_start[1]; - size_t size; - size_t nelmts=(size_t)GBLL/(1024*1024); /* elements in each hyperslab */ - char fillvalue=-1; - char *buf=NULL; - int i, j, s; - char c; + size_t size; + size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */ + char fillvalue = -1; + char *buf = NULL; + int i, j, s; + char c; /* create */ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0) + if (H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0) goto out; - if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) + if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0) goto out; - if((f_sid = H5Screate_simple(1, dims, NULL)) < 0) + if ((f_sid = H5Screate_simple(1, dims, NULL)) < 0) goto out; - if((did = H5Dcreate2(fid, "big", H5T_NATIVE_CHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, "big", H5T_NATIVE_CHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto out; - if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) + if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) goto out; - if((tid = H5Dget_type(did)) < 0) + if ((tid = H5Dget_type(did)) < 0) goto out; - if((size = H5Tget_size(tid)) <= 0) + if ((size = H5Tget_size(tid)) <= 0) goto out; /* create a evenly divided buffer from 0 to 127 */ - buf = (char *)HDmalloc((size_t)(nelmts * size)); + buf = (char *) HDmalloc((size_t)(nelmts * size)); s = 1024 * 1024 / 127; - for(i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { - if(j == s) { + for (i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { + if (j == s) { c++; j = 0; } @@ -7432,32 +8000,30 @@ int test_hyperslab(const char *fname, HDmemset(buf, c, nelmts); /* make a different hyperslab at this position */ - if(make_diffs && i == 512 * 512) + if (make_diffs && i == 512 * 512) HDmemset(buf, 0, nelmts); - hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024); - if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0) + hs_start[0] = (unsigned long long) i * GBLL / (1024 * 1024); + if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0) goto out; /* write only one hyperslab */ - if ( i==512*512) - { - if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) + if (i == 512 * 512) { + if (H5Dwrite(did, H5T_NATIVE_CHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0) goto out; } - } HDfree(buf); - buf=NULL; + buf = NULL; /* close */ - if(H5Sclose(f_sid) < 0) + if (H5Sclose(f_sid) < 0) goto out; - if(H5Sclose(m_sid) < 0) + if (H5Sclose(m_sid) < 0) goto out; - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) goto out; - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) goto out; H5Fclose(fid); @@ -7472,40 +8038,32 @@ out: H5Fclose(fid); } H5E_END_TRY; return -1; - } - /*------------------------------------------------------------------------- -* Function: write_attr -* -* Purpose: utility function to write an attribute in LOC_ID -* -*------------------------------------------------------------------------- -*/ + * Function: write_attr + * + * Purpose: utility function to write an attribute in LOC_ID + * + *------------------------------------------------------------------------- + */ static -int write_attr(hid_t loc_id, - int rank, - hsize_t *dims, - const char *name, - hid_t tid, - void *buf) +int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { - hid_t aid=-1; - hid_t sid=-1; + hid_t aid = -1; + hid_t sid = -1; /* create a space */ - if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto out; /* create the attribute */ - if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; /* write */ - if(buf) - { - if(H5Awrite(aid, tid, buf) < 0) + if (buf) { + if (H5Awrite(aid, tid, buf) < 0) goto out; } @@ -7523,35 +8081,29 @@ out: } /*------------------------------------------------------------------------- -* Function: write_dset -* -* Purpose: utility function to create and write a dataset in LOC_ID -* -*------------------------------------------------------------------------- -*/ + * Function: write_dset + * + * Purpose: utility function to create and write a dataset in LOC_ID + * + *------------------------------------------------------------------------- + */ static -int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, - const char *name, - hid_t tid, - void *buf ) +int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { - hid_t did=-1; - hid_t sid=-1; + hid_t did = -1; + hid_t sid = -1; /* create a space */ - if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto out; /* create the dataset */ - if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; /* write */ - if(buf) - { - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if (buf) { + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; } diff --git a/tools/test/h5diff/testfiles/h5diff_8639.txt b/tools/test/h5diff/testfiles/h5diff_8639.txt new file mode 100644 index 0000000..4022e06 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_8639.txt @@ -0,0 +1,72 @@ + +group1 group2 +--------------------------------------- + x x + +group : and +0 differences found +Warning: different storage datatype +Not comparable: or is of mixed string type +Warning: different storage datatype +Not comparable: or is of mixed string type +Warning: different storage datatype +Not comparable: or is of mixed string type +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +Warning: different storage datatype +Not comparable: or is of mixed string type +Warning: different storage datatype +Not comparable: or is of mixed string type +Warning: different storage datatype +Not comparable: or is of mixed string type +attribute: > and > +0 differences found +attribute: > and > +0 differences found +attribute: > and > +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. +EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_attr1.h5 b/tools/test/h5diff/testfiles/h5diff_attr1.h5 index c44066b..4cea743 100644 Binary files a/tools/test/h5diff/testfiles/h5diff_attr1.h5 and b/tools/test/h5diff/testfiles/h5diff_attr1.h5 differ diff --git a/tools/test/h5diff/testfiles/h5diff_attr2.h5 b/tools/test/h5diff/testfiles/h5diff_attr2.h5 index 5de3303..3ea3302 100644 Binary files a/tools/test/h5diff/testfiles/h5diff_attr2.h5 and b/tools/test/h5diff/testfiles/h5diff_attr2.h5 differ diff --git a/tools/test/h5diff/testfiles/h5diff_attr3.h5 b/tools/test/h5diff/testfiles/h5diff_attr3.h5 new file mode 100644 index 0000000..631845d Binary files /dev/null and b/tools/test/h5diff/testfiles/h5diff_attr3.h5 differ diff --git a/tools/test/h5diff/testfiles/h5diff_tmp2.txt b/tools/test/h5diff/testfiles/h5diff_tmp2.txt deleted file mode 100644 index a2d6da6..0000000 --- a/tools/test/h5diff/testfiles/h5diff_tmp2.txt +++ /dev/null @@ -1,13 +0,0 @@ -dataset: and -1599 differences found -dataset: and -8 differences found -dataset: and -1845 differences found -dataset: and -10 differences found --------------------------------- -Some objects are not comparable --------------------------------- -Use -c for a list of objects. -EXIT CODE: 1 diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index d9cb857..c464f94 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -82,6 +82,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_types.h5 $SRC_H5DIFF_TESTFILES/h5diff_dtypes.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_attr3.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset1.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset2.h5 $SRC_H5DIFF_TESTFILES/h5diff_hyper1.h5 @@ -118,8 +119,6 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5 $SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5 $SRC_H5DIFF_TESTFILES/non_comparables1.h5 $SRC_H5DIFF_TESTFILES/non_comparables2.h5 -$SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.reference.h5 -$SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.output.h5 $SRC_H5DIFF_TESTFILES/diff_strings1.h5 $SRC_H5DIFF_TESTFILES/diff_strings2.h5 $SRC_TOOLS_TESTFILES/tvlstr.h5 @@ -336,7 +335,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_710.txt $SRC_H5DIFF_TESTFILES/h5diff_80.txt $SRC_H5DIFF_TESTFILES/h5diff_90.txt $SRC_H5DIFF_TESTFILES/h5diff_8625.txt -$SRC_H5DIFF_TESTFILES/h5diff_tmp2.txt +$SRC_H5DIFF_TESTFILES/h5diff_8639.txt $SRC_H5DIFF_TESTFILES/h5diff_v1.txt $SRC_H5DIFF_TESTFILES/h5diff_v2.txt $SRC_H5DIFF_TESTFILES/h5diff_v3.txt @@ -818,8 +817,6 @@ TOOLTEST h5diff_631.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h # 7. attributes # ############################################################################## TOOLTEST h5diff_70.txt -v h5diff_attr1.h5 h5diff_attr2.h5 -# temporary test to verify HDFFV-8639 -TOOLTEST h5diff_tmp2.txt tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5 # ################################################## # attrs with verbose option level @@ -1143,6 +1140,8 @@ TOOLTEST h5diff_487.txt -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5 TOOLTEST h5diff_530.txt -v h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group /group_copy # test to verify HDFFV-8625 TOOLTEST h5diff_8625.txt -v --enable-error-stack h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group/Compound_dset1 /group_copy/Compound_dset3 +# test to verify HDFFV-8639 +TOOLTEST h5diff_8639.txt -v h5diff_attr3.h5 h5diff_attr2.h5 /g1 TOOLTEST h5diff_vlstr.txt -v tvlstr.h5 tvlstr2.h5 # ############################################################################## -- cgit v0.12 From db1add7e22be9ec8e44aba29b3988e6c1826fe25 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Jan 2018 10:19:21 -0600 Subject: HDFFV-8745 update release note --- release_docs/RELEASE.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3882c4c..17ec3ac 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -268,6 +268,21 @@ Bug Fixes since HDF5-1.10.1 release Tools ----- + - h5diff + + h5diff seg faulted if comparing VL strings against fixed strigs. + + Reworked solution for HDFFV-8625 and 8639. Implemented the check + for string objects of same type in the diff_can_type function by + adding an if(tclass1 == H5T_STRING) block. This if block moves the + same check that was added for attributes to this function, which is + used by all object types. This function also handles complex type + structures. + Also added a new test file in h5diffgenttest for testing this issue + and removed the temporary files used in the test scripts. + + (ADB - 2018/01/04, HDFFV-8745) + - h5repack h5repack failed to copy a dataset with existing filter. -- cgit v0.12 From db918c06b549ef8dc8d106d69da277bcf8d0aa11 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Jan 2018 10:44:02 -0600 Subject: HDFFV-8745 fix typos --- release_docs/RELEASE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 17ec3ac..b52a46f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -270,9 +270,9 @@ Bug Fixes since HDF5-1.10.1 release ----- - h5diff - h5diff seg faulted if comparing VL strings against fixed strigs. + h5diff seg faulted if comparing VL strings against fixed strings. - Reworked solution for HDFFV-8625 and 8639. Implemented the check + Reworked solution for HDFFV-8625 and HDFFV-8639. Implemented the check for string objects of same type in the diff_can_type function by adding an if(tclass1 == H5T_STRING) block. This if block moves the same check that was added for attributes to this function, which is -- cgit v0.12 From d01ad2a94ae5643090e9443dfb0ee69657d894c2 Mon Sep 17 00:00:00 2001 From: hdftest Date: Fri, 5 Jan 2018 08:50:10 -0600 Subject: Snapshot version 1.11 release 1 --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- java/src/hdf/hdf5lib/H5.java | 4 ++-- java/test/TestH5.java | 4 ++-- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- .../testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 +++++++------- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.txt b/README.txt index 6820267..e9985c2 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.0 currently under development +HDF5 version 1.11.1 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index ae5dd90..c4725c3 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.0" +PROJECT_NUMBER = "1.11.1" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index e7b73b3..011ee7b 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -38,7 +38,7 @@ cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR) # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## -set (CTEST_SOURCE_VERSION "1.11.0") +set (CTEST_SOURCE_VERSION "1.11.1") set (CTEST_SOURCE_VERSEXT "") ############################################################################## diff --git a/configure.ac b/configure.ac index 5562d5c..7a8ccbf 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.11.1], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 78ebbe2..5285ac5 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. *
* - * @version HDF5 1.11.0
+ * @version HDF5 1.11.1
* See also: hdf.hdf5lib.HDFArray
* hdf.hdf5lib.HDF5Constants
* hdf.hdf5lib.HDF5CDataTypes
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 0 }; + public final static int LIB_VERSION[] = { 1, 11, 1 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 413e58d..a45984e 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 0 }; + int libversion[] = { 1, 11, 1 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 0; + int majnum = 1, minnum = 11, relnum = 1; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3882c4c..d022526 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.0 currently under development +HDF5 version 1.11.1 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index 58d0cd1..d08e6b0 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -93,10 +93,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 11 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 0 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 1 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.0" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.11.1" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 283b44c..0821257 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 1 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 1 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 1 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 1 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 1 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 1 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 0 } + PARAMS { 9 1 11 1 } } } FILLVALUE { -- cgit v0.12 From bee148a99501e9aa582e93bfb880648a905f4301 Mon Sep 17 00:00:00 2001 From: hdftest Date: Fri, 5 Jan 2018 10:09:10 -0600 Subject: Snapshot version 1.11 release 2 --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 4 ++-- java/src/hdf/hdf5lib/H5.java | 4 ++-- java/test/TestH5.java | 4 ++-- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- .../testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 +++++++------- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.txt b/README.txt index e9985c2..759e412 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.1 currently under development +HDF5 version 1.11.2 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index c4725c3..56ea1e6 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.1" +PROJECT_NUMBER = "1.11.2" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 011ee7b..d32a6bdb 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -38,7 +38,7 @@ cmake_minimum_required (VERSION 3.2.2 FATAL_ERROR) # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## -set (CTEST_SOURCE_VERSION "1.11.1") +set (CTEST_SOURCE_VERSION "1.11.2") set (CTEST_SOURCE_VERSEXT "") ############################################################################## diff --git a/configure.ac b/configure.ac index 7a8ccbf..6bd650f 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.1], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.11.2], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) @@ -48,7 +48,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where a ## ## By default, it is enabled. Users can configure with ## --disable-maintainer-mode to prevent running the autotools. -AM_MAINTAINER_MODE([enable]) +AM_MAINTAINER_MODE([disable]) ## ---------------------------------------------------------------------- ## Set prefix default (install directory) to a directory in the build area. diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 5285ac5..20aa634 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. *
* - * @version HDF5 1.11.1
+ * @version HDF5 1.11.2
* See also: hdf.hdf5lib.HDFArray
* hdf.hdf5lib.HDF5Constants
* hdf.hdf5lib.HDF5CDataTypes
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 1 }; + public final static int LIB_VERSION[] = { 1, 11, 2 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index a45984e..b922583 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 1 }; + int libversion[] = { 1, 11, 2 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 1; + int majnum = 1, minnum = 11, relnum = 2; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index d022526..dac5876 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.1 currently under development +HDF5 version 1.11.2 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index d08e6b0..9157366 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -93,10 +93,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 11 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 1 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 2 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.1" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.11.2" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 0821257..5a1ebe7 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 1 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 1 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 1 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 1 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 1 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 1 } + PARAMS { 9 1 11 2 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 1 } + PARAMS { 9 1 11 2 } } } FILLVALUE { -- cgit v0.12 From 2a1a2c59937657cf318232e6bfde456cbd297ef1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 5 Jan 2018 11:45:44 -0600 Subject: HDDFV-10361 combine duplicated prefix utility functions --- src/H5Dvirtual.c | 319 +++------------------------ src/H5Fint.c | 331 +++++++++++++++++++++++++--- src/H5Fprivate.h | 6 + src/H5Lexternal.c | 306 ++++--------------------- tools/test/h5dump/errfiles/tall-1.err | 5 +- tools/test/h5dump/errfiles/tall-2A.err | 5 +- tools/test/h5dump/errfiles/tall-2A0.err | 5 +- tools/test/h5dump/errfiles/tall-2B.err | 5 +- tools/test/h5dump/errfiles/textlink.err | 10 +- tools/test/h5dump/errfiles/torderlinks1.err | 5 +- tools/test/h5dump/errfiles/torderlinks2.err | 5 +- 11 files changed, 415 insertions(+), 587 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 306fe62..9e1ebe8 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -147,7 +147,7 @@ H5FL_DEFINE(H5O_storage_virtual_name_seg_t); H5FL_DEFINE_STATIC(H5D_virtual_held_file_t); - + /*------------------------------------------------------------------------- * Function: H5D_virtual_check_mapping_pre * @@ -217,7 +217,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_check_mapping_pre() */ - + /*------------------------------------------------------------------------- * Function: H5D_virtual_check_mapping_post * @@ -285,7 +285,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_check_mapping_post() */ - + /*------------------------------------------------------------------------- * Function: H5D_virtual_update_min_dims * @@ -344,7 +344,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_update_min_dims() */ - + /*------------------------------------------------------------------------- * Function: H5D_virtual_check_min_dims * @@ -389,7 +389,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_check_min_dims() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_copy_layout * @@ -553,7 +553,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_copy_layout() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_reset_layout * @@ -637,7 +637,7 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_reset_layout() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_copy * @@ -683,7 +683,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_copy() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_delete * @@ -733,255 +733,6 @@ done: } /* end H5D__virtual_delete */ -/*-------------------------------------------------------------------------- - * Function: H5D__virtual_build_name - * - * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME - * - * Return: Non-negative on success/Negative on failure - *--------------------------------------------------------------------------*/ -static herr_t -H5D__virtual_build_name(char *prefix, char *file_name, char **full_name/*out*/) -{ - size_t prefix_len; /* length of prefix */ - size_t fname_len; /* Length of external link file name */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - prefix_len = HDstrlen(prefix); - fname_len = HDstrlen(file_name); - - /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") - - /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, - (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__virtual_build_name() */ - - -/*-------------------------------------------------------------------------- - * Function: H5D_getenv_prefix_name -- - * - * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, - * which is separated by the environment delimiter. - * env_prefix is modified to point to the remaining pathnames - * in the list. - * - * Return: A pointer to a pathname ---------------------------------------------------------------------------*/ -static char * -H5D_getenv_prefix_name(char **env_prefix/*in,out*/) -{ - char *retptr=NULL; - char *strret=NULL; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - strret = HDstrchr(*env_prefix, H5_COLON_SEPC); - if (strret == NULL) { - retptr = *env_prefix; - *env_prefix = strret; - } else { - retptr = *env_prefix; - *env_prefix = strret + 1; - *strret = '\0'; - } - - FUNC_LEAVE_NOAPI(retptr) -} /* end H5D_getenv_prefix_name() */ - -/*------------------------------------------------------------------------- - * Function: H5D__virtual_open_file - * - * Purpose: Attempts to open a source dataset file. - * - * Return: Non-negative on success/Negative on failure - *------------------------------------------------------------------------- - */ -static H5F_t * -H5D__virtual_open_file(hid_t plist_id, const H5F_t *vdset_file, - const char *file_name, - hid_t fapl_id, hid_t dxpl_id) -{ - H5F_t *src_file = NULL; /* Source file */ - H5F_t *ret_value = NULL; /* Actual return value */ - char *full_name = NULL; /* File name with prefix */ - char *my_prefix = NULL; /* Library's copy of the prefix */ - unsigned intent; /* File access permissions */ - char *actual_file_name = NULL; /* Virtual file's actual name */ - char *temp_file_name = NULL; /* Temporary pointer to file name */ - size_t temp_file_name_len; /* Length of temporary file name */ - - FUNC_ENTER_STATIC - - /* Simplify intent flags for open calls */ - intent = H5F_INTENT(vdset_file); - intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); - - /* Copy the file name to use */ - if(NULL == (temp_file_name = H5MM_strdup(file_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - temp_file_name_len = HDstrlen(temp_file_name); - - /* target file_name is an absolute pathname: see RM for detailed description */ - if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { - /* Try opening file */ - if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { - char *ptr; - - H5E_clear_stack(NULL); - - /* get last component of file_name */ - H5_GET_LAST_DELIMITER(file_name, ptr) - HDassert(ptr); - - /* Increment past delimiter */ - ptr++; - - /* Copy into the temp. file name */ - HDstrncpy(temp_file_name, ptr, temp_file_name_len); - temp_file_name[temp_file_name_len - 1] = '\0'; - } /* end if */ - } /* end if */ - else if(H5_CHECK_ABS_DRIVE(file_name)) { - /* Try opening file */ - if(NULL == (src_file = H5F_open(file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { - - H5E_clear_stack(NULL); - - /* strip ":" */ - HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len); - temp_file_name[temp_file_name_len - 1] = '\0'; - } /* end if */ - } /* end if */ - - /* try searching from paths set in the environment variable */ - if(src_file == NULL) { - char *env_prefix; - - if(NULL != (env_prefix = HDgetenv("HDF5_VDS_PREFIX"))) { - char *tmp_env_prefix, *saved_env; - - if(NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - while((tmp_env_prefix) && (*tmp_env_prefix)) { - char *out_prefix_name; - - out_prefix_name = H5D_getenv_prefix_name(&tmp_env_prefix/*in,out*/); - if(out_prefix_name && (*out_prefix_name)) { - if(H5D__virtual_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { - saved_env = (char *)H5MM_xfree(saved_env); - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - } /* end if */ - - src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id); - full_name = (char *)H5MM_xfree(full_name); - if(src_file != NULL) - break; - H5E_clear_stack(NULL); - } /* end if */ - } /* end while */ - saved_env = (char *)H5MM_xfree(saved_env); - } /* end if */ - } /* end if */ - - /* try searching from property list */ - if(src_file == NULL) { - size_t size = 0; - H5E_BEGIN_TRY { - size = H5Pget_virtual_prefix(plist_id, NULL, 0); - } H5E_END_TRY; - if(size <= 0) - my_prefix = NULL; - else { - /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (my_prefix = (char *)H5MM_malloc(size + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate prefix buffer") - if(H5Pget_virtual_prefix(plist_id, my_prefix, size+1) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vds prefix") - if(my_prefix) { - if(H5D__virtual_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - my_prefix = (char *)H5MM_xfree(my_prefix); - if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - full_name = (char *)H5MM_xfree(full_name); - } - } /* end if */ - } /* end if */ - - /* try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ - if(src_file == NULL) { - char *vdspath; - - if(NULL != (vdspath = H5F_EXTPATH(vdset_file))) { - if(H5D__virtual_build_name(vdspath, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ - } /* end if */ - - /* try the relative file_name stored in temp_file_name */ - if(src_file == NULL) { - if(NULL == (src_file = H5F_open(temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - } /* end if */ - - /* try the 'resolved' name for the virtual file */ - if(src_file == NULL) { - char *ptr = NULL; - - /* Copy resolved file name */ - if(NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(vdset_file)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string") - - /* get last component of file_name */ - H5_GET_LAST_DELIMITER(actual_file_name, ptr) - if(!ptr) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) - - /* Truncate filename portion from actual file name path */ - *ptr = '\0'; - - /* Build new file name for the external file */ - if(H5D__virtual_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't prepend prefix to filename") - actual_file_name = (char *)H5MM_xfree(actual_file_name); - - /* Try opening with the resolved name */ - if(NULL == (src_file = H5F_open(full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, NULL, "unable to open vds file, vds file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ - - /* Success */ - ret_value = src_file; -done: - if((NULL == ret_value) && src_file) - if(H5F_try_close(src_file, NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, NULL, "can't close source file") - if(my_prefix) - my_prefix = (char *)H5MM_xfree(my_prefix); - if(full_name) - full_name = (char *)H5MM_xfree(full_name); - if(temp_file_name) - temp_file_name = (char *)H5MM_xfree(temp_file_name); - if(actual_file_name) - actual_file_name = (char *)H5MM_xfree(actual_file_name); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__virtual_open_file() */ - - /*------------------------------------------------------------------------- * Function: H5D__virtual_open_source_dset * @@ -1000,13 +751,11 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_srcdset_t *source_dset, hid_t dxpl_id) { H5F_t *src_file = NULL; /* Source file */ - char *vds_prefix = NULL; /* Source file vds_prefix */ hbool_t src_file_open = FALSE; /* Whether we have opened and need to close src_file */ H5G_loc_t src_root_loc; /* Object location of source file root group */ herr_t ret_value = SUCCEED; /* Return value */ - char *full_name = NULL; /* File name with prefix */ - unsigned intent; /* File access permissions */ hid_t plist_id = -1; /* Property list pointer */ + unsigned intent; /* File access permissions */ FUNC_ENTER_STATIC @@ -1019,9 +768,11 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, /* Check if we need to open the source file */ if(HDstrcmp(source_dset->file_name, ".")) { - if((plist_id = H5D_get_access_plist(vdset)) < 0) + if((plist_id = H5D_get_access_plist((H5D_t *)vdset)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist") - if(NULL == (src_file = H5D__virtual_open_file(plist_id, vdset->oloc.file, source_dset->file_name, vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) + intent = H5F_INTENT(vdset->oloc.file); + if(NULL == (src_file = H5F_prefix_open_file(plist_id, vdset->oloc.file, H5D_ACS_VDS_PREFIX_NAME, source_dset->file_name, intent, + vdset->shared->layout.storage.u.virt.source_fapl, dxpl_id))) H5E_clear_stack(NULL); /* Quick hack until proper support for H5Fopen with missing file is implemented */ else src_file_open = TRUE; @@ -1062,13 +813,13 @@ done: H5Pclose(plist_id); /* Close source file */ if(src_file_open) - if(H5F_try_close(src_file, NULL) < 0) + if(H5F_efc_close(vdset->oloc.file, src_file) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "can't close source file") FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_open_source_dset() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_reset_source_dset * @@ -1155,7 +906,7 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent, FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_reset_source_dset() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_str_append * @@ -1231,7 +982,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5D__virtual_str_append() */ - + /*------------------------------------------------------------------------- * Function: H5D_virtual_parse_source_name * @@ -1347,7 +1098,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_parse_source_name() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_copy_parsed_name * @@ -1404,7 +1155,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_copy_parsed_name() */ - + /*------------------------------------------------------------------------- * Function: H5D_virtual_free_parsed_name * @@ -1437,7 +1188,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_free_parsed_name() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_build_source_name * @@ -1539,7 +1290,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_build_source_name() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_set_extent_unlim * @@ -1967,7 +1718,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_set_extent_unlim() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_init_all * @@ -2191,7 +1942,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_init_all() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_init * @@ -2286,7 +2037,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_init() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_is_space_alloc * @@ -2318,7 +2069,7 @@ H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_is_space_alloc() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_pre_io * @@ -2559,7 +2310,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_pre_io() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_post_io * @@ -2609,7 +2360,7 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage) FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_post_io() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_read_one * @@ -2666,7 +2417,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_read_one() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_read * @@ -2799,7 +2550,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_read() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_write_one * @@ -2858,7 +2609,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_write_one() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_write * @@ -2935,7 +2686,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_write() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_flush * @@ -2983,7 +2734,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_flush() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_hold_source_dset_files * @@ -3061,7 +2812,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_hold_source_dset_files() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_refresh_source_dset * @@ -3101,7 +2852,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_refresh_source_dsets() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_refresh_source_dsets * @@ -3154,7 +2905,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_refresh_source_dsets() */ - + /*------------------------------------------------------------------------- * Function: H5D__virtual_release_source_dset_files * diff --git a/src/H5Fint.c b/src/H5Fint.c index 8212eb5..b135ce1 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -30,6 +30,7 @@ #include "H5FDprivate.h" /* File drivers */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ @@ -98,7 +99,7 @@ H5FL_DEFINE(H5F_t); /* Declare a free list to manage the H5F_file_t struct */ H5FL_DEFINE(H5F_file_t); - + /*------------------------------------------------------------------------- * Function: H5F_get_access_plist * @@ -213,7 +214,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_access_plist() */ - + /*------------------------------------------------------------------------- * Function: H5F_get_obj_count * @@ -241,7 +242,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_obj_count() */ - + /*------------------------------------------------------------------------- * Function: H5F_get_obj_ids * @@ -268,7 +269,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_obj_ids() */ - + /*--------------------------------------------------------------------------- * Function: H5F_get_objects * @@ -370,7 +371,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_objects() */ - + /*------------------------------------------------------------------------- * Function: H5F_get_objects_cb * @@ -479,7 +480,265 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_objects_cb() */ - +/*-------------------------------------------------------------------------- + * Function: H5F_build_name + * + * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME + * + * Return: Non-negative on success/Negative on failure + *--------------------------------------------------------------------------*/ +herr_t +H5F_build_name(char *prefix, char *file_name, char **full_name/*out*/) +{ + size_t prefix_len; /* length of prefix */ + size_t fname_len; /* Length of external link file name */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + prefix_len = HDstrlen(prefix); + fname_len = HDstrlen(file_name); + + /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ + if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") + + /* Compose the full file name */ + HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, + (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_build_name() */ + + +/*-------------------------------------------------------------------------- + * Function: H5F_getenv_prefix_name -- + * + * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, + * which is separated by the environment delimiter. + * env_prefix is modified to point to the remaining pathnames + * in the list. + * + * Return: A pointer to a pathname +--------------------------------------------------------------------------*/ +char * +H5F_getenv_prefix_name(char **env_prefix/*in,out*/) +{ + char *retptr=NULL; + char *strret=NULL; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + strret = HDstrchr(*env_prefix, H5_COLON_SEPC); + if (strret == NULL) { + retptr = *env_prefix; + *env_prefix = strret; + } else { + retptr = *env_prefix; + *env_prefix = strret + 1; + *strret = '\0'; + } + + FUNC_LEAVE_NOAPI(retptr) +} /* end H5F_getenv_prefix_name() */ + +/*------------------------------------------------------------------------- + * Function: H5F_prefix_open_file + * + * Purpose: Attempts to open a dataset file. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +H5F_t * +H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_type, + const char *file_name, unsigned file_intent, hid_t fapl_id, hid_t dxpl_id) +{ + H5F_t *src_file = NULL; /* Source file */ + H5F_t *ret_value = NULL; /* Actual return value */ + char *full_name = NULL; /* File name with prefix */ + char *my_prefix = NULL; /* Library's copy of the prefix */ + char *actual_file_name = NULL; /* File's actual name */ + char *temp_file_name = NULL; /* Temporary pointer to file name */ + size_t temp_file_name_len; /* Length of temporary file name */ + + FUNC_ENTER_STATIC + + /* Simplify intent flags for open calls */ + file_intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); + + /* Copy the file name to use */ + if(NULL == (temp_file_name = H5MM_strdup(file_name))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + temp_file_name_len = HDstrlen(temp_file_name); + + /* target file_name is an absolute pathname: see RM for detailed description */ + if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { + /* Try opening file */ + if(NULL == (src_file = H5F_efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { + char *ptr; + + H5E_clear_stack(NULL); + + /* get last component of file_name */ + H5_GET_LAST_DELIMITER(file_name, ptr) + HDassert(ptr); + + /* Increment past delimiter */ + ptr++; + + /* Copy into the temp. file name */ + HDstrncpy(temp_file_name, ptr, temp_file_name_len); + temp_file_name[temp_file_name_len - 1] = '\0'; + } /* end if */ + } /* end if */ + else if(H5_CHECK_ABS_DRIVE(file_name)) { + /* Try opening file */ + if(NULL == (src_file = H5F_efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { + + H5E_clear_stack(NULL); + + /* strip ":" */ + HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len); + temp_file_name[temp_file_name_len - 1] = '\0'; + } /* end if */ + } /* end if */ + + /* try searching from paths set in the environment variable */ + if(src_file == NULL) { + char *env_prefix; + + if (HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) + env_prefix = HDgetenv("HDF5_VDS_PREFIX"); + else if (HDstrcmp(prefix_type, H5L_ACS_ELINK_PREFIX_NAME) == 0) + env_prefix = HDgetenv("HDF5_EXT_PREFIX"); + else + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "prefix name is not sensible") + if(NULL != env_prefix) { + char *tmp_env_prefix, *saved_env; + + if(NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + while((tmp_env_prefix) && (*tmp_env_prefix)) { + char *out_prefix_name; + + out_prefix_name = H5F_getenv_prefix_name(&tmp_env_prefix/*in,out*/); + if(out_prefix_name && (*out_prefix_name)) { + if(H5F_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { + saved_env = (char *)H5MM_xfree(saved_env); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + } /* end if */ + + src_file = H5F_efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id); + full_name = (char *)H5MM_xfree(full_name); + if(src_file != NULL) + break; + H5E_clear_stack(NULL); + } /* end if */ + } /* end while */ + saved_env = (char *)H5MM_xfree(saved_env); + } /* end if */ + } /* end if */ + + /* try searching from property list */ + if(src_file == NULL) { + ssize_t size = 0; + H5E_BEGIN_TRY { + if (HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) + size = H5Pget_virtual_prefix(plist_id, NULL, 0); + else if (HDstrcmp(prefix_type, H5L_ACS_ELINK_PREFIX_NAME) == 0) + size = H5Pget_elink_prefix(plist_id, NULL, 0); + } H5E_END_TRY; + if(size <= 0) + my_prefix = NULL; + else { + /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ + if(NULL == (my_prefix = (char *)H5MM_malloc((size_t)size + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate prefix buffer") + if (HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) + size = H5Pget_virtual_prefix(plist_id, my_prefix, (size_t)size+1); + else if (HDstrcmp(prefix_type, H5L_ACS_ELINK_PREFIX_NAME) == 0) + size = H5Pget_elink_prefix(plist_id, my_prefix, (size_t)size+1); + if(size < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file prefix") + if(my_prefix) { + if(H5F_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + my_prefix = (char *)H5MM_xfree(my_prefix); + if(NULL == (src_file = H5F_efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + full_name = (char *)H5MM_xfree(full_name); + } + } + } + + /* try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ + if(src_file == NULL) { + char *dspath; + + if(NULL != (dspath = H5F_EXTPATH(primary_file))) { + if(H5F_build_name(dspath, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + if(NULL == (src_file = H5F_efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + full_name = (char *)H5MM_xfree(full_name); + } /* end if */ + } /* end if */ + + /* try the relative file_name stored in temp_file_name */ + if(src_file == NULL) { + if(NULL == (src_file = H5F_efc_open(primary_file, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + H5E_clear_stack(NULL); + } /* end if */ + + /* try the 'resolved' name for the virtual file */ + if(src_file == NULL) { + char *ptr = NULL; + + /* Copy resolved file name */ + if(NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(primary_file)))) + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string") + + /* get last component of file_name */ + H5_GET_LAST_DELIMITER(actual_file_name, ptr) + if(!ptr) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file, file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) + + /* Truncate filename portion from actual file name path */ + *ptr = '\0'; + + /* Build new file name for the external file */ + if(H5F_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + actual_file_name = (char *)H5MM_xfree(actual_file_name); + + /* Try opening with the resolved name */ + if(NULL == (src_file = H5F_efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file, file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) + full_name = (char *)H5MM_xfree(full_name); + } /* end if */ + + /* Success */ + ret_value = src_file; +done: + if((NULL == ret_value) && src_file) + if(H5F_efc_close(primary_file, src_file) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close source file") + if(my_prefix) + my_prefix = (char *)H5MM_xfree(my_prefix); + if(full_name) + full_name = (char *)H5MM_xfree(full_name); + if(temp_file_name) + temp_file_name = (char *)H5MM_xfree(temp_file_name); + if(actual_file_name) + actual_file_name = (char *)H5MM_xfree(actual_file_name); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_prefix_open_file() */ + + /*------------------------------------------------------------------------- * Function: H5F__is_hdf5 * @@ -528,7 +787,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__is_hdf5() */ - + /*------------------------------------------------------------------------- * Function: H5F_new * @@ -792,7 +1051,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_new() */ - + /*------------------------------------------------------------------------- * Function: H5F__dest * @@ -1051,7 +1310,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush) FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_dest() */ - + /*------------------------------------------------------------------------- * Function: H5F_open * @@ -1469,7 +1728,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_open() */ - + /*------------------------------------------------------------------------- * Function: H5F_flush_phase1 * @@ -1506,7 +1765,7 @@ H5F__flush_phase1(H5F_t *f, hid_t meta_dxpl_id) FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__flush_phase1() */ - + /*------------------------------------------------------------------------- * Function: H5F__flush_phase2 * @@ -1568,7 +1827,7 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__flush_phase2() */ - + /*------------------------------------------------------------------------- * Function: H5F__flush * @@ -1600,7 +1859,7 @@ H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing) FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__flush() */ - + /*------------------------------------------------------------------------- * Function: H5F_close * @@ -1661,7 +1920,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_close() */ - + /*------------------------------------------------------------------------- * Function: H5F_try_close * @@ -1834,7 +2093,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_try_close() */ - + /*------------------------------------------------------------------------- * Function: H5F_get_id * @@ -1870,7 +2129,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_id() */ - + /*------------------------------------------------------------------------- * Function: H5F_incr_nopen_objs * @@ -1891,7 +2150,7 @@ H5F_incr_nopen_objs(H5F_t *f) FUNC_LEAVE_NOAPI(++f->nopen_objs) } /* end H5F_incr_nopen_objs() */ - + /*------------------------------------------------------------------------- * Function: H5F_decr_nopen_objs * @@ -1912,7 +2171,7 @@ H5F_decr_nopen_objs(H5F_t *f) FUNC_LEAVE_NOAPI(--f->nopen_objs) } /* end H5F_decr_nopen_objs() */ - + /*------------------------------------------------------------------------- * Function: H5F_build_actual_name * @@ -2034,7 +2293,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_build_actual_name() */ - + /*------------------------------------------------------------------------- * Function: H5F_addr_encode_len * @@ -2071,7 +2330,7 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr) FUNC_LEAVE_NOAPI_VOID } /* end H5F_addr_encode_len() */ - + /*------------------------------------------------------------------------- * Function: H5F_addr_encode * @@ -2095,7 +2354,7 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) FUNC_LEAVE_NOAPI_VOID } /* end H5F_addr_encode() */ - + /*------------------------------------------------------------------------- * Function: H5F_addr_decode_len * @@ -2159,7 +2418,7 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr FUNC_LEAVE_NOAPI_VOID } /* end H5F_addr_decode_len() */ - + /*------------------------------------------------------------------------- * Function: H5F_addr_decode * @@ -2186,7 +2445,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o FUNC_LEAVE_NOAPI_VOID } /* end H5F_addr_decode() */ - + /*------------------------------------------------------------------------- * Function: H5F_set_grp_btree_shared * @@ -2212,7 +2471,7 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_set_grp_btree_shared() */ - + /*------------------------------------------------------------------------- * Function: H5F_set_sohm_addr * @@ -2237,7 +2496,7 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_set_sohm_addr() */ - + /*------------------------------------------------------------------------- * Function: H5F_set_sohm_vers * @@ -2262,7 +2521,7 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_set_sohm_vers() */ - + /*------------------------------------------------------------------------- * Function: H5F_set_sohm_nindexes * @@ -2287,7 +2546,7 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_set_sohm_nindexes() */ - + /*------------------------------------------------------------------------- * Function: H5F_set_store_msg_crt_idx * @@ -2312,7 +2571,7 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_set_store_msg_crt_idx() */ - + /*------------------------------------------------------------------------- * Function: H5F_get_file_image * @@ -2428,7 +2687,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_get_file_image() */ - + /*------------------------------------------------------------------------- * Function: H5F_track_metadata_read_retries * @@ -2476,7 +2735,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_track_metadata_read_retries() */ - + /*------------------------------------------------------------------------- * Function: H5F_set_retries * @@ -2512,7 +2771,7 @@ H5F_set_retries(H5F_t *f) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_set_retries() */ - + /*------------------------------------------------------------------------- * Function: H5F_object_flush_cb * @@ -2542,7 +2801,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_object_flush_cb() */ - + /*------------------------------------------------------------------------- * Function: H5F__set_base_addr * @@ -2569,7 +2828,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__set_base_addr() */ - + /*------------------------------------------------------------------------- * Function: H5F__set_eoa * @@ -2596,7 +2855,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__set_eoa() */ - + /*------------------------------------------------------------------------- * Function: H5F__set_paged_aggr * @@ -2625,7 +2884,7 @@ done: } /* end H5F__set_paged_aggr() */ #ifdef H5_HAVE_PARALLEL - + /*------------------------------------------------------------------------- * Function: H5F_set_coll_md_read * @@ -2650,7 +2909,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) } /* H5F_set_coll_md_read() */ #endif /* H5_HAVE_PARALLEL */ - + /*------------------------------------------------------------------------- * Function: H5F_set_latest_flags * diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 96b8e36..ba94069 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -863,6 +863,12 @@ H5_DLL H5F_t *H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id); H5_DLL herr_t H5F_efc_close(H5F_t *parent, H5F_t *file); +/* File prefix routines */ +H5_DLL herr_t H5F_build_name(char *prefix, char *file_name, char **full_name); +H5_DLL char * H5F_getenv_prefix_name(char **env_prefix); +H5F_t *H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_type, + const char *file_name, unsigned file_intent, hid_t fapl_id, hid_t dxpl_id); + /* Global heap CWFS routines */ H5_DLL herr_t H5F_cwfs_add(H5F_t *f, struct H5HG_heap_t *heap); H5_DLL herr_t H5F_cwfs_find_free_heap(H5F_t *f, hid_t dxpl_id, size_t need, haddr_t *addr); diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index b4a173f..bf0a044 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -15,7 +15,7 @@ /* Module Setup */ /****************/ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #include "H5Lmodule.h" /* This source code file is part of the H5L module */ @@ -25,8 +25,9 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ #include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lpkg.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5Opublic.h" /* File objects */ @@ -79,7 +80,7 @@ static ssize_t H5L_extern_query(const char H5_ATTR_UNUSED * link_name, const voi /* Default External Link link class */ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - H5L_TYPE_EXTERNAL, /* Link type id number */ + H5L_TYPE_EXTERNAL, /* Link type id number */ "external", /* Link name for debugging */ NULL, /* Creation callback */ NULL, /* Move callback */ @@ -89,82 +90,10 @@ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ H5L_extern_query /* Query callback */ }}; - - -/*-------------------------------------------------------------------------- - * Function: H5L_getenv_prefix_name -- - * - * Purpose: Get the first pathname in the list of pathnames stored in ENV_PREFIX, - * which is separated by the environment delimiter. - * ENV_PREFIX is modified to point to the remaining pathnames - * in the list. - * - * Return: A pointer to a pathname - * - * Programmer: Vailin Choi, April 2, 2008 - * ---------------------------------------------------------------------------*/ -static char * -H5L_getenv_prefix_name(char **env_prefix/*in,out*/) -{ - char *retptr=NULL; - char *strret=NULL; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - strret = HDstrchr(*env_prefix, H5_COLON_SEPC); - if (strret == NULL) { - retptr = *env_prefix; - *env_prefix = strret; - } else { - retptr = *env_prefix; - *env_prefix = strret + 1; - *strret = '\0'; - } - - FUNC_LEAVE_NOAPI(retptr) -} /* end H5L_getenv_prefix_name() */ - - -/*-------------------------------------------------------------------------- - * Function: H5L_build_name - * - * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi, April 2, 2008 - * ---------------------------------------------------------------------------*/ -static herr_t -H5L_build_name(char *prefix, char *file_name, char **full_name/*out*/) -{ - size_t prefix_len; /* length of prefix */ - size_t fname_len; /* Length of external link file name */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - prefix_len = HDstrlen(prefix); - fname_len = HDstrlen(file_name); - - /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") - - /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, - (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_build_name() */ - - /*------------------------------------------------------------------------- - * Function: H5L_extern_traverse + * Function: H5L_extern_traverse * - * Purpose: Default traversal function for external links. This can + * Purpose: Default traversal function for external links. This can * be overridden using H5Lregister(). * * Given a filename and path packed into the link udata, @@ -173,25 +102,25 @@ done: * link access property list, appends that prefix to the * filename being opened. * - * Return: ID of the opened object on success/Negative on failure + * Return: ID of the opened object on success/Negative on failure * - * Programmer: James Laird + * Programmer: James Laird * Monday, July 10, 2006 * Modifications: - * Vailin Choi, April 2, 2008 - * Add handling to search for the target file - * See description in RM: H5Lcreate_external + * Vailin Choi, April 2, 2008 + * Add handling to search for the target file + * See description in RM: H5Lcreate_external * - * Vailin Choi; Sept. 12th, 2008; bug #1247 - * Retrieve the file access property list identifer that is set - * for link access property via H5Pget_elink_fapl(). - * If the return value is H5P_DEFAULT, the parent's file access - * property is used to H5F_open() the target file; - * Otherwise, the file access property retrieved from H5Pget_elink_fapl() - * is used to H5F_open() the target file. + * Vailin Choi; Sept. 12th, 2008; bug #1247 + * Retrieve the file access property list identifer that is set + * for link access property via H5Pget_elink_fapl(). + * If the return value is H5P_DEFAULT, the parent's file access + * property is used to H5F_open() the target file; + * Otherwise, the file access property retrieved from H5Pget_elink_fapl() + * is used to H5F_open() the target file. * - * Vailin Choi; Nov 2010 - * Free memory pointed to by tmp_env_prefix for HDF5_EXT_PREFIX case. + * Vailin Choi; Nov 2010 + * Free memory pointed to by tmp_env_prefix for HDF5_EXT_PREFIX case. * *------------------------------------------------------------------------- */ @@ -200,13 +129,11 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *_udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id) { H5P_genplist_t *plist; /* Property list pointer */ - char *my_prefix; /* Library's copy of the prefix */ H5G_loc_t root_loc; /* Location of root group in external file */ H5G_loc_t loc; /* Location of object */ - H5F_t *ext_file = NULL; /* File struct for external file */ + H5F_t *ext_file = NULL; /* File struct for external file */ const uint8_t *p = (const uint8_t *)_udata; /* Pointer into external link buffer */ const char *file_name; /* Name of file containing external link's object */ - char *full_name = NULL; /* File name with prefix */ const char *obj_name; /* Name external link's object */ size_t fname_len; /* Length of external link file name */ unsigned intent; /* File access permissions */ @@ -215,11 +142,8 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, hid_t ext_obj = -1; /* ID for external link's object */ char *parent_group_name = NULL;/* Temporary pointer to group name */ char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */ - char *temp_file_name = NULL; /* Temporary pointer to file name */ - size_t temp_file_name_len; /* Length of temporary file name */ - char *actual_file_name = NULL; /* Parent file's actual name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ - H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ + H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -266,7 +190,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, intent = H5F_INTENT(loc.oloc->file); if((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0)) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") /* Get callback_info */ if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) @@ -274,7 +198,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Get file access property list */ if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Make callback if it exists */ if(cb_info.func) { @@ -314,143 +238,11 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Set file close degree for new file to "weak" */ if(H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") - - /* - * Start searching for the target file - */ - - /* Simplify intent flags for open calls */ - intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); - - /* Copy the file name to use */ - if(NULL == (temp_file_name = H5MM_strdup(file_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - temp_file_name_len = HDstrlen(temp_file_name); - - /* target file_name is an absolute pathname: see RM for detailed description */ - if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { - /* Try opening file */ - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { - char *ptr; - - H5E_clear_stack(NULL); - - /* get last component of file_name */ - H5_GET_LAST_DELIMITER(file_name, ptr) - HDassert(ptr); - - /* Increment past delimiter */ - ptr++; - - /* Copy into the temp. file name */ - HDstrncpy(temp_file_name, ptr, temp_file_name_len); - temp_file_name[temp_file_name_len - 1] = '\0'; - } /* end if */ - } /* end if */ - else if(H5_CHECK_ABS_DRIVE(file_name)) { - /* Try opening file */ - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { - - H5E_clear_stack(NULL); - - /* strip ":" */ - HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len); - temp_file_name[temp_file_name_len - 1] = '\0'; - } /* end if */ - } /* end if */ - - /* try searching from paths set in the environment variable */ - if(ext_file == NULL) { - char *env_prefix; - - if(NULL != (env_prefix = HDgetenv("HDF5_EXT_PREFIX"))) { - char *tmp_env_prefix, *saved_env; - - if(NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) - HGOTO_ERROR(H5E_LINK, H5E_NOSPACE, FAIL, "memory allocation failed") - - while((tmp_env_prefix) && (*tmp_env_prefix)) { - char *out_prefix_name; - - out_prefix_name = H5L_getenv_prefix_name(&tmp_env_prefix/*in,out*/); - if(out_prefix_name && (*out_prefix_name)) { - if(H5L_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { - saved_env = (char *)H5MM_xfree(saved_env); - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") - } /* end if */ - - ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id); - full_name = (char *)H5MM_xfree(full_name); - if(ext_file != NULL) - break; - H5E_clear_stack(NULL); - } /* end if */ - } /* end while */ - saved_env = (char *)H5MM_xfree(saved_env); - } /* end if */ - } /* end if */ - - /* try searching from property list */ - if(ext_file == NULL) { - if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") - if(my_prefix) { - if(H5L_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ - } /* end if */ - - /* try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ - if(ext_file == NULL) { - char *extpath; - - if(NULL != (extpath = H5F_EXTPATH(loc.oloc->file))) { - if(H5L_build_name(extpath, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ - } /* end if */ - - /* try the relative file_name stored in temp_file_name */ - if(ext_file == NULL) { - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - H5E_clear_stack(NULL); - } /* end if */ - - /* try the 'resolved' name for the parent file (i.e. the name after symlinks - * were resolved) - */ - if(ext_file == NULL) { - char *ptr = NULL; - - /* Copy resolved file name */ - if(NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(loc.oloc->file)))) - HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't duplicate resolved file name string") - - /* get last component of file_name */ - H5_GET_LAST_DELIMITER(actual_file_name, ptr) - if(!ptr) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) - - /* Truncate filename portion from actual file name path */ - *ptr = '\0'; - - /* Build new file name for the external file */ - if(H5L_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") - - /* Try opening with the resolved name */ - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) - full_name = (char *)H5MM_xfree(full_name); - } /* end if */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + /* Search for the target file */ + if(NULL == (ext_file = H5F_prefix_open_file(lapl_id, loc.oloc->file, H5L_ACS_ELINK_PREFIX_NAME, file_name, intent, fapl_id, dxpl_id))) + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s'", file_name) /* Retrieve the "group location" for the file's root group */ if(H5G_root_loc(ext_file, &root_loc) < 0) @@ -471,10 +263,6 @@ done: HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "problem closing external file") if(parent_group_name && parent_group_name != local_group_name) parent_group_name = (char *)H5MM_xfree(parent_group_name); - full_name = (char *)H5MM_xfree(full_name); - temp_file_name = (char *)H5MM_xfree(temp_file_name); - actual_file_name = (char *)H5MM_xfree(actual_file_name); - if(ret_value < 0) { /* Close object if it's open and something failed */ if(ext_obj >= 0 && H5I_dec_ref(ext_obj) < 0) @@ -484,20 +272,20 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_extern_traverse() */ - + /*------------------------------------------------------------------------- - * Function: H5L_extern_query + * Function: H5L_extern_query * - * Purpose: Default query function for external links. This can + * Purpose: Default query function for external links. This can * be overridden using H5Lregister(). * * Returns the size of the link's user data. If a buffer of * is provided, copies at most buf_size bytes of the udata * into it. * - * Return: Size of buffer on success/Negative on failure + * Return: Size of buffer on success/Negative on failure * - * Programmer: James Laird + * Programmer: James Laird * Monday, July 10, 2006 * *------------------------------------------------------------------------- @@ -534,23 +322,23 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_extern_query() */ - + /*------------------------------------------------------------------------- - * Function: H5Lcreate_external + * Function: H5Lcreate_external * - * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. + * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. * * External links are links to objects in other HDF5 files. They * are allowed to "dangle" like soft links internal to a file. * FILE_NAME is the name of the file that OBJ_NAME is is contained * within. If OBJ_NAME is given as a relative path name, the * path will be relative to the root group of FILE_NAME. - * LINK_NAME is interpreted relative to LINK_LOC_ID, which is + * LINK_NAME is interpreted relative to LINK_LOC_ID, which is * either a file ID or a group ID. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 18, 2005 * *------------------------------------------------------------------------- @@ -559,14 +347,14 @@ herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; /* Group location to create link */ - char *norm_obj_name = NULL; /* Pointer to normalized current name */ + H5G_loc_t link_loc; /* Group location to create link */ + char *norm_obj_name = NULL; /* Pointer to normalized current name */ void *ext_link_buf = NULL; /* Buffer to contain external link */ size_t buf_size; /* Size of buffer to hold external link */ 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_ind_read_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -575,13 +363,13 @@ H5Lcreate_external(const char *file_name, const char *obj_name, /* Check arguments */ if(!file_name || !*file_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name specified") if(H5G_loc(link_loc_id, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") /* Get normalized copy of the link target */ if(NULL == (norm_obj_name = H5G_normalize(obj_name))) @@ -616,7 +404,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_external() */ - + /*------------------------------------------------------------------------- * Function: H5L_register_external * @@ -645,7 +433,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_register_external() */ - + /*------------------------------------------------------------------------- * Function: H5Lunpack_elink_val * diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index ab9dbe3..5bfb451 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -20,6 +20,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index ab9dbe3..5bfb451 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -20,6 +20,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index ab9dbe3..5bfb451 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -20,6 +20,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index ab9dbe3..5bfb451 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -20,6 +20,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 95556db..fbbfb12 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -20,9 +20,12 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'filename', temp_file_name = 'filename' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + major: File accessibilty + minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header @@ -45,6 +48,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'anotherfile', temp_file_name = 'anotherfile' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index e665f03..b72872d 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -20,6 +20,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'fname', temp_file_name = 'fname' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibilty + minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index e665f03..b72872d 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -20,6 +20,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'fname', temp_file_name = 'fname' + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibilty + minor: Unable to open file -- cgit v0.12 From 804d89f596869635318fbcc20723034bd737619c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 5 Jan 2018 13:58:23 -0600 Subject: HDFFV-10361 Update release note for vds prefix --- release_docs/RELEASE.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b52a46f..a7e56f7 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -65,13 +65,15 @@ New Features on the virtual file, using a data access property list (DAPL), allows the source files to located at an absolute or relative path to the virtual file. + Private utility functions in H5D and H5L packages merged into single + function in H5F package. New public APIs: herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix); ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); The prefix can also be set with an environment variable, HDF5_VDS_PREFIX. - (ADB - 2017/12/12, HDFFV-9724) + (ADB - 2017/12/12, HDFFV-9724, HDFFV-10361) Parallel Library: -- cgit v0.12 From be42e047913c332f148db3b8a9180e6a2eb5c23a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jan 2018 09:56:28 -0600 Subject: HDFFV-10385 refactor CMAKE_BUILD_TYPE usage --- CMakeLists.txt | 6 +++-- config/cmake/HDFCompilerFlags.cmake | 6 ++--- config/cmake/libhdf5.settings.cmake.in | 6 ++--- config/cmake_ext_mod/HDFMacros.cmake | 39 +++++++++++++++++++++++++++---- config/cmake_ext_mod/HDFUseFortran.cmake | 8 +++++++ fortran/src/CMakeLists.txt | 14 ++++------- fortran/test/CMakeLists.txt | 14 ++++------- hl/fortran/src/CMakeLists.txt | 14 ++++------- java/examples/datasets/CMakeLists.txt | 2 +- java/examples/datatypes/CMakeLists.txt | 2 +- java/examples/groups/CMakeLists.txt | 2 +- java/examples/intro/CMakeLists.txt | 2 +- java/src/jni/CMakeLists.txt | 2 +- java/test/CMakeLists.txt | 2 +- release_docs/RELEASE.txt | 25 ++++++++++++++++---- test/CMakeTests.cmake | 2 +- testpar/CMakeLists.txt | 4 ++-- tools/src/h5copy/CMakeLists.txt | 7 +++--- tools/src/h5diff/CMakeLists.txt | 7 +++--- tools/src/h5dump/CMakeLists.txt | 7 +++--- tools/src/h5format_convert/CMakeLists.txt | 6 +++-- tools/src/h5import/CMakeLists.txt | 6 +++-- tools/src/h5jam/CMakeLists.txt | 6 +++-- tools/src/h5ls/CMakeLists.txt | 7 +++--- tools/src/h5repack/CMakeLists.txt | 7 +++--- tools/src/h5stat/CMakeLists.txt | 7 +++--- tools/src/misc/CMakeLists.txt | 8 +++---- 27 files changed, 129 insertions(+), 89 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4e6300..5be2f03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -409,6 +409,8 @@ include (${HDF_RESOURCES_EXT_DIR}/HDFMacros.cmake) include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake) include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake) +SET_HDF5_BUILD_TYPE() + #----------------------------------------------------------------------------- # Setup output Directories #----------------------------------------------------------------------------- @@ -426,7 +428,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." ) if (WIN32) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}) set (CMAKE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." ) @@ -582,7 +584,7 @@ option (HDF5_BUILD_GENERATORS "Build Test Generators" OFF) #----------------------------------------------------------------------------- option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF) mark_as_advanced (HDF5_ENABLE_TRACE) -if (CMAKE_BUILD_TYPE MATCHES Debug) +if (HDF5_BUILD_TYPE MATCHES Debug) add_definitions (-DDEBUG) # Enable tracing of the API if (HDF5_ENABLE_TRACE) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 5f71f33..eeb4b97 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -13,12 +13,12 @@ # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (HDF5_BUILD_TYPE MATCHES Debug) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () - else (CMAKE_BUILD_TYPE MATCHES Debug) + else (HDF5_BUILD_TYPE MATCHES Debug) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") @@ -26,7 +26,7 @@ if (CMAKE_COMPILER_IS_GNUCC) endif () endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (HDF5_BUILD_TYPE MATCHES Debug) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 8348af0..28fb876 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -1,5 +1,5 @@ - SUMMARY OF THE HDF5 CONFIGURATION - ================================= + SUMMARY OF THE HDF5 CONFIGURATION + ================================= General Information: ------------------- @@ -13,7 +13,7 @@ General Information: Compiling Options: ------------------ - Build Mode: @CMAKE_BUILD_TYPE@ + Build Mode: @HDF5_BUILD_TYPE@ Debugging Symbols: @SYMBOLS@ Asserts: @ASSERTS@ Profiling: @PROFILING@ diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 192a5c8..dd7e262 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -9,6 +9,37 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # + +#------------------------------------------------------------------------------- +macro (SET_HDF5_BUILD_TYPE) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) + set(HDF5_BUILD_TYPE ${CMAKE_CFG_INTDIR}) + else() + if(CMAKE_BUILD_TYPE) + set(HDF5_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + else() + set(HDF5_BUILD_TYPE) + endif() + endif() +endmacro () + +#------------------------------------------------------------------------------- +macro (CREATE_CONFIG_DIR path) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) + foreach(c ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) + file(MAKE_DIRECTORY "${path}/${c}") + endforeach() + else() + if(CMAKE_BUILD_TYPE) + file(MAKE_DIRECTORY "${path}/${CMAKE_BUILD_TYPE}") + else() + file(MAKE_DIRECTORY "${path}") + endif() + endif() +endmacro () + #------------------------------------------------------------------------------- macro (SET_GLOBAL_VARIABLE name value) set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE) @@ -145,7 +176,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${CMAKE_BUILD_TYPE} MATCHES "Debug") + if (${HDF5_BUILD_TYPE} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) @@ -160,8 +191,8 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) ) else () set_target_properties (${libtarget} PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) endif () else () @@ -181,7 +212,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) else () if (WIN32 AND NOT MINGW) set_target_properties (${libtarget} PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) else () diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index 7bf4d81..5be2c49 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -15,6 +15,14 @@ #------------------------------------------------------------------------------- ENABLE_LANGUAGE (Fortran) +#------------------------------------------------------------------------------- +# Fix Fortran flags if we are compiling staticly on Windows using +# Windows_MT.cmake from config/cmake/UserMacros +#------------------------------------------------------------------------------- +if (BUILD_STATIC_CRT_LIBS) + TARGET_STATIC_CRT_FLAGS () +endif () + #----------------------------------------------------------------------------- # Detect name mangling convention used between Fortran and C #----------------------------------------------------------------------------- diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 18d6d80..692509b 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -66,17 +66,11 @@ set_target_properties (H5_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - if (WIN32) - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) - else () - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif () -endif () -if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${CMAKE_BUILD_TYPE}) -else () - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_BUILD_TYPE}) endif () +CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/static) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_BUILD_TYPE}) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 3c3eb8f..f536bf2 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -34,17 +34,11 @@ set_target_properties (H5_test_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - if (WIN32) - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) - else () - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif () -endif () -if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${CMAKE_BUILD_TYPE}) -else () - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_BUILD_TYPE}) endif () +CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/static) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_BUILD_TYPE}) INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 3fc66c4..90ee19b 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -38,17 +38,11 @@ set_target_properties (H5HL_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") - if (WIN32) - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) - else () - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - endif () -endif () -if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${CMAKE_BUILD_TYPE}) -else () - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_BUILD_TYPE}) endif () +CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/static) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_BUILD_TYPE}) #----------------------------------------------------------------------------- # Setup include Directories diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 3972ec8..dd007f5 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -62,7 +62,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (HDF5_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 8569b8b..fac8158 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -62,7 +62,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (HDF5_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index b912208..7f2801a 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -61,7 +61,7 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (HDF5_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 9dc4dd7..a21d369 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -63,7 +63,7 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (HDF5_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 10d1b6d..90343b2 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -57,7 +57,7 @@ SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED ${HDF5_JAVA_PACKAGE_SOVERSION}) if (WIN32) get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (HDF5_BUILD_TYPE MATCHES Debug) set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}_D") endif () # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 8912b3f..fadc1ea 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -88,7 +88,7 @@ endforeach () set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}") set (testfilter "OK (598 tests)") -if (CMAKE_BUILD_TYPE MATCHES Debug) +if (HDF5_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7f2f8b4..1dc5bd1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -54,7 +54,15 @@ New Features Configuration: ------------- - - + - CMake + + Refactor use of CMAKE_BUILD_TYPE for new variable, which understands + the type of generator in use. + + Added new configuration macros to use new HDF5_BUILD_TYPE variable. This + variable is set correctly for the type of generator being used for the build. + + (ADB - 2018/01/08, HDFFV-10385, HDFFV-10296) Library: -------- @@ -224,7 +232,16 @@ Bug Fixes since HDF5-1.10.1 release Configuration ------------- - - cmake + - CMake + + Add replacement of fortran flags if using static CRT. + + Added TARGET_STATIC_CRT_FLAGS call to HDFUseFortran.cmake file in + config/cmake_ext_mod folder. + + (ADB - 2018/01/08, HDFFV-10334) + + - CMake The hdf5 library used shared szip and zlib, which needlessly required applications to link with the same szip and zlib libraries. @@ -236,7 +253,7 @@ Bug Fixes since HDF5-1.10.1 release (ADB - 2017/11/14, HDFFV-10329) - - cmake MPI + - CMake MPI CMake implementation for MPI was problematic and would create incorrect MPI library references in the hdf5 libraries. @@ -247,7 +264,7 @@ Bug Fixes since HDF5-1.10.1 release (ADB - 2017/11/02, HDFFV-10321) - - cmake + - CMake Too many commands for POST_BUILD step caused command line to be too big on windows. diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index fca2f27..a304485 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1133,7 +1133,7 @@ if (HDF5_TEST_VFD) macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") - if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) + if (NOT BUILD_SHARED_LIBS AND NOT HDF5_BUILD_TYPE MATCHES Debug) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 997d1a1..db61d35 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -30,7 +30,7 @@ set (testphdf5_SOURCES add_executable (testphdf5 ${testphdf5_SOURCES}) TARGET_NAMING (testphdf5 STATIC) TARGET_C_PROPERTIES (testphdf5 STATIC " " " ") -target_link_libraries (testphdf5 ${HDF5_TEST_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) +target_link_libraries (testphdf5 PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) target_link_libraries (testphdf5 PRIVATE ${MPI_C_LIBRARIES}) endif () @@ -40,7 +40,7 @@ MACRO (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) TARGET_NAMING (${file} STATIC) TARGET_C_PROPERTIES (${file} STATIC " " " ") - target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + target_link_libraries (${file} PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) target_link_libraries (${file} PRIVATE ${MPI_C_LIBRARIES}) endif () diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index d1f5f50..23c8fae 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -39,10 +39,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5copy-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5copy ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 00d93de..b0cf66e 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -57,10 +57,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5diff-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 65a7cdd..c58b20c 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -47,10 +47,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5dump-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5dump ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index fa3abc0..1e3e62f 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -28,11 +28,13 @@ set (H5_DEP_EXECUTABLES h5format_convert) # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5format_convert ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5format_convert + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index 9a61beb..bebc6d8 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -29,11 +29,13 @@ set (H5_DEP_EXECUTABLES h5import) # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5import ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5import + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index 3cca771..1075180 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -38,11 +38,13 @@ set (H5_DEP_EXECUTABLES # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5jam ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5jam h5unjam + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 2e23634..0e3d57f 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -39,10 +39,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5ls-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index 81e6275..abf4c24 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -50,10 +50,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5repack-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5repack ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index 9762dbb..60d3f7c 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -39,10 +39,9 @@ endif () # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_PROGRAM_PDB (h5stat-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications) - endif () - INSTALL_PROGRAM_PDB (h5stat ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 1292628..20c9171 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -62,13 +62,13 @@ set (H5_DEP_EXECUTABLES # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - INSTALL_PROGRAM_PDB (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) - INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) - INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) + foreach (exec ${H5_DEP_EXECUTABLES}) + INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications) + endforeach () install ( TARGETS - h5debug h5repart h5mkgrp + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -- cgit v0.12 From 9c2a9cec1f708039dbc625bcc6827ab64282e065 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jan 2018 14:35:59 -0600 Subject: HDFFV-10361 Correct signatures --- src/H5Fint.c | 32 ++++++++++++++++---------------- src/H5Fprivate.h | 4 +--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index b135ce1..e528cab 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -481,20 +481,20 @@ done: } /* end H5F_get_objects_cb() */ /*-------------------------------------------------------------------------- - * Function: H5F_build_name + * Function: H5F__build_name * * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME * * Return: Non-negative on success/Negative on failure *--------------------------------------------------------------------------*/ -herr_t -H5F_build_name(char *prefix, char *file_name, char **full_name/*out*/) +static herr_t +H5F__build_name(char *prefix, char *file_name, char **full_name/*out*/) { size_t prefix_len; /* length of prefix */ size_t fname_len; /* Length of external link file name */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC prefix_len = HDstrlen(prefix); fname_len = HDstrlen(file_name); @@ -509,11 +509,11 @@ H5F_build_name(char *prefix, char *file_name, char **full_name/*out*/) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_build_name() */ +} /* H5F__build_name() */ /*-------------------------------------------------------------------------- - * Function: H5F_getenv_prefix_name -- + * Function: H5F__getenv_prefix_name -- * * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, * which is separated by the environment delimiter. @@ -522,13 +522,13 @@ done: * * Return: A pointer to a pathname --------------------------------------------------------------------------*/ -char * -H5F_getenv_prefix_name(char **env_prefix/*in,out*/) +static char * +H5F__getenv_prefix_name(char **env_prefix/*in,out*/) { char *retptr=NULL; char *strret=NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC strret = HDstrchr(*env_prefix, H5_COLON_SEPC); if (strret == NULL) { @@ -541,7 +541,7 @@ H5F_getenv_prefix_name(char **env_prefix/*in,out*/) } FUNC_LEAVE_NOAPI(retptr) -} /* end H5F_getenv_prefix_name() */ +} /* end H5F__getenv_prefix_name() */ /*------------------------------------------------------------------------- * Function: H5F_prefix_open_file @@ -563,7 +563,7 @@ H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_typ char *temp_file_name = NULL; /* Temporary pointer to file name */ size_t temp_file_name_len; /* Length of temporary file name */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI_NOINIT /* Simplify intent flags for open calls */ file_intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); @@ -624,9 +624,9 @@ H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_typ while((tmp_env_prefix) && (*tmp_env_prefix)) { char *out_prefix_name; - out_prefix_name = H5F_getenv_prefix_name(&tmp_env_prefix/*in,out*/); + out_prefix_name = H5F__getenv_prefix_name(&tmp_env_prefix/*in,out*/); if(out_prefix_name && (*out_prefix_name)) { - if(H5F_build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { + if(H5F__build_name(out_prefix_name, temp_file_name, &full_name/*out*/) < 0) { saved_env = (char *)H5MM_xfree(saved_env); HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") } /* end if */ @@ -664,7 +664,7 @@ H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_typ if(size < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file prefix") if(my_prefix) { - if(H5F_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) + if(H5F__build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") my_prefix = (char *)H5MM_xfree(my_prefix); if(NULL == (src_file = H5F_efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) @@ -679,7 +679,7 @@ H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_typ char *dspath; if(NULL != (dspath = H5F_EXTPATH(primary_file))) { - if(H5F_build_name(dspath, temp_file_name, &full_name/*out*/) < 0) + if(H5F__build_name(dspath, temp_file_name, &full_name/*out*/) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") if(NULL == (src_file = H5F_efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) H5E_clear_stack(NULL); @@ -710,7 +710,7 @@ H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_typ *ptr = '\0'; /* Build new file name for the external file */ - if(H5F_build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) + if(H5F__build_name(actual_file_name, temp_file_name, &full_name/*out*/) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") actual_file_name = (char *)H5MM_xfree(actual_file_name); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ba94069..49c5098 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -864,9 +864,7 @@ H5_DLL H5F_t *H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, H5_DLL herr_t H5F_efc_close(H5F_t *parent, H5F_t *file); /* File prefix routines */ -H5_DLL herr_t H5F_build_name(char *prefix, char *file_name, char **full_name); -H5_DLL char * H5F_getenv_prefix_name(char **env_prefix); -H5F_t *H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_type, +H5_DLL H5F_t *H5F_prefix_open_file(hid_t plist_id, H5F_t *primary_file, const char *prefix_type, const char *file_name, unsigned file_intent, hid_t fapl_id, hid_t dxpl_id); /* Global heap CWFS routines */ -- cgit v0.12 From 3e0c6530dc3a6008f800b25eb55c1422d853cc67 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jan 2018 16:26:12 -0600 Subject: HDFFV-10385 fix platform errors --- CMakeLists.txt | 4 ++-- config/cmake/hdf5-config.cmake.in | 6 ----- config/cmake_ext_mod/HDFMacros.cmake | 21 ++++-------------- fortran/src/CMakeLists.txt | 43 ++++++++++++++++++++---------------- fortran/test/CMakeLists.txt | 21 +++++++++--------- hl/fortran/src/CMakeLists.txt | 23 +++++++++---------- 6 files changed, 52 insertions(+), 66 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5be2f03..f40fc2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -428,12 +428,12 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." ) if (WIN32) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) set (CMAKE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." ) else () - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) endif () else () # if we are externally configured, but the project uses old cmake scripts diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 01c27df..421f693 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -105,12 +105,6 @@ set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) # project which has already built hdf5 as a subproject #----------------------------------------------------------------------------- if (NOT TARGET "@HDF5_PACKAGE@") - if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib") - include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) - endif () - if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip") - include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) - endif () include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) endif () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index dd7e262..218c882 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -15,27 +15,14 @@ macro (SET_HDF5_BUILD_TYPE) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) set(HDF5_BUILD_TYPE ${CMAKE_CFG_INTDIR}) + set(HDF5_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) else() if(CMAKE_BUILD_TYPE) set(HDF5_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + set(HDF5_CFG_BUILD_TYPE ${CMAKE_BUILD_TYPE}) else() - set(HDF5_BUILD_TYPE) - endif() - endif() -endmacro () - -#------------------------------------------------------------------------------- -macro (CREATE_CONFIG_DIR path) - get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if(_isMultiConfig) - foreach(c ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) - file(MAKE_DIRECTORY "${path}/${c}") - endforeach() - else() - if(CMAKE_BUILD_TYPE) - file(MAKE_DIRECTORY "${path}/${CMAKE_BUILD_TYPE}") - else() - file(MAKE_DIRECTORY "${path}") + set(HDF5_BUILD_TYPE "Release") + set(HDF5_CFG_BUILD_TYPE "Release") endif() endif() endmacro () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 692509b..c377d62 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -66,11 +66,10 @@ set_target_properties (H5_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () -CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_BUILD_TYPE}) +file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) @@ -81,14 +80,14 @@ add_executable (H5match_types ) set (CMD $) add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 COMMAND ${CMD} - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS H5match_types ) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5f90i_gen.h PROPERTIES GENERATED TRUE) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) set (CMDSH $) add_custom_command ( @@ -127,10 +126,15 @@ set_source_files_properties (${f90CStub_C_SOURCES} PROPERTIES LANGUAGE C) set (f90CStub_C_HDRS # generated files - ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h +) +set (f90CStub_C_SHHDRS + # generated files + ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ) add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) +target_include_directories(${HDF5_F90_C_LIB_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/static) TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") @@ -143,7 +147,8 @@ set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES set (install_targets ${HDF5_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) - add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) + add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) + target_include_directories(${HDF5_F90_C_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIBSH_TARGET}") @@ -168,16 +173,16 @@ set (f90_F_GEN_SOURCES ) set (CMD $) add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5_gen.F90 + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 COMMAND ${CMD} - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 file" ) add_custom_target (H5gen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 + DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 ) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5_gen.F90 PROPERTIES GENERATED TRUE) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) set (CMDSH $) @@ -216,12 +221,12 @@ set (f90_F_BASE_SOURCES set (f90_F_SOURCES # generated file - ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 ${f90_F_BASE_SOURCES} # generated file - ${HDF5_F90_BINARY_DIR}/H5_gen.F90 + ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 @@ -309,8 +314,8 @@ install ( ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h - ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 + ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index f536bf2..c47618e 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -33,12 +33,11 @@ set_target_properties (H5_test_buildiface PROPERTIES ) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_BUILD_TYPE}) + file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () -CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_BUILD_TYPE}) +file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/static") +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) @@ -47,6 +46,7 @@ INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) #----------------------------------------------------------------------------- add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) set_source_files_properties (t.c PROPERTIES LANGUAGE C) +target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/static) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} @@ -60,6 +60,7 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES ) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) +target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} @@ -77,16 +78,16 @@ endif () set (CMD $) add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/tf_gen.F90 + OUTPUT ${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 COMMAND ${CMD} - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 file" ) add_custom_target (H5testgen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/tf_gen.F90 + DEPENDS ${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 ) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/tf_gen.F90 PROPERTIES GENERATED TRUE) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) set (CMDSH $) @@ -105,7 +106,7 @@ endif () set (HDF5_F90_TF_SOURCES # generated files - ${HDF5_F90_BINARY_DIR}/tf_gen.F90 + ${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 # normal distribution tf.F90 diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 90ee19b..47e8236 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -37,12 +37,9 @@ set_target_properties (H5HL_buildiface PROPERTIES ) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") - CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () -CREATE_CONFIG_DIR(${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_BUILD_TYPE}) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Setup include Directories @@ -70,6 +67,7 @@ set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C) set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) +target_include_directories(${HDF5_HL_F90_C_LIB_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/static) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") @@ -83,6 +81,7 @@ set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) + target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}") @@ -109,18 +108,18 @@ set (HDF5_HL_F90_F_BASE_SOURCES set (CMD $) add_custom_command ( - OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 + OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 COMMAND ${CMD} - WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR} + WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" ) add_custom_target (H5HLgen ALL - DEPENDS ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 + DEPENDS ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 ) set_source_files_properties ( - ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 - ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5LTff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5TBff_gen.F90 PROPERTIES GENERATED TRUE ) if (BUILD_SHARED_LIBS) @@ -146,8 +145,8 @@ set (HDF5_HL_F90_F_SOURCES ${HDF5_HL_F90_F_BASE_SOURCES} # generated files - ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 - ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5LTff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5TBff_gen.F90 ) set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran) -- cgit v0.12 From a5789f6c9ab1f9308b5cc4dc64b156e9be077459 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jan 2018 16:26:25 -0600 Subject: HDFFV-8745 fix minor defects --- tools/lib/h5diff_attr.c | 2 -- tools/lib/h5diff_dset.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 4e4b40d..7f08cc7 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -325,8 +325,6 @@ hsize_t diff_attr(hid_t loc1_id, hid_t space2_id = -1; /* space ID */ hid_t ftype1_id = -1; /* file data type ID */ hid_t ftype2_id = -1; /* file data type ID */ - int vstrtype1 = 0; /* ftype1 is a variable string */ - int vstrtype2 = 0; /* ftype2 is a variable string */ hid_t mtype1_id = -1; /* memory data type ID */ hid_t mtype2_id = -1; /* memory data type ID */ size_t msize1; /* memory size of memory type */ diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 86aa543..ff542db 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -773,8 +773,8 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } if(tclass1 == H5T_STRING) { - hid_t vstrtype1 = -1; - hid_t vstrtype2 = -1; + htri_t vstrtype1 = -1; + htri_t vstrtype2 = -1; h5difftrace("diff_can_type end - H5T_STRING\n"); vstrtype1 = H5Tis_variable_str(f_tid1); @@ -782,7 +782,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ /* no compare if either one but not both are variable string type */ if (vstrtype1 != vstrtype2) { - if((opts->m_verbose || opts->m_list_not_cmp)) + if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n", obj1_name, obj2_name); opts->not_cmp = 1; -- cgit v0.12 From 16e0a6b85868ddc30fffe2c92063f71caa5c71c2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jan 2018 16:55:29 -0600 Subject: Correct folder typo --- CMakeLists.txt | 2 +- fortran/test/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f40fc2a..2288be5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,7 @@ if (NOT HDF5_INSTALL_DATA_DIR) set (HDF5_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) endif () set (HDF5_INSTALL_DATA_DIR share) - set (HDF5_INSTALL_CMAKE_DIR share/cmake) + set (HDF5_INSTALL_CMAKE_DIR share/cmake/hdf5) else () set (HDF5_INSTALL_DATA_DIR ".") set (HDF5_INSTALL_CMAKE_DIR cmake) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index c47618e..0af4df9 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -33,10 +33,10 @@ set_target_properties (H5_test_buildiface PROPERTIES ) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") + file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/static") +file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) -- cgit v0.12 From 6bf125c7b38887a26b95d3eac4be08e5e44bb1af Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 08:31:44 -0600 Subject: HDFFV-10385 fix fortran references --- fortran/examples/h5_crtatt.f90 | 4 ++++ hl/fortran/src/CMakeLists.txt | 2 ++ 2 files changed, 6 insertions(+) diff --git a/fortran/examples/h5_crtatt.f90 b/fortran/examples/h5_crtatt.f90 index 7e287c6..d3df380 100644 --- a/fortran/examples/h5_crtatt.f90 +++ b/fortran/examples/h5_crtatt.f90 @@ -84,6 +84,10 @@ PROGRAM H5_CRTATT ! CALL h5aclose_f(attr_id, error) ! + ! Close the attribute datatype. + ! + CALL h5tclose_f(atype_id, error) + ! ! Terminate access to the data space. ! CALL h5sclose_f(aspace_id, error) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 47e8236..dc2629a 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -37,8 +37,10 @@ set_target_properties (H5HL_buildiface PROPERTIES ) if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () +file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/static") set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- -- cgit v0.12 From 850ec7a30a3e7cb9fb5727f1819a182dcebbe25d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 08:39:50 -0600 Subject: HDFFV-10385 - add release note --- release_docs/RELEASE.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 1dc5bd1..2cacc30 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -234,6 +234,19 @@ Bug Fixes since HDF5-1.10.1 release ------------- - CMake + Correct usuage of CMAKE_BUILD_TYPE variable. + + The use of the CMAKE_BUILD_TYPE is incorrect for multi-config + generators (Visual Studio and XCode) and is optional for single + config generators. Created a new macro to check + GLOBAL PROPERTY -> GENERATOR_IS_MULTI_CONFIG + Created two new HDF variable, HDF5_BUILD_TYPE and HDF5_CFG_BUILD_TYPE. + Defaults for these variables is "Release". + + (ADB - 2018/01/10, HDFFV-10385) + + - CMake + Add replacement of fortran flags if using static CRT. Added TARGET_STATIC_CRT_FLAGS call to HDFUseFortran.cmake file in -- cgit v0.12 From 82709178aa25d726224d91df2b9e51b626137922 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 09:52:06 -0600 Subject: HDFFV-10385 includes cleanup --- fortran/test/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 0af4df9..7842359 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) #----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities @@ -39,8 +39,6 @@ endif () file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) -INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) - #----------------------------------------------------------------------------- # Add Test Lib #----------------------------------------------------------------------------- -- cgit v0.12 From bdde53eb3ec3341bbe0b28617c0784dcd1f31b50 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 11:49:09 -0600 Subject: HDFFV-8745 remove obsolete files --- .../test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 | Bin 124440 -> 0 bytes .../h5diff/testfiles/tmpSingleSiteBethe.reference.h5 | Bin 119464 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 delete mode 100644 tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 diff --git a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 deleted file mode 100644 index bbcfb63..0000000 Binary files a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 and /dev/null differ diff --git a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 deleted file mode 100644 index 6b19ed7..0000000 Binary files a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 and /dev/null differ -- cgit v0.12 From 5b4b4658328b63181899834c1981555bc6144f98 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 13:04:06 -0600 Subject: Fix typo --- config/cmake/UseJava.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 52b37a9..c70f52e 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -285,7 +285,7 @@ # # Example: # create_javadoc(my_example_doc -# PACKAGES com.exmaple.foo com.example.bar +# PACKAGES com.example.foo com.example.bar # SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" # CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} # WINDOWTITLE "My example" -- cgit v0.12 From 681047269b27d0f1be33827362ff823f919c593b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 13:31:47 -0600 Subject: HDFFV-10385 fix packaging --- fortran/src/CMakeLists.txt | 4 ++-- fortran/test/CMakeLists.txt | 4 ++-- hl/fortran/src/CMakeLists.txt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index c377d62..030cb37 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -66,10 +66,10 @@ set_target_properties (H5_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) endif () file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 7842359..31d0f59 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -34,10 +34,10 @@ set_target_properties (H5_test_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) endif () file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) #----------------------------------------------------------------------------- # Add Test Lib diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index dc2629a..22738b90 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -38,10 +38,10 @@ set_target_properties (H5HL_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) endif () file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) #----------------------------------------------------------------------------- # Setup include Directories -- cgit v0.12 From 9956b151e005fa98e28926cbbb3565afb85b1d06 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 14:35:00 -0600 Subject: HDFFV-10385 multi-config builders need folder set --- config/cmake_ext_mod/HDFMacros.cmake | 3 +-- fortran/src/CMakeLists.txt | 4 ++-- fortran/test/CMakeLists.txt | 4 ++-- hl/fortran/src/CMakeLists.txt | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 218c882..76e0612 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -17,12 +17,11 @@ macro (SET_HDF5_BUILD_TYPE) set(HDF5_BUILD_TYPE ${CMAKE_CFG_INTDIR}) set(HDF5_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) else() + set(HDF5_CFG_BUILD_TYPE ".") if(CMAKE_BUILD_TYPE) set(HDF5_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - set(HDF5_CFG_BUILD_TYPE ${CMAKE_BUILD_TYPE}) else() set(HDF5_BUILD_TYPE "Release") - set(HDF5_CFG_BUILD_TYPE "Release") endif() endif() endmacro () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 030cb37..c377d62 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -66,10 +66,10 @@ set_target_properties (H5_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 31d0f59..7842359 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -34,10 +34,10 @@ set_target_properties (H5_test_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Add Test Lib diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 22738b90..dc2629a 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -38,10 +38,10 @@ set_target_properties (H5HL_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Setup include Directories -- cgit v0.12 From c7e8a0788c68c2fe05b6b70591a499ad277c8fa5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jan 2018 14:36:25 -0600 Subject: Correct whitespace --- fortran/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 7842359..9946aa0 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -58,7 +58,7 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES ) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) -target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) + target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} -- cgit v0.12 From a2f2e1f4cf44f305a12c674a37c120d26ce3362b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Jan 2018 10:48:14 -0600 Subject: Fix fortran cmake variable usage --- fortran/src/CMakeLists.txt | 6 +++--- fortran/test/CMakeLists.txt | 30 +++++++++++++++--------------- hl/fortran/src/CMakeLists.txt | 5 +++-- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index c377d62..7ed5fef 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -71,7 +71,7 @@ endif () file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) -INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) +INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR} ${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) #----------------------------------------------------------------------------- add_executable (H5match_types @@ -134,7 +134,7 @@ set (f90CStub_C_SHHDRS ) add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) -target_include_directories(${HDF5_F90_C_LIB_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/static) +target_include_directories(${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/static) TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") @@ -148,7 +148,7 @@ set (install_targets ${HDF5_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) - target_include_directories(${HDF5_F90_C_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) + target_include_directories(${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/shared) TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIBSH_TARGET}") diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 9946aa0..9f2d593 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_FORTRAN_TESTS_SOURCE_DIR} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) #----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities @@ -33,10 +33,10 @@ set_target_properties (H5_test_buildiface PROPERTIES ) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") + file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") +file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- @@ -44,7 +44,7 @@ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYP #----------------------------------------------------------------------------- add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) set_source_files_properties (t.c PROPERTIES LANGUAGE C) -target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/static) +target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/static) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} @@ -58,7 +58,7 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES ) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) - target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) + target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/shared) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} @@ -76,35 +76,35 @@ endif () set (CMD $) add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 + OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 COMMAND ${CMD} - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static + WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 file" ) add_custom_target (H5testgen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 + DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 ) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) +set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) set (CMDSH $) add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 + OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 COMMAND ${CMDSH} - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared + WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 shared file" ) add_custom_target (H5testgenSH ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 + DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 ) - set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) + set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) endif () set (HDF5_F90_TF_SOURCES # generated files - ${HDF5_F90_BINARY_DIR}/static/tf_gen.F90 + ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 # normal distribution tf.F90 @@ -113,7 +113,7 @@ set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) if (BUILD_SHARED_LIBS) set (HDF5_F90_TF_SOURCES_SHARED # generated file - ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 + ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 # normal distribution tf.F90 diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index dc2629a..9190354 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -49,6 +49,7 @@ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYP INCLUDE_DIRECTORIES ( ${HDF5_HL_SRC_DIR}/src ${HDF5_F90_SRC_DIR}/src + ${HDF5_HL_F90_SRC_SOURCE_DIR} ${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR} @@ -69,7 +70,7 @@ set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C) set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) -target_include_directories(${HDF5_HL_F90_C_LIB_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/static) +target_include_directories(${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/static) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") @@ -83,7 +84,7 @@ set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) - target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET} PRIVATE ${HDF5_F90_BINARY_DIR}/shared) + target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/shared) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}") -- cgit v0.12 From 19c18e44ed113af84896604d7cedcc892f8338dc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jan 2018 14:17:04 -0600 Subject: Revert CMAKE_BUILD_TYPE for matches - need to redesign --- CMakeLists.txt | 2 +- config/cmake/HDFCompilerFlags.cmake | 6 +++--- config/cmake_ext_mod/HDFMacros.cmake | 5 ++++- java/examples/datasets/CMakeLists.txt | 2 +- java/examples/datatypes/CMakeLists.txt | 2 +- java/examples/groups/CMakeLists.txt | 2 +- java/examples/intro/CMakeLists.txt | 2 +- java/src/jni/CMakeLists.txt | 2 +- java/test/CMakeLists.txt | 2 +- test/CMakeTests.cmake | 2 +- 10 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2288be5..cb01cd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -584,7 +584,7 @@ option (HDF5_BUILD_GENERATORS "Build Test Generators" OFF) #----------------------------------------------------------------------------- option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF) mark_as_advanced (HDF5_ENABLE_TRACE) -if (HDF5_BUILD_TYPE MATCHES Debug) +if (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions (-DDEBUG) # Enable tracing of the API if (HDF5_ENABLE_TRACE) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index eeb4b97..72d320c 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -13,12 +13,12 @@ # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) - if (HDF5_BUILD_TYPE MATCHES Debug) + if (CMAKE_BUILD_TYPE MATCHES Debug) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () - else (HDF5_BUILD_TYPE MATCHES Debug) + else () set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") @@ -26,7 +26,7 @@ if (CMAKE_COMPILER_IS_GNUCC) endif () endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - if (HDF5_BUILD_TYPE MATCHES Debug) + if (CMAKE_BUILD_TYPE MATCHES Debug) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 76e0612..8a6b74d 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -24,6 +24,9 @@ macro (SET_HDF5_BUILD_TYPE) set(HDF5_BUILD_TYPE "Release") endif() endif() + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") + endif() endmacro () #------------------------------------------------------------------------------- @@ -162,7 +165,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${HDF5_BUILD_TYPE} MATCHES "Debug") + if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index dd007f5..3972ec8 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -62,7 +62,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (HDF5_BUILD_TYPE MATCHES Debug) + if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index fac8158..8569b8b 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -62,7 +62,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (HDF5_BUILD_TYPE MATCHES Debug) + if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 7f2801a..b912208 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -61,7 +61,7 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) MACRO (ADD_H5_TEST resultfile resultcode) - if (HDF5_BUILD_TYPE MATCHES Debug) + if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index a21d369..9dc4dd7 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -63,7 +63,7 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (HDF5_BUILD_TYPE MATCHES Debug) + if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 90343b2..10d1b6d 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -57,7 +57,7 @@ SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED ${HDF5_JAVA_PACKAGE_SOVERSION}) if (WIN32) get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) - if (HDF5_BUILD_TYPE MATCHES Debug) + if (CMAKE_BUILD_TYPE MATCHES Debug) set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}_D") endif () # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index fadc1ea..8912b3f 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -88,7 +88,7 @@ endforeach () set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}") set (testfilter "OK (598 tests)") -if (HDF5_BUILD_TYPE MATCHES Debug) +if (CMAKE_BUILD_TYPE MATCHES Debug) if (WIN32) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") else () diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index a304485..fca2f27 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1133,7 +1133,7 @@ if (HDF5_TEST_VFD) macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") - if (NOT BUILD_SHARED_LIBS AND NOT HDF5_BUILD_TYPE MATCHES Debug) + if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -- cgit v0.12 From 0291c0907502b8d1b2f0328a97c2f19ca16c7370 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 16 Jan 2018 16:08:52 -0600 Subject: HDFFV-10385 Use OUTPUT_NAME property instead of CMAKE_BUILD_TYPE --- java/examples/datasets/CMakeLists.txt | 9 ++------- java/examples/datatypes/CMakeLists.txt | 9 ++------- java/examples/groups/CMakeLists.txt | 9 ++------- java/examples/intro/CMakeLists.txt | 9 ++------- java/test/CMakeLists.txt | 10 ++-------- 5 files changed, 10 insertions(+), 36 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 3972ec8..b95ede7 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -62,13 +62,8 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) - if (WIN32) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else () - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif () - endif () + string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_datasets-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 8569b8b..9c6e29f 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -62,13 +62,8 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) - if (WIN32) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else () - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif () - endif () + string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_datatypes-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index b912208..5bf5040 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -61,13 +61,8 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) - if (WIN32) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else () - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif () - endif () + string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_groups-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 9dc4dd7..0e5ae79 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -63,13 +63,8 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - if (CMAKE_BUILD_TYPE MATCHES Debug) - if (WIN32) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else () - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif () - endif () + string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JAVA_intro-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 8912b3f..5c8fa8d 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -88,14 +88,8 @@ endforeach () set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}") set (testfilter "OK (598 tests)") -if (CMAKE_BUILD_TYPE MATCHES Debug) - if (WIN32) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;") - else () - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") - endif () -endif () - +string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") add_test ( NAME JUnit-interface-clearall-objects COMMAND ${CMAKE_COMMAND} -- cgit v0.12 From 6ca95c512a116340b6e483882a4a3737d9d1c67c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 17 Jan 2018 10:27:00 -0600 Subject: HDFFV-10385 rework java names --- c++/examples/CMakeLists.txt | 2 -- c++/test/CMakeLists.txt | 1 - config/cmake_ext_mod/HDFMacros.cmake | 32 +++++++++++++++++++----------- examples/CMakeLists.txt | 4 ---- fortran/examples/CMakeLists.txt | 6 ------ fortran/test/CMakeLists.txt | 10 ---------- fortran/testpar/CMakeLists.txt | 1 - hl/c++/examples/CMakeLists.txt | 1 - hl/c++/test/CMakeLists.txt | 1 - hl/examples/CMakeLists.txt | 1 - hl/fortran/examples/CMakeLists.txt | 1 - hl/fortran/test/CMakeLists.txt | 8 -------- hl/test/CMakeLists.txt | 5 ----- hl/tools/gif2h5/CMakeLists.txt | 3 --- hl/tools/h5watch/CMakeLists.txt | 4 ---- java/examples/datasets/CMakeLists.txt | 3 +-- java/examples/datatypes/CMakeLists.txt | 3 +-- java/examples/groups/CMakeLists.txt | 3 +-- java/examples/intro/CMakeLists.txt | 3 +-- java/src/jni/CMakeLists.txt | 4 +--- java/test/CMakeLists.txt | 3 +-- release_docs/USING_HDF5_CMake.txt | 9 ++++----- test/CMakeLists.txt | 19 ------------------ test/CMakeTests.cmake | 1 - testpar/CMakeLists.txt | 2 -- tools/src/h5copy/CMakeLists.txt | 2 -- tools/src/h5diff/CMakeLists.txt | 3 --- tools/src/h5dump/CMakeLists.txt | 2 -- tools/src/h5format_convert/CMakeLists.txt | 1 - tools/src/h5import/CMakeLists.txt | 1 - tools/src/h5jam/CMakeLists.txt | 2 -- tools/src/h5ls/CMakeLists.txt | 2 -- tools/src/h5repack/CMakeLists.txt | 2 -- tools/src/h5stat/CMakeLists.txt | 2 -- tools/src/misc/CMakeLists.txt | 4 ---- tools/test/h5copy/CMakeLists.txt | 1 - tools/test/h5diff/CMakeLists.txt | 1 - tools/test/h5dump/CMakeLists.txt | 1 - tools/test/h5format_convert/CMakeLists.txt | 2 -- tools/test/h5import/CMakeLists.txt | 1 - tools/test/h5jam/CMakeLists.txt | 3 --- tools/test/h5repack/CMakeLists.txt | 2 -- tools/test/h5stat/CMakeLists.txt | 1 - tools/test/misc/CMakeLists.txt | 4 ---- tools/test/misc/vds/CMakeLists.txt | 1 - tools/test/perform/CMakeLists.txt | 9 --------- 46 files changed, 30 insertions(+), 147 deletions(-) diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index e5b0b4a..300f6bc 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -34,7 +34,6 @@ set (tutr_examples foreach (example ${examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - TARGET_NAMING (cpp_ex_${example} STATIC) TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ") target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) @@ -42,7 +41,6 @@ endforeach () foreach (example ${tutr_examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - TARGET_NAMING (cpp_ex_${example} STATIC) TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ") target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 65815f9..4930626 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -37,7 +37,6 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) -TARGET_NAMING (cpp_testhdf5 STATIC) TARGET_C_PROPERTIES (cpp_testhdf5 STATIC " " " ") target_link_libraries (cpp_testhdf5 ${HDF5_CPP_LIB_TARGET} diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 8a6b74d..2813de6 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -14,13 +14,16 @@ macro (SET_HDF5_BUILD_TYPE) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) + set(HDF5_CFG_NAME ${CTEST_CONFIGURATION_TYPE}) set(HDF5_BUILD_TYPE ${CMAKE_CFG_INTDIR}) set(HDF5_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) else() set(HDF5_CFG_BUILD_TYPE ".") if(CMAKE_BUILD_TYPE) + set(HDF5_CFG_NAME ${CMAKE_BUILD_TYPE}) set(HDF5_BUILD_TYPE ${CMAKE_BUILD_TYPE}) else() + set(HDF5_CFG_NAME "Release") set(HDF5_BUILD_TYPE "Release") endif() endif() @@ -65,13 +68,6 @@ macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) endmacro () #------------------------------------------------------------------------------- -macro (TARGET_NAMING libtarget libtype) - if (${libtype} MATCHES "SHARED") - set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}${ARGN}") - endif () -endmacro () - -#------------------------------------------------------------------------------- macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) if (WIN32 AND MSVC) get_target_property (target_type ${libtarget} TYPE) @@ -108,6 +104,12 @@ endmacro () #------------------------------------------------------------------------------- macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) + set (LIB_DEBUG_PREFIX "") + if (WIN32) + set (LIB_DEBUG_SUFFIX "_D") + else () + set (LIB_DEBUG_SUFFIX "_debug") + endif () if (${libtype} MATCHES "SHARED") if (WIN32) set (LIB_RELEASE_NAME "${libname}") @@ -118,6 +120,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) endif () else () if (WIN32) + set (LIB_DEBUG_PREFIX "lib") set (LIB_RELEASE_NAME "lib${libname}") set (LIB_DEBUG_NAME "lib${libname}_D") else () @@ -128,11 +131,16 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) set_target_properties (${libtarget} PROPERTIES - OUTPUT_NAME ${LIB_RELEASE_NAME} - OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} - OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} - OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} - OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} +# OUTPUT_NAME +# ${LIB_DEBUG_PREFIX}${libname}$<$:${LIB_DEBUG_SUFFIX}> + OUTPUT_NAME_DEBUG + ${LIB_DEBUG_NAME} + OUTPUT_NAME_RELEASE + ${LIB_RELEASE_NAME} + OUTPUT_NAME_MINSIZEREL + ${LIB_RELEASE_NAME} + OUTPUT_NAME_RELWITHDEBINFO + ${LIB_RELEASE_NAME} ) if (${libtype} MATCHES "STATIC") if (WIN32) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 04a99ce..43c6d63 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -46,13 +46,11 @@ set (examples foreach (example ${examples}) add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - TARGET_NAMING (${example} STATIC) TARGET_C_PROPERTIES (${example} STATIC " " " ") target_link_libraries (${example} ${HDF5_LIB_TARGET}) set_target_properties (${example} PROPERTIES FOLDER examples) if (BUILD_SHARED_LIBS) add_executable (${example}-shared ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - TARGET_NAMING (${example}-shared SHARED) TARGET_C_PROPERTIES (${example}-shared SHARED " " " ") target_link_libraries (${example}-shared ${HDF5_LIBSH_TARGET}) set_target_properties (${example}-shared PROPERTIES FOLDER examples) @@ -61,13 +59,11 @@ endforeach () if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - TARGET_NAMING (ph5example STATIC) TARGET_C_PROPERTIES (ph5example STATIC " " " ") target_link_libraries (ph5example ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example PROPERTIES FOLDER examples) if (BUILD_SHARED_LIBS) add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - TARGET_NAMING (ph5example-shared SHARED) TARGET_C_PROPERTIES (ph5example-shared SHARED " " " ") target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example-shared PROPERTIES FOLDER examples) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index a05f296..a48b3bd 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -40,7 +40,6 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_NAMING (f90_ex_${example} STATIC) TARGET_FORTRAN_PROPERTIES (f90_ex_${example} STATIC " " " ") target_link_libraries (f90_ex_${example} ${HDF5_F90_LIB_TARGET} @@ -54,7 +53,6 @@ foreach (example ${examples}) ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_NAMING (f90_ex_${example}-shared SHARED) TARGET_FORTRAN_PROPERTIES (f90_ex_${example}-shared SHARED " " " ") target_link_libraries (f90_ex_${example}-shared ${HDF5_F90_LIBSH_TARGET} @@ -71,7 +69,6 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_NAMING (f03_ex_${example} STATIC) TARGET_FORTRAN_PROPERTIES (f03_ex_${example} STATIC " " " ") target_link_libraries (f03_ex_${example} ${HDF5_F90_LIB_TARGET} @@ -85,7 +82,6 @@ foreach (example ${F2003_examples}) ) if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_NAMING (f03_ex_${example}-shared SHARED) TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED " " " ") target_link_libraries (f03_ex_${example}-shared ${HDF5_F90_LIBSH_TARGET} @@ -102,7 +98,6 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - TARGET_NAMING (f90_ex_ph5example STATIC) TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example STATIC " " " ") target_link_libraries (f90_ex_ph5example ${HDF5_F90_LIB_TARGET} @@ -116,7 +111,6 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - TARGET_NAMING (f90_ex_ph5example-shared SHARED) TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example-shared SHARED " " " ") target_link_libraries (f90_ex_ph5example-shared ${HDF5_F90_LIBSH_TARGET} diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 9f2d593..e9eed90 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -195,7 +195,6 @@ add_executable (testhdf5_fortran tH5Z.F90 tHDF5.F90 ) -TARGET_NAMING (testhdf5_fortran STATIC) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran STATIC " " " ") target_link_libraries (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET} @@ -231,7 +230,6 @@ if (BUILD_SHARED_LIBS) tH5Z.F90 tHDF5.F90 ) - TARGET_NAMING (testhdf5_fortran-shared SHARED) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran-shared SHARED " " " ") target_link_libraries (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET} @@ -259,7 +257,6 @@ add_executable (testhdf5_fortran_1_8 tH5MISC_1_8.F90 tHDF5_1_8.F90 ) -TARGET_NAMING (testhdf5_fortran_1_8 STATIC) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 STATIC " " " ") target_link_libraries (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET} @@ -286,7 +283,6 @@ if (BUILD_SHARED_LIBS) tH5MISC_1_8.F90 tHDF5_1_8.F90 ) - TARGET_NAMING (testhdf5_fortran_1_8-shared SHARED) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8-shared SHARED " " " ") target_link_libraries (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET} @@ -316,7 +312,6 @@ add_executable (fortranlib_test_F03 tH5T_F03.F90 tHDF5_F03.F90 ) -TARGET_NAMING (fortranlib_test_F03 STATIC) TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 STATIC " " " ") target_link_libraries (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET} @@ -345,7 +340,6 @@ if (BUILD_SHARED_LIBS) tH5T_F03.F90 tHDF5_F03.F90 ) - TARGET_NAMING (fortranlib_test_F03-shared SHARED) TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03-shared SHARED " " " ") target_link_libraries (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET} @@ -367,7 +361,6 @@ endif () #-- Adding test for fflush1 add_executable (fflush1 fflush1.F90) -TARGET_NAMING (fflush1 STATIC) TARGET_FORTRAN_PROPERTIES (fflush1 STATIC " " " ") target_link_libraries (fflush1 ${HDF5_F90_LIB_TARGET} @@ -387,7 +380,6 @@ add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_executable (fflush1-shared fflush1.F90) - TARGET_NAMING (fflush1-shared SHARED) TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED " " " ") target_link_libraries (fflush1-shared ${HDF5_F90_LIBSH_TARGET} @@ -408,7 +400,6 @@ endif () #-- Adding test for fflush2 add_executable (fflush2 fflush2.F90) -TARGET_NAMING (fflush2 STATIC) TARGET_FORTRAN_PROPERTIES (fflush2 STATIC " " " ") target_link_libraries (fflush2 ${HDF5_F90_TEST_LIB_TARGET} @@ -428,7 +419,6 @@ add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_executable (fflush2-shared fflush2.F90) - TARGET_NAMING (fflush2-shared SHARED) TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED " " " ") target_link_libraries (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET} diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 4aa7f43..ed9d28c 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -16,7 +16,6 @@ add_executable (parallel_test hyper.f90 mdset.f90 ) -TARGET_NAMING (parallel_test STATIC) TARGET_FORTRAN_PROPERTIES (parallel_test STATIC " " " ") target_link_libraries (parallel_test ${HDF5_F90_TEST_LIB_TARGET} diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 33ad1e5..8c48795 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_DIR}/src) # Add in the examples for the Packet Table codes # -------------------------------------------------------------------- add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) -TARGET_NAMING (ptExampleFL STATIC) TARGET_C_PROPERTIES (ptExampleFL STATIC " " " ") target_link_libraries ( ptExampleFL diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index a2f9429..54afd7c 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -17,7 +17,6 @@ INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src) add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) TARGET_C_PROPERTIES (hl_ptableTest STATIC " " " ") -TARGET_NAMING (hl_ptableTest STATIC) target_link_libraries ( hl_ptableTest ${HDF5_LIB_TARGET} diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 1144e0f..68f0128 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -28,7 +28,6 @@ set (examples foreach (example ${examples}) add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) - TARGET_NAMING (hl_ex_${example} STATIC) TARGET_C_PROPERTIES (hl_ex_${example} STATIC " " " ") target_link_libraries (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index dfe6102..d920d64 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -16,7 +16,6 @@ set (examples foreach (example ${examples}) add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_NAMING (hl_f90_ex_${example} STATIC) TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} STATIC " " " ") target_link_libraries (hl_f90_ex_${example} ${HDF5_HL_F90_LIB_TARGET} diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index fbd31c5..b264d5f 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -8,7 +8,6 @@ INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${ #-- Adding test for hl_f90_tstds add_executable (hl_f90_tstds tstds.F90) -TARGET_NAMING (hl_f90_tstds STATIC) TARGET_FORTRAN_PROPERTIES (hl_f90_tstds STATIC " " " ") target_link_libraries (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) target_include_directories (hl_f90_tstds PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) @@ -16,7 +15,6 @@ set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstds-shared tstds.F90) - TARGET_NAMING (hl_f90_tstds-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tstds-shared SHARED " " " ") target_link_libraries (hl_f90_tstds-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) target_include_directories (hl_f90_tstds-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) @@ -29,7 +27,6 @@ endif () #-- Adding test for hl_f90_tstlite add_executable (hl_f90_tstlite tstlite.F90) -TARGET_NAMING (hl_f90_tstlite STATIC) TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite STATIC " " " ") target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) target_include_directories (hl_f90_tstlite PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) @@ -37,7 +34,6 @@ set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstlite-shared tstlite.F90) - TARGET_NAMING (hl_f90_tstlite-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite-shared SHARED " " " ") target_link_libraries (hl_f90_tstlite-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) target_include_directories (hl_f90_tstlite-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) @@ -50,7 +46,6 @@ endif () #-- Adding test for hl_f90_tstimage add_executable (hl_f90_tstimage tstimage.F90) -TARGET_NAMING (hl_f90_tstimage STATIC) TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage STATIC " " " ") target_link_libraries (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) target_include_directories (hl_f90_tstimage PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) @@ -58,7 +53,6 @@ set_target_properties (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstimage-shared tstimage.F90) - TARGET_NAMING (hl_f90_tstimage-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage-shared SHARED " " " ") target_link_libraries (hl_f90_tstimage-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) target_include_directories (hl_f90_tstimage-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) @@ -71,7 +65,6 @@ endif () #-- Adding test for hl_f90_tsttable add_executable (hl_f90_tsttable tsttable.F90) -TARGET_NAMING (hl_f90_tsttable STATIC) TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable STATIC " " " ") target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) target_include_directories (hl_f90_tsttable PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) @@ -79,7 +72,6 @@ set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tsttable-shared tsttable.F90) - TARGET_NAMING (hl_f90_tsttable-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable-shared SHARED " " " ") target_link_libraries (hl_f90_tsttable-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) target_include_directories (hl_f90_tsttable-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 8845505..82a3c1b 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -22,7 +22,6 @@ include_directories (${HDF5_TEST_SRC_DIR}) # -------------------------------------------------------------------- MACRO (HL_ADD_EXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - TARGET_NAMING (hl_${hl_name} STATIC) TARGET_C_PROPERTIES (hl_${hl_name} STATIC " " " ") target_link_libraries (hl_${hl_name} ${HDF5_HL_LIB_TARGET} @@ -34,7 +33,6 @@ ENDMACRO () MACRO (HL_ADD_SHEXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - TARGET_NAMING (hl_${hl_name} SHARED) TARGET_C_PROPERTIES (hl_${hl_name} SHARED " " " ") target_link_libraries (hl_${hl_name} ${HDF5_HL_LIBSH_TARGET} @@ -55,7 +53,6 @@ HL_ADD_EXE (test_dset_append) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) -TARGET_NAMING (hl_test_packet STATIC) TARGET_C_PROPERTIES (hl_test_packet STATIC " " " ") target_link_libraries (hl_test_packet ${HDF5_HL_LIB_TARGET} @@ -70,7 +67,6 @@ set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (hl_gen_test_ds gen_test_ds.c) - TARGET_NAMING (hl_gen_test_ds STATIC) TARGET_C_PROPERTIES (hl_gen_test_ds STATIC " " " ") target_link_libraries (hl_gen_test_ds ${HDF5_HL_LIB_TARGET} @@ -80,7 +76,6 @@ if (HDF5_BUILD_GENERATORS) set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) add_executable (hl_gen_test_ld gen_test_ld.c) - TARGET_NAMING (hl_gen_test_ld STATIC) TARGET_C_PROPERTIES (hl_gen_test_ld STATIC " " " ") target_link_libraries (hl_gen_test_ld ${HDF5_HL_LIB_TARGET} diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 9d7a406..34d7074 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -18,7 +18,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}) add_executable (gif2h5 ${GIF2H5_SOURCES}) -TARGET_NAMING (gif2h5 STATIC) TARGET_C_PROPERTIES (gif2h5 STATIC " " " ") target_link_libraries (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) @@ -30,7 +29,6 @@ set (hdf2gif_SOURCES ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdfgifwr.c ) add_executable (h52gif ${hdf2gif_SOURCES}) -TARGET_NAMING (h52gif STATIC) TARGET_C_PROPERTIES (h52gif STATIC " " " ") target_link_libraries (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h52gif PROPERTIES FOLDER tools/hl) @@ -44,7 +42,6 @@ if (BUILD_TESTING) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/h52gifgentst.c) - TARGET_NAMING (hl_h52gifgentest STATIC) TARGET_C_PROPERTIES (hl_h52gifgentest STATIC " " " ") target_link_libraries (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index 6b8d5f2..d0764c9 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -14,7 +14,6 @@ include_directories (${HDF5_HL_TOOLS_DIR}/src) include_directories (${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}) add_executable (h5watch ${H5WATCH_SOURCES}) -TARGET_NAMING (h5watch STATIC) TARGET_C_PROPERTIES (h5watch STATIC " " " ") target_link_libraries (h5watch ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5watch PROPERTIES FOLDER tools/hl) @@ -27,7 +26,6 @@ if (BUILD_TESTING) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c ) add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES}) - TARGET_NAMING (hl_swmr_check_compat_vfd STATIC) TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC " " " ") target_link_libraries (hl_swmr_check_compat_vfd ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl) @@ -37,13 +35,11 @@ if (BUILD_TESTING) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c ) add_executable (extend_dset ${extend_dset_SOURCES}) - TARGET_NAMING (extend_dset STATIC) TARGET_C_PROPERTIES (extend_dset STATIC " " " ") target_link_libraries (extend_dset ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (extend_dset PROPERTIES FOLDER tools/hl) add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c) - TARGET_NAMING (h5watchgentest STATIC) TARGET_C_PROPERTIES (h5watchgentest STATIC " " " ") target_link_libraries (h5watchgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index b95ede7..3e8bc8b 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -62,8 +62,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") add_test ( NAME JAVA_datasets-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 9c6e29f..b79ba64 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -62,8 +62,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") add_test ( NAME JAVA_datatypes-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 5bf5040..56c92fe 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -61,8 +61,7 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) MACRO (ADD_H5_TEST resultfile resultcode) - string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") add_test ( NAME JAVA_groups-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 0e5ae79..495ec5e 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -63,8 +63,7 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") add_test ( NAME JAVA_intro-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 10d1b6d..ea9665b 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -57,9 +57,7 @@ SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED ${HDF5_JAVA_PACKAGE_SOVERSION}) if (WIN32) get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) - if (CMAKE_BUILD_TYPE MATCHES Debug) - set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}_D") - endif () + set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}$<$:_D>") # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") if (BUILD_TESTING) add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 5c8fa8d..49cda32 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -88,8 +88,7 @@ endforeach () set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}") set (testfilter "OK (598 tests)") -string(TOUPPER ${HDF5_BUILD_TYPE} CMD_BUILD_TYPE) -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$;") + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") add_test ( NAME JUnit-interface-clearall-objects COMMAND ${CMAKE_COMMAND} diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index ecf972d..5993a0f 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -37,7 +37,7 @@ I. Preconditions 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 1.10.x product requires a minimum CMake version - of 3.2.2. + of 3.10.1. 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for @@ -101,10 +101,10 @@ These steps are described in more detail below. * Unix Makefiles * Visual Studio 12 2013 * Visual Studio 12 2013 Win64 - * Visual Studio 11 2012 - * Visual Studio 11 2012 Win64 * Visual Studio 14 2015 * Visual Studio 14 2015 Win64 + * Visual Studio 15 2017 + * Visual Studio 15 2017 Win64 is: * BUILD_TESTING:BOOL=ON @@ -180,7 +180,7 @@ Given the preconditions in section I, create a CMakeLists.txt file at the source root. Include the following text in the file: ########################################################## -cmake_minimum_required (VERSION 3.2.2) +cmake_minimum_required (VERSION 3.10.1) project (HDF5MyApp C CXX) set (LIB_TYPE STATIC) # or SHARED @@ -194,7 +194,6 @@ set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_${LIB_TYPE}_LIBRARY}) set (example hdf_example) add_executable (${example} ${PROJECT_SOURCE_DIR}/${example}.c) -TARGET_NAMING (${example} ${LIB_TYPE}) TARGET_C_PROPERTIES (${example} ${LIB_TYPE} " " " ") target_link_libraries (${example} ${LINK_LIBS}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 713f2bd..5e0c990 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -172,13 +172,11 @@ set (testhdf5_SOURCES #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) -TARGET_NAMING (testhdf5 STATIC) TARGET_C_PROPERTIES (testhdf5 STATIC " " " ") target_link_libraries (testhdf5 ${HDF5_TEST_LIB_TARGET}) set_target_properties (testhdf5 PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (testhdf5-shared ${testhdf5_SOURCES}) - TARGET_NAMING (testhdf5-shared SHARED) TARGET_C_PROPERTIES (testhdf5-shared SHARED " " " ") target_link_libraries (testhdf5-shared PUBLIC ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (testhdf5-shared PROPERTIES FOLDER test) @@ -186,13 +184,11 @@ endif () MACRO (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - TARGET_NAMING (${file} STATIC) TARGET_C_PROPERTIES (${file} STATIC " " " ") target_link_libraries (${file} PUBLIC ${HDF5_TEST_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 PUBLIC ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (${file}-shared PROPERTIES FOLDER test) @@ -299,7 +295,6 @@ add_executable (cache_image ${HDF5_TEST_SOURCE_DIR}/cache_image.c ${HDF5_TEST_SOURCE_DIR}/genall5.c ) -TARGET_NAMING (cache_image STATIC) TARGET_C_PROPERTIES (cache_image STATIC " " " ") target_link_libraries (cache_image ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (cache_image PROPERTIES FOLDER test) @@ -308,7 +303,6 @@ if (BUILD_SHARED_LIBS) ${HDF5_TEST_SOURCE_DIR}/cache_image.c ${HDF5_TEST_SOURCE_DIR}/genall5.c ) - TARGET_NAMING (cache_image-shared SHARED) TARGET_C_PROPERTIES (cache_image-shared SHARED " " " ") target_link_libraries (cache_image-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (cache_image-shared PROPERTIES FOLDER test) @@ -316,13 +310,11 @@ endif () #-- Adding test for hyperslab add_executable (hyperslab ${HDF5_TEST_SOURCE_DIR}/hyperslab.c) -TARGET_NAMING (hyperslab STATIC) TARGET_C_PROPERTIES (hyperslab STATIC " " " ") target_link_libraries (hyperslab ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (hyperslab PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (hyperslab-shared ${HDF5_TEST_SOURCE_DIR}/hyperslab.c) - TARGET_NAMING (hyperslab-shared SHARED) TARGET_C_PROPERTIES (hyperslab-shared SHARED " " " ") target_link_libraries (hyperslab-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (hyperslab-shared PROPERTIES FOLDER test) @@ -342,7 +334,6 @@ add_executable (ttsafe ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c ) -TARGET_NAMING (ttsafe STATIC) TARGET_C_PROPERTIES (ttsafe STATIC " " " ") target_link_libraries (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (ttsafe PROPERTIES FOLDER test) @@ -354,7 +345,6 @@ if (BUILD_SHARED_LIBS) ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c ) - TARGET_NAMING (ttsafe-shared SHARED) TARGET_C_PROPERTIES (ttsafe-shared SHARED " " " ") target_link_libraries (ttsafe-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (ttsafe-shared PROPERTIES FOLDER test) @@ -386,7 +376,6 @@ endforeach () # This has to be copied to the test directory for execve() to find it # and it can't be renamed (i.e., no -shared). add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c) -TARGET_NAMING (accum_swmr_reader STATIC) TARGET_C_PROPERTIES (accum_swmr_reader STATIC " " " ") target_link_libraries (accum_swmr_reader ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (accum_swmr_reader PROPERTIES FOLDER test) @@ -414,13 +403,11 @@ endif () ############################################################################## if (BUILD_SHARED_LIBS) add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - TARGET_NAMING (filter_plugin SHARED) TARGET_C_PROPERTIES (filter_plugin SHARED " " " ") target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) else () add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - TARGET_NAMING (filter_plugin STATIC) TARGET_C_PROPERTIES (filter_plugin STATIC " " " ") target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) @@ -431,13 +418,11 @@ endif () ############################################################################## set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) -TARGET_NAMING (use_append_chunk STATIC) TARGET_C_PROPERTIES (use_append_chunk STATIC " " " ") target_link_libraries (use_append_chunk ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (use_append_chunk PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES}) - TARGET_NAMING (use_append_chunk-shared SHARED) TARGET_C_PROPERTIES (use_append_chunk-shared SHARED " " " ") target_link_libraries (use_append_chunk-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test) @@ -445,13 +430,11 @@ endif () set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) -TARGET_NAMING (use_append_mchunks STATIC) TARGET_C_PROPERTIES (use_append_mchunks STATIC " " " ") target_link_libraries (use_append_mchunks ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (use_append_mchunks PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES}) - TARGET_NAMING (use_append_mchunks-shared SHARED) TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED " " " ") target_link_libraries (use_append_mchunks-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test) @@ -459,13 +442,11 @@ endif () set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) -TARGET_NAMING (use_disable_mdc_flushes STATIC) TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC " " " ") target_link_libraries (use_disable_mdc_flushes ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES}) - TARGET_NAMING (use_disable_mdc_flushes-shared SHARED) TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED " " " ") target_link_libraries (use_disable_mdc_flushes-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index fca2f27..165b6d8 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1345,7 +1345,6 @@ endif () if (HDF5_BUILD_GENERATORS) macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) - TARGET_NAMING (${genfile} STATIC) TARGET_C_PROPERTIES (${genfile} STATIC " " " ") target_link_libraries (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/test) diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index db61d35..d0b74b0 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -28,7 +28,6 @@ set (testphdf5_SOURCES #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) -TARGET_NAMING (testphdf5 STATIC) TARGET_C_PROPERTIES (testphdf5 STATIC " " " ") target_link_libraries (testphdf5 PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) @@ -38,7 +37,6 @@ set_target_properties (testphdf5 PROPERTIES FOLDER test/par) MACRO (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) - TARGET_NAMING (${file} STATIC) TARGET_C_PROPERTIES (${file} STATIC " " " ") target_link_libraries (${file} PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 23c8fae..1d9c11e 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5copy and test executables # -------------------------------------------------------------------- add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) -TARGET_NAMING (h5copy STATIC) TARGET_C_PROPERTIES (h5copy STATIC " " " ") target_link_libraries (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5copy PROPERTIES FOLDER tools) @@ -20,7 +19,6 @@ set (H5_DEP_EXECUTABLES h5copy) if (BUILD_SHARED_LIBS) add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - TARGET_NAMING (h5copy-shared SHARED) TARGET_C_PROPERTIES (h5copy-shared SHARED " " " ") target_link_libraries (h5copy-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5copy-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index b0cf66e..a485de7 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -13,7 +13,6 @@ add_executable (h5diff ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) -TARGET_NAMING (h5diff STATIC) TARGET_C_PROPERTIES (h5diff STATIC " " " ") target_link_libraries (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5diff PROPERTIES FOLDER tools) @@ -26,7 +25,6 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) - TARGET_NAMING (h5diff-shared SHARED) TARGET_C_PROPERTIES (h5diff-shared SHARED " " " ") target_link_libraries (h5diff-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5diff-shared PROPERTIES FOLDER tools) @@ -40,7 +38,6 @@ if (H5_HAVE_PARALLEL) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c ) - TARGET_NAMING (ph5diff STATIC) TARGET_C_PROPERTIES (ph5diff STATIC " " " ") target_link_libraries (ph5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (ph5diff PROPERTIES FOLDER tools) diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index c58b20c..bcfa89c 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -14,7 +14,6 @@ add_executable (h5dump ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) -TARGET_NAMING (h5dump STATIC) TARGET_C_PROPERTIES (h5dump STATIC " " " ") target_link_libraries (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dump PROPERTIES FOLDER tools) @@ -28,7 +27,6 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) - TARGET_NAMING (h5dump-shared SHARED) TARGET_C_PROPERTIES (h5dump-shared SHARED " " " ") target_link_libraries (h5dump-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5dump-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 1e3e62f..0f6d8d9 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5format_convert executables # -------------------------------------------------------------------- add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) -TARGET_NAMING (h5format_convert STATIC) TARGET_C_PROPERTIES (h5format_convert STATIC " " " ") target_link_libraries (h5format_convert ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5format_convert PROPERTIES FOLDER tools) diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index bebc6d8..4aa8938 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) -TARGET_NAMING (h5import STATIC) TARGET_C_PROPERTIES (h5import STATIC " " " ") target_link_libraries (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index 1075180..fbd4250 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -10,14 +10,12 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5jam executables # -------------------------------------------------------------------- add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) -TARGET_NAMING (h5jam STATIC) TARGET_C_PROPERTIES (h5jam STATIC " " " ") target_link_libraries (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5jam PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) -TARGET_NAMING (h5unjam STATIC) TARGET_C_PROPERTIES (h5unjam STATIC " " " ") target_link_libraries (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5unjam PROPERTIES FOLDER tools) diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 0e3d57f..703e55e 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5ls executable #----------------------------------------------------------------------------- add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) -TARGET_NAMING (h5ls STATIC) TARGET_C_PROPERTIES (h5ls STATIC " " " ") target_link_libraries (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5ls PROPERTIES FOLDER tools) @@ -20,7 +19,6 @@ set (H5_DEP_EXECUTABLES h5ls) if (BUILD_SHARED_LIBS) add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - TARGET_NAMING (h5ls-shared SHARED) TARGET_C_PROPERTIES (h5ls-shared SHARED " " " ") target_link_libraries (h5ls-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5ls-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index abf4c24..a646819 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -21,7 +21,6 @@ set (REPACK_COMMON_SOURCES ) add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) -TARGET_NAMING (h5repack STATIC) TARGET_C_PROPERTIES (h5repack STATIC " " " ") target_link_libraries (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repack PROPERTIES FOLDER tools) @@ -31,7 +30,6 @@ set (H5_DEP_EXECUTABLES h5repack) if (BUILD_SHARED_LIBS) add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - TARGET_NAMING (h5repack-shared SHARED) TARGET_C_PROPERTIES (h5repack-shared SHARED " " " ") target_link_libraries (h5repack-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repack-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index 60d3f7c..cde81ee 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5stat executables # -------------------------------------------------------------------- add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) -TARGET_NAMING (h5stat STATIC) TARGET_C_PROPERTIES (h5stat STATIC " " " ") target_link_libraries (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5stat PROPERTIES FOLDER tools) @@ -20,7 +19,6 @@ set (H5_DEP_EXECUTABLES h5stat) if (BUILD_SHARED_LIBS) add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - TARGET_NAMING (h5stat-shared SHARED) TARGET_C_PROPERTIES (h5stat-shared SHARED " " " ") target_link_libraries (h5stat-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5stat-shared PROPERTIES FOLDER tools) diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 20c9171..313760f 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -11,28 +11,24 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- #-- Misc Executables add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) -TARGET_NAMING (h5debug STATIC) TARGET_C_PROPERTIES (h5debug STATIC " " " ") target_link_libraries (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5debug PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) -TARGET_NAMING (h5repart STATIC) TARGET_C_PROPERTIES (h5repart STATIC " " " ") target_link_libraries (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) -TARGET_NAMING (h5mkgrp STATIC) TARGET_C_PROPERTIES (h5mkgrp STATIC " " " ") target_link_libraries (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5mkgrp PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) -TARGET_NAMING (h5clear STATIC) TARGET_C_PROPERTIES (h5clear STATIC " " " ") target_link_libraries (h5clear ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5clear PROPERTIES FOLDER tools) diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index c57cd5e..35aee35 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -12,7 +12,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) if (HDF5_BUILD_GENERATORS) add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c) - TARGET_NAMING (h5copygentest STATIC) TARGET_C_PROPERTIES (h5copygentest STATIC " " " ") target_link_libraries (h5copygentest ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index 9a41fb3..def2e6d 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - TARGET_NAMING (h5diffgentest STATIC) TARGET_C_PROPERTIES (h5diffgentest STATIC " " " ") target_link_libraries (h5diffgentest ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 89c7534..c4f2b95 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -39,7 +39,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - TARGET_NAMING (h5dumpgentest STATIC) TARGET_C_PROPERTIES (h5dumpgentest STATIC " " " ") target_link_libraries (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 7e47b13..497f463 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -10,14 +10,12 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5format_convert test executables # -------------------------------------------------------------------- add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c) - TARGET_NAMING (h5fc_chk_idx STATIC) TARGET_C_PROPERTIES (h5fc_chk_idx STATIC " " " ") target_link_libraries (h5fc_chk_idx ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools) if (HDF5_BUILD_GENERATORS) add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c) - TARGET_NAMING (h5fc_gentest STATIC) TARGET_C_PROPERTIES (h5fc_gentest STATIC " " " ") target_link_libraries (h5fc_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 0d23e5d..36bfbdc 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -10,7 +10,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c) - TARGET_NAMING (h5importtest STATIC) TARGET_C_PROPERTIES (h5importtest STATIC " " " ") target_link_libraries (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5importtest PROPERTIES FOLDER tools) diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 562b4f3..dbac14b 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c) - TARGET_NAMING (h5jamgentest STATIC) TARGET_C_PROPERTIES (testhdf5 STATIC " " " ") target_link_libraries (h5jamgentest ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) @@ -20,13 +19,11 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) -TARGET_NAMING (getub STATIC) TARGET_C_PROPERTIES (getub STATIC " " " ") target_link_libraries (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (getub PROPERTIES FOLDER tools) add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c) -TARGET_NAMING (tellub STATIC) TARGET_C_PROPERTIES (tellub STATIC " " " ") target_link_libraries (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (tellub PROPERTIES FOLDER tools) diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 9d67ec3..5996fff 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -12,7 +12,6 @@ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) # Add h5Repack test executables # -------------------------------------------------------------------- add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) -TARGET_NAMING (testh5repack_detect_szip STATIC) TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC " " " ") target_link_libraries (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools) @@ -27,7 +26,6 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c ) add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c) -TARGET_NAMING (h5repacktest STATIC) TARGET_C_PROPERTIES (h5repacktest STATIC " " " ") target_link_libraries (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5repacktest PROPERTIES FOLDER tools) diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index 10ac5e0..d2a1de2 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c) - TARGET_NAMING (h5stat_gentest STATIC) TARGET_C_PROPERTIES (h5stat_gentest STATIC " " " ") target_link_libraries (h5stat_gentest ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 5e3c0a2..48bc8ab 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -11,14 +11,12 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) - TARGET_NAMING (h5repart_gentest STATIC) TARGET_C_PROPERTIES (h5repart_gentest STATIC " " " ") target_link_libraries (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) - TARGET_NAMING (h5clear_gentest STATIC) TARGET_C_PROPERTIES (h5clear_gentest STATIC " " " ") target_link_libraries (h5clear_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) @@ -29,13 +27,11 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) - TARGET_NAMING (h5repart_test STATIC) TARGET_C_PROPERTIES (h5repart_test STATIC " " " ") target_link_libraries (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart_test PROPERTIES FOLDER tools) add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) - TARGET_NAMING (clear_open_chk STATIC) TARGET_C_PROPERTIES (clear_open_chk STATIC " " " ") target_link_libraries (clear_open_chk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (clear_open_chk PROPERTIES FOLDER tools) diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index ec672e5..9092079 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -8,7 +8,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) MACRO (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c) - TARGET_NAMING (${genfile} STATIC) TARGET_C_PROPERTIES (${genfile} STATIC " " " ") target_link_libraries (${genfile} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 20250c6..581a85e 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -21,7 +21,6 @@ set (h5perf_serial_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial ${h5perf_serial_SOURCES}) -TARGET_NAMING (h5perf_serial STATIC) TARGET_C_PROPERTIES (h5perf_serial STATIC " " " ") target_link_libraries (h5perf_serial ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5perf_serial PROPERTIES FOLDER perform) @@ -33,7 +32,6 @@ if (HDF5_BUILD_PERFORM_STANDALONE) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - TARGET_NAMING (h5perf_serial_alone STATIC) TARGET_C_PROPERTIES (h5perf_serial_alone STATIC " " " ") target_link_libraries (h5perf_serial_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) @@ -47,7 +45,6 @@ set (chunk_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c ) ADD_EXECUTABLE(chunk ${chunk_SOURCES}) -TARGET_NAMING (chunk STATIC) TARGET_C_PROPERTIES (chunk STATIC " " " ") TARGET_LINK_LIBRARIES(chunk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (chunk PROPERTIES FOLDER perform) @@ -57,7 +54,6 @@ set (iopipe_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c ) add_executable (iopipe ${iopipe_SOURCES}) -TARGET_NAMING (iopipe STATIC) TARGET_C_PROPERTIES (iopipe STATIC " " " ") target_link_libraries (iopipe ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (iopipe PROPERTIES FOLDER perform) @@ -67,7 +63,6 @@ set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c ) add_executable (overhead ${overhead_SOURCES}) -TARGET_NAMING (overhead STATIC) TARGET_C_PROPERTIES (overhead STATIC " " " ") target_link_libraries (overhead ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (overhead PROPERTIES FOLDER perform) @@ -77,7 +72,6 @@ set_target_properties (overhead PROPERTIES FOLDER perform) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c ) add_executable (perf_meta ${perf_meta_SOURCES}) - TARGET_NAMING (perf_meta STATIC) TARGET_C_PROPERTIES (perf_meta STATIC " " " ") target_link_libraries (perf_meta ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (perf_meta PROPERTIES FOLDER perform) @@ -87,7 +81,6 @@ set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c ) add_executable (zip_perf ${zip_perf_SOURCES}) -TARGET_NAMING (zip_perf STATIC) TARGET_C_PROPERTIES (zip_perf STATIC " " " ") target_link_libraries (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (zip_perf PROPERTIES FOLDER perform) @@ -99,7 +92,6 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf ${h5perf_SOURCES}) - TARGET_NAMING (h5perf STATIC) TARGET_C_PROPERTIES (h5perf STATIC " " " ") target_link_libraries (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5perf PROPERTIES FOLDER perform) @@ -111,7 +103,6 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - TARGET_NAMING (h5perf_alone STATIC) TARGET_C_PROPERTIES (h5perf_alone STATIC " " " ") target_link_libraries (h5perf_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5perf_alone PROPERTIES FOLDER perform) -- cgit v0.12 From 601ae0ebbc2b766ebf2662315b3143b0f903d76b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 17 Jan 2018 11:56:42 -0600 Subject: HDFFV-10392 change size of local array to 16 chars --- tools/src/h5repack/h5repack_parse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index 05af197..03fcf0e 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -45,9 +45,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, int f, k, l, p, q, end_obj = -1, no_param = 0; unsigned j, n; char sobj[MAX_NC_NAME]; - char scomp[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - char stype[6] = {0, 0, 0, 0, 0, 0}; - char smask[3] = {0, 0, 0}; + char scomp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + char stype[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + char smask[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; obj_list_t* obj_list = NULL; unsigned pixels_per_block; @@ -116,7 +116,6 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, if (c == '=' || i == len - 1) { if (c == '=') { /*one more parameter */ scomp[k] = '\0'; /*cut space */ - /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP * szip has the format SZIP= @@ -236,8 +235,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, filt->cd_nelmts = HDstrtoull(stype, NULL, 0); p = 0; } - else + else { filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0); + } q = 0; u++; /* skip ',' */ } @@ -462,7 +462,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, return obj_list; } - + /*------------------------------------------------------------------------- * Function: parse_layout * -- cgit v0.12 From 3374818d14c11e9177370fe940c966240de34052 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jan 2018 14:21:41 -0600 Subject: HDFFV-10393 fix incorrect search for name in h5repack object table --- release_docs/RELEASE.txt | 26 ++++++++++++++++++++++++++ tools/src/h5repack/h5repack_filters.c | 12 +++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 04f2ce0..790313f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -300,6 +300,32 @@ Bug Fixes since HDF5-1.10.1 release Tools ----- + - h5repack + + h5repack incorrectly searched internal object table for name. + + h5repack would search the table of objects for a name, if the + name did not match it tried to determine if the name without a + leading slash would match. The logic was flawed! The table + stored names(paths) without a leading slash and did a strstr + of the table path to the name. + The assumption was that if there was a difference of one then + it was a match, however "pressure" would match "/pressure" as + well as "/pressure1", "/pressure2", etc. Changed logic to remove + any leading slash and then do a full compare of the name. + + (ADB - 2018/01/18, HDFFV-10393) + + - h5repack + + h5repack failed to handle more then 9 chars for int conversion. + + User defined filter parameter conversions would fail for integers + larger then 9 characters. Increased local variable array for storing + the current command line parameter to prevent buffer overflows. + + (ADB - 2018/01/17, HDFFV-10392) + - h5diff h5diff seg faulted if comparing VL strings against fixed strings. diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 067ebad..ae0bfd5 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -84,7 +84,8 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ pack_opt_t *options, /* repack options */ pack_info_t *obj /*OUT*/) /* info about object to filter */ { - char *pdest; + char *pdest = NULL; + char *pname = NULL; int result; unsigned int i; @@ -94,11 +95,12 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ return (int) i; } - pdest = HDstrstr(name, options->op_tbl->objs[i].path); - result = (int) (pdest - name); + pdest = options->op_tbl->objs[i].path; + if (pdest[0] == '/') pdest++; + pname = name; + if (pname[0] == '/') pname++; - /* found at position 1, meaning without '/' */ - if (pdest != NULL && result == 1) { + if (HDstrcmp(pdest, pname) == 0) { *obj = options->op_tbl->objs[i]; return (int) i; } -- cgit v0.12 From 0f5ada2e0819bc107b2da0fc7d9a93bc4cd5b200 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jan 2018 16:54:55 -0600 Subject: HDFFV-10385 Refactor out CMAKE_BUILD_TYPE usage --- CMakeLists.txt | 2 +- config/cmake/HDFCompilerFlags.cmake | 4 ++-- config/cmake_ext_mod/HDFMacros.cmake | 19 ++++++------------- test/CMakeTests.cmake | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb01cd4..1663df4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -584,7 +584,7 @@ option (HDF5_BUILD_GENERATORS "Build Test Generators" OFF) #----------------------------------------------------------------------------- option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF) mark_as_advanced (HDF5_ENABLE_TRACE) -if (CMAKE_BUILD_TYPE MATCHES Debug) +if (${HDF5_CFG_NAME} MATCHES "Debug") add_definitions (-DDEBUG) # Enable tracing of the API if (HDF5_ENABLE_TRACE) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 72d320c..c126b24 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -13,7 +13,7 @@ # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (${HDF5_CFG_NAME} MATCHES "Debug") set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") @@ -26,7 +26,7 @@ if (CMAKE_COMPILER_IS_GNUCC) endif () endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - if (CMAKE_BUILD_TYPE MATCHES Debug) + if (${HDF5_CFG_NAME} MATCHES "Debug") set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 2813de6..d7d256f 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -104,35 +104,28 @@ endmacro () #------------------------------------------------------------------------------- macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) - set (LIB_DEBUG_PREFIX "") if (WIN32) set (LIB_DEBUG_SUFFIX "_D") else () set (LIB_DEBUG_SUFFIX "_debug") endif () if (${libtype} MATCHES "SHARED") - if (WIN32) - set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}_D") - else () - set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}_debug") - endif () + set (LIB_RELEASE_NAME "${libname}") + set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") else () if (WIN32) - set (LIB_DEBUG_PREFIX "lib") set (LIB_RELEASE_NAME "lib${libname}") - set (LIB_DEBUG_NAME "lib${libname}_D") + set (LIB_DEBUG_NAME "lib${libname}${LIB_DEBUG_SUFFIX}") else () set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}_debug") + set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") endif () endif () set_target_properties (${libtarget} PROPERTIES # OUTPUT_NAME -# ${LIB_DEBUG_PREFIX}${libname}$<$:${LIB_DEBUG_SUFFIX}> +# ${LIB_RELEASE_NAME}$<$:${LIB_DEBUG_SUFFIX}> OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} OUTPUT_NAME_RELEASE @@ -173,7 +166,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${CMAKE_BUILD_TYPE} MATCHES "Debug") + if (${HDF5_CFG_NAME} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 165b6d8..dd92065 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1133,7 +1133,7 @@ if (HDF5_TEST_VFD) macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") - if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) + if (NOT BUILD_SHARED_LIBS AND NOT ${HDF5_CFG_NAME} MATCHES "Debug") add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -- cgit v0.12 From 608a71200d4f70708c141790ec33f88e2e1a9993 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Jan 2018 10:49:17 -0600 Subject: HDFFV-10385 rename vars and macros --- CMakeLists.txt | 12 +++++------- config/cmake/HDFCompilerFlags.cmake | 4 ++-- config/cmake_ext_mod/HDFMacros.cmake | 26 +++++++++++++------------- fortran/src/CMakeLists.txt | 4 ++-- fortran/test/CMakeLists.txt | 4 ++-- hl/fortran/src/CMakeLists.txt | 4 ++-- release_docs/RELEASE.txt | 4 ++-- test/CMakeTests.cmake | 2 +- 8 files changed, 29 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1663df4..ce0aadf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -409,7 +409,7 @@ include (${HDF_RESOURCES_EXT_DIR}/HDFMacros.cmake) include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake) include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake) -SET_HDF5_BUILD_TYPE() +SET_HDF_BUILD_TYPE() #----------------------------------------------------------------------------- # Setup output Directories @@ -553,11 +553,9 @@ endif () set (EXE_EXT "") if (WIN32) set (EXE_EXT ".exe") - if (NOT CYGWIN) - add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) - add_definitions (-D_CRT_SECURE_NO_WARNINGS) - add_definitions (-D_CONSOLE) - endif () + add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + add_definitions (-D_CONSOLE) endif () if (MSVC) @@ -584,7 +582,7 @@ option (HDF5_BUILD_GENERATORS "Build Test Generators" OFF) #----------------------------------------------------------------------------- option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF) mark_as_advanced (HDF5_ENABLE_TRACE) -if (${HDF5_CFG_NAME} MATCHES "Debug") +if (${HDF_CFG_NAME} MATCHES "Debug") add_definitions (-DDEBUG) # Enable tracing of the API if (HDF5_ENABLE_TRACE) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index c126b24..a414cea 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -13,7 +13,7 @@ # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) - if (${HDF5_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug") set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") @@ -26,7 +26,7 @@ if (CMAKE_COMPILER_IS_GNUCC) endif () endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - if (${HDF5_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug") set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index d7d256f..870ff5a 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -11,20 +11,20 @@ # #------------------------------------------------------------------------------- -macro (SET_HDF5_BUILD_TYPE) +macro (SET_HDF_BUILD_TYPE) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - set(HDF5_CFG_NAME ${CTEST_CONFIGURATION_TYPE}) - set(HDF5_BUILD_TYPE ${CMAKE_CFG_INTDIR}) - set(HDF5_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) + set(HDF_CFG_NAME ${CTEST_CONFIGURATION_TYPE}) + set(HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR}) + set(HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) else() - set(HDF5_CFG_BUILD_TYPE ".") + set(HDF_CFG_BUILD_TYPE ".") if(CMAKE_BUILD_TYPE) - set(HDF5_CFG_NAME ${CMAKE_BUILD_TYPE}) - set(HDF5_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + set(HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) + set(HDF_BUILD_TYPE ${CMAKE_BUILD_TYPE}) else() - set(HDF5_CFG_NAME "Release") - set(HDF5_BUILD_TYPE "Release") + set(HDF_CFG_NAME "Release") + set(HDF_BUILD_TYPE "Release") endif() endif() if(NOT CMAKE_BUILD_TYPE) @@ -166,7 +166,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${HDF5_CFG_NAME} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) @@ -181,8 +181,8 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) ) else () set_target_properties (${libtarget} PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) endif () else () @@ -202,7 +202,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) else () if (WIN32 AND NOT MINGW) set_target_properties (${libtarget} PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) else () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 7ed5fef..b664c50 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -66,10 +66,10 @@ set_target_properties (H5_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR} ${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index e9eed90..2990bcc 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -34,10 +34,10 @@ set_target_properties (H5_test_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Add Test Lib diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 9190354..b1a639a 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -38,10 +38,10 @@ set_target_properties (H5HL_buildiface PROPERTIES if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") - set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF5_CFG_BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF5_CFG_BUILD_TYPE}) +set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Setup include Directories diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 790313f..3f0ea92 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -59,7 +59,7 @@ New Features Refactor use of CMAKE_BUILD_TYPE for new variable, which understands the type of generator in use. - Added new configuration macros to use new HDF5_BUILD_TYPE variable. This + Added new configuration macros to use new HDF_BUILD_TYPE variable. This variable is set correctly for the type of generator being used for the build. (ADB - 2018/01/08, HDFFV-10385, HDFFV-10296) @@ -242,7 +242,7 @@ Bug Fixes since HDF5-1.10.1 release generators (Visual Studio and XCode) and is optional for single config generators. Created a new macro to check GLOBAL PROPERTY -> GENERATOR_IS_MULTI_CONFIG - Created two new HDF variable, HDF5_BUILD_TYPE and HDF5_CFG_BUILD_TYPE. + Created two new HDF variable, HDF_BUILD_TYPE and HDF_CFG_BUILD_TYPE. Defaults for these variables is "Release". (ADB - 2018/01/10, HDFFV-10385) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index dd92065..e6b364c 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1133,7 +1133,7 @@ if (HDF5_TEST_VFD) macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") - if (NOT BUILD_SHARED_LIBS AND NOT ${HDF5_CFG_NAME} MATCHES "Debug") + if (NOT BUILD_SHARED_LIBS AND NOT ${HDF_CFG_NAME} MATCHES "Debug") add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -- cgit v0.12