This commit is contained in:
Binh-Minh Ribler 2019-05-05 00:43:37 -05:00
commit 8a57a68339
77 changed files with 7692 additions and 3837 deletions

View File

@ -1,4 +1,4 @@
HDF5 version 1.11.5 currently under development
HDF5 version 1.11.6 currently under development
------------------------------------------------------------------------------
Please refer to the release_docs/INSTALL file for installation instructions.

View File

@ -38,7 +38,7 @@ PROJECT_NAME =
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "1.11.5"
PROJECT_NUMBER = "1.11.6"
# 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

View File

@ -34,7 +34,7 @@ cmake_minimum_required (VERSION 3.10)
# CTEST_SOURCE_NAME - source folder
##############################################################################
set (CTEST_SOURCE_VERSION "1.11.5")
set (CTEST_SOURCE_VERSION "1.11.6")
set (CTEST_SOURCE_VERSEXT "")
##############################################################################
@ -177,6 +177,7 @@ if (NOT DEFINED HPC)
endif ()
endif ()
else ()
set (CTEST_SITE "${SITE_OS_NAME}")
set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
include (${CTEST_SOURCE_DIRECTORY}/config/cmake/scripts/HPC/${HPC}-HDF5options.cmake)
endif ()

View File

@ -1,4 +1,4 @@
# -*- shell-script -*-
# -*- shell-script -*-
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@ -37,10 +37,10 @@ if test X = "X$cc_flags_set"; then
cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'`
cc_version=`echo $cc_version |sed 's/[-a-z]//g'`
if test X = "X$cc_vendor" -a X != "X$cc_version"; then
cc_vendor=gcc
cc_vendor=gcc
fi
if test "-" != "$cc_vendor-$cc_version"; then
echo "compiler '$CC' is GNU $cc_vendor-$cc_version"
echo "compiler '$CC' is GNU $cc_vendor-$cc_version"
fi
# Some version numbers
@ -87,7 +87,7 @@ case "$cc_vendor-$cc_version" in
case "$host_os-$host_cpu" in
# cygwin needs the "-std=c99" flag removed, so make
# a specific case for Cygwin without the flag and a default
# case to add the flag everywhere else
# case to add the flag everywhere else
cygwin-*)
;;
@ -111,7 +111,7 @@ case "$cc_vendor-$cc_version" in
# know if they do start showing up.
#
# NOTE: Don't add -Wpadded here since we can't/won't fix the (many)
# warnings that are emitted. If you need it, add it from the
# warnings that are emitted. If you need it, add it from the
# environment variable at configure time.
H5_CFLAGS="$H5_CFLAGS $arch -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align"
H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal"
@ -126,7 +126,7 @@ case "$cc_vendor-$cc_version" in
gcc-4.*)
PROD_CFLAGS=
;;
gcc-[56].*)
gcc-[56789].*)
PROD_CFLAGS="-fstdarg-opt"
;;
*)
@ -140,7 +140,7 @@ case "$cc_vendor-$cc_version" in
# NDEBUG is handled explicitly by the configure script
# -g is handled by the symbols flags
case "$cc_vendor-$cc_version" in
gcc-[56].*)
gcc-[56789].*)
DEBUG_CFLAGS="-ftrapv -fno-common"
;;
*)
@ -165,7 +165,7 @@ case "$cc_vendor-$cc_version" in
HIGH_OPT_CFLAGS="-O3"
DEBUG_OPT_CFLAGS=
;;
gcc-[56].*)
gcc-[56789].*)
HIGH_OPT_CFLAGS="-O3"
DEBUG_OPT_CFLAGS="-Og"
;;
@ -190,7 +190,7 @@ case "$cc_vendor-$cc_version" in
# When the gcc 7.x release is out, we should check for additional flags to
# include and break it out into it's own section, like the other versions
# below. -QAK
gcc-6*)
gcc-[6789].*)
# Append warning flags that only gcc 4.2+ knows about
# (none, or incorporated in -Wall / -Wextra now)

View File

@ -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.5], [help@hdfgroup.org])
AC_INIT([HDF5], [1.11.6], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AC_CONFIG_HEADERS([src/H5config.h])

View File

@ -212,7 +212,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
* @version HDF5 1.11.5 <BR>
* @version HDF5 1.11.6 <BR>
* <b>See also: <a href ="./hdf.hdf5lib.HDFArray.html"> hdf.hdf5lib.HDFArray</a> </b><BR>
* <a href ="./hdf.hdf5lib.HDF5Constants.html"> hdf.hdf5lib.HDF5Constants</a><BR>
* <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR>
@ -235,7 +235,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, 5 };
public final static int LIB_VERSION[] = { 1, 11, 6 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";

View File

@ -201,7 +201,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
done:
if (theArray)
UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
UNPIN_INT_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */

View File

@ -162,7 +162,7 @@ public class TestH5 {
*/
@Test
public void testH5get_libversion() {
int libversion[] = { 1, 11, 5 };
int libversion[] = { 1, 11, 6 };
try {
H5.H5get_libversion(libversion);
@ -201,7 +201,7 @@ public class TestH5 {
*/
@Test
public void testH5check_version() {
int majnum = 1, minnum = 11, relnum = 5;
int majnum = 1, minnum = 11, relnum = 6;
try {
H5.H5check_version(majnum, minnum, relnum);

View File

@ -1,4 +1,4 @@
HDF5 version 1.11.5 currently under development
HDF5 version 1.11.6 currently under development
================================================================================
@ -197,6 +197,10 @@ New Features
Java Library:
----------------
- Fix a failure in JUnit-TestH5P on 32-bit architectures
(JTH - 2019/04/30)
- Duplicate the data read/write functions of Datasets for Attributes.
Region references could not be displayed for attributes as they could

View File

@ -254,7 +254,6 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
{
void *attr = NULL; /* Attribute created */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -277,16 +276,6 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the property list structure for the acpl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set creation properties */
if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
/* Get the location object */
if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
@ -296,7 +285,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the attribute */
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
@ -350,7 +339,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
{
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5P_genplist_t *plist; /* Property list pointer */
H5VL_loc_params_t loc_params;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -380,16 +368,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
H5CX_set_lapl(lapl_id);
}
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* Set creation properties */
if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
/* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
@ -401,7 +379,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */

View File

@ -119,7 +119,6 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
void *attr = NULL; /* attr token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@ -139,16 +138,6 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(H5P_DEFAULT == acpl_id)
acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* Set creation properties */
if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@ -158,7 +147,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */

View File

@ -105,11 +105,10 @@ hid_t
H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id)
{
void *dset = NULL; /* New dataset's info */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
void *dset = NULL; /* New dataset's info */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist = NULL; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id,
@ -142,28 +141,16 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the property list structure for the dcpl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set creation properties */
if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
@ -216,9 +203,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
hid_t dapl_id)
{
void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@ -242,22 +228,12 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */

View File

@ -276,6 +276,8 @@ static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last,
static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata);
static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm,
const H5D_io_info_t *io_info);
static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm,
const H5D_io_info_t *io_info);
static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm,
const H5D_io_info_t *io_info);
static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm);
@ -1081,7 +1083,6 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
H5SL_node_t *curr_node; /* Current node in skip list */
char bogus; /* "bogus" buffer to pass to selection iterator */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@ -1205,25 +1206,17 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/* Check if file selection is a not a hyperslab selection */
if(sel_hyper_flag) {
/* Build the file selection for each chunk */
if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
if(H5S_SEL_ALL == fm->fsel_type) {
if(H5D__create_chunk_file_map_all(fm, io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
} /* end if */
else {
/* Sanity check */
HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS);
/* Clean file chunks' hyperslab span "scratch" information */
curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
H5D_chunk_info_t *chunk_info; /* Pointer chunk information */
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
HDassert(chunk_info);
/* Clean hyperslab span's "scratch" information */
if(H5S_hyper_reset_scratch(chunk_info->fspace) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
/* Get the next chunk node in the skip list */
curr_node = H5SL_next(curr_node);
} /* end while */
if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
} /* end else */
} /* end if */
else {
H5S_sel_iter_op_t iter_op; /* Operator for iteration */
@ -1285,7 +1278,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/* Create selection iterator for memory selection */
if(0 == (elmt_size = H5T_get_size(mem_type)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
if(H5S_select_iter_init(&(fm->mem_iter), mem_space, elmt_size) < 0)
if(H5S_select_iter_init(&(fm->mem_iter), mem_space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
@ -1295,26 +1288,6 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/* Spaces aren't the same shape, iterate over the memory selection directly */
if(H5S_select_iterate(&bogus, file_type, file_space, &iter_op, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
/* Clean up hyperslab stuff, if necessary */
if(fm->msel_type != H5S_SEL_POINTS) {
/* Clean memory chunks' hyperslab span "scratch" information */
curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
H5D_chunk_info_t *chunk_info; /* Pointer chunk information */
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
HDassert(chunk_info);
/* Clean hyperslab span's "scratch" information */
if(H5S_hyper_reset_scratch(chunk_info->mspace) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
/* Get the next chunk node in the skip list */
curr_node = H5SL_next(curr_node);
} /* end while */
} /* end if */
} /* end else */
} /* end else */
@ -1568,6 +1541,211 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_map_single() */
/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_file_map_all
*
* Purpose: Create all chunk selections in file, for an "all" selection.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Monday, January 21, 2019
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
#ifndef H5_HAVE_PARALLEL
H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
*io_info)
{
H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */
hsize_t file_dims[H5S_MAX_RANK]; /* File dataspace dims */
hsize_t sel_points; /* Number of elements in file selection */
hsize_t zeros[H5S_MAX_RANK]; /* All zero vector (for start parameter to setting hyperslab on partial chunks) */
hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
hsize_t end[H5S_MAX_RANK]; /* Final coordinates of chunk */
hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
hsize_t chunk_index; /* "Index" of chunk */
hsize_t curr_partial_clip[H5S_MAX_RANK]; /* Current partial dimension sizes to clip against */
hsize_t partial_dim_size[H5S_MAX_RANK]; /* Size of a partial dimension */
hbool_t is_partial_dim[H5S_MAX_RANK]; /* Whether a dimension is currently a partial chunk */
unsigned num_partial_dims; /* Current number of partial dimensions */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(fm->f_ndims > 0);
/* Get number of elements selected in file */
sel_points = fm->nelmts;
/* Get dataspace dimensions */
if(H5S_get_simple_extent_dims(fm->file_space, file_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Set initial chunk location, partial dimensions, etc */
num_partial_dims = 0;
HDmemset(zeros, 0, sizeof(zeros));
for(u = 0; u < fm->f_ndims; u++) {
/* Validate this chunk dimension */
if(fm->layout->u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
/* Set up start / end coordinates for first chunk */
scaled[u] = 0;
coords[u] = 0;
end[u] = fm->chunk_dim[u] - 1;
/* Iniitialize partial chunk dimension information */
partial_dim_size[u] = file_dims[u] % fm->chunk_dim[u];
if(file_dims[u] < fm->chunk_dim[u]) {
curr_partial_clip[u] = partial_dim_size[u];
is_partial_dim[u] = TRUE;
num_partial_dims++;
} /* end if */
else {
curr_partial_clip[u] = fm->chunk_dim[u];
is_partial_dim[u] = FALSE;
} /* end else */
} /* end for */
/* Set the index of this chunk */
chunk_index = 0;
/* Create "temporary" chunk for selection operations (copy file space) */
if(NULL == (tmp_fchunk = H5S_create_simple(fm->f_ndims, fm->chunk_dim, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
/* Iterate through each chunk in the dataset */
while(sel_points) {
H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
hssize_t schunk_points; /* Number of elements in chunk selection */
/* Add temporary chunk to the list of chunks */
/* Allocate the file & memory chunk information */
if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
/* Set the chunk index */
new_chunk_info->index = chunk_index;
#ifdef H5_HAVE_PARALLEL
/* Store chunk selection information, for multi-chunk I/O */
if(io_info->using_mpi_vfd)
fm->select_chunk[chunk_index] = new_chunk_info;
#endif /* H5_HAVE_PARALLEL */
/* Set the file chunk dataspace */
if(NULL == (new_chunk_info->fspace = H5S_copy(tmp_fchunk, TRUE, FALSE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy chunk dataspace")
new_chunk_info->fspace_shared = FALSE;
/* If there are partial dimensions for this chunk, set the hyperslab for them */
if(num_partial_dims > 0)
if(H5S_select_hyperslab(new_chunk_info->fspace, H5S_SELECT_SET, zeros, NULL, curr_partial_clip, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk selection")
/* Set the memory chunk dataspace */
new_chunk_info->mspace = NULL;
new_chunk_info->mspace_shared = FALSE;
/* Copy the chunk's scaled coordinates */
H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
new_chunk_info->scaled[fm->f_ndims] = 0;
/* Insert the new chunk into the skip list */
if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
H5D__free_chunk_info(new_chunk_info, NULL, NULL);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list")
} /* end if */
/* Get number of elements selected in chunk */
if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t);
/* Decrement # of points left in file selection */
sel_points -= (hsize_t)schunk_points;
/* Advance to next chunk if we are not done */
if(sel_points > 0) {
int curr_dim; /* Current dimension to increment */
/* Increment chunk index */
chunk_index++;
/* Set current increment dimension */
curr_dim = (int)fm->f_ndims - 1;
/* Increment chunk location in fastest changing dimension */
coords[curr_dim] += fm->chunk_dim[curr_dim];
scaled[curr_dim]++;
end[curr_dim] += fm->chunk_dim[curr_dim];
/* Bring chunk location back into bounds, if necessary */
if(coords[curr_dim] >= file_dims[curr_dim]) {
do {
/* Reset current dimension's location to 0 */
coords[curr_dim] = 0;
scaled[curr_dim] = 0;
end[curr_dim] = fm->chunk_dim[curr_dim] - 1;
/* Check for previous partial chunk in this dimension */
if(is_partial_dim[curr_dim] && end[curr_dim] < file_dims[curr_dim]) {
/* Sanity check */
HDassert(num_partial_dims > 0);
/* Reset partial chunk information for this dimension */
curr_partial_clip[curr_dim] = fm->chunk_dim[curr_dim];
is_partial_dim[curr_dim] = FALSE;
num_partial_dims--;
} /* end if */
/* Decrement current dimension */
curr_dim--;
/* Check for valid current dim */
if(curr_dim >= 0) {
/* Increment chunk location in current dimension */
coords[curr_dim] += fm->chunk_dim[curr_dim];
scaled[curr_dim]++;
end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
} /* end if */
} while(curr_dim >= 0 && (coords[curr_dim] >= file_dims[curr_dim]));
} /* end if */
/* Check for valid current dim */
if(curr_dim >= 0) {
/* Check for partial chunk in this dimension */
if(!is_partial_dim[curr_dim] && file_dims[curr_dim] <= end[curr_dim]) {
/* Set partial chunk information for this dimension */
curr_partial_clip[curr_dim] = partial_dim_size[curr_dim];
is_partial_dim[curr_dim] = TRUE;
num_partial_dims++;
/* Sanity check */
HDassert(num_partial_dims <= fm->f_ndims);
} /* end if */
} /* end if */
} /* end if */
} /* end while */
done:
/* Clean up */
if(tmp_fchunk && H5S_close(tmp_fchunk) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_file_map_all() */
/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_file_map_hyper
@ -1588,6 +1766,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
#endif /* H5_HAVE_PARALLEL */
*io_info)
{
H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */
hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
hsize_t sel_points; /* Number of elements in file selection */
@ -1631,45 +1810,28 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Check for intersection of current chunk and file selection */
/* (Casting away const OK - QAK) */
if(TRUE == H5S_hyper_intersect_block((H5S_t *)fm->file_space, coords, end)) {
H5S_t *tmp_fchunk; /* Temporary file dataspace */
H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
hssize_t schunk_points; /* Number of elements in chunk selection */
/* Create "temporary" chunk for selection operations (copy file space) */
if(NULL == (tmp_fchunk = H5S_copy(fm->file_space, TRUE, FALSE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */
if(H5S_hyper_convert(tmp_fchunk) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees")
} /* end if */
/* "AND" temporary chunk and current chunk */
if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create chunk selection")
} /* end if */
/* Create dataspace for chunk, 'AND'ing the overall selection with
* the current chunk.
*/
if(H5S_combine_hyperslab(fm->file_space, H5S_SELECT_AND, coords, NULL, fm->chunk_dim, NULL, &tmp_fchunk) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to combine file space selection with chunk block")
/* Resize chunk's dataspace dimensions to size of chunk */
if(H5S_set_extent_real(tmp_fchunk,fm->chunk_dim) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions")
} /* end if */
if(H5S_set_extent_real(tmp_fchunk, fm->chunk_dim) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions")
/* Move selection back to have correct offset in chunk */
if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
}
if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
/* Add temporary chunk to the list of chunks */
/* Allocate the file & memory chunk information */
if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
} /* end if */
if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
@ -1685,6 +1847,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Set the file chunk dataspace */
new_chunk_info->fspace = tmp_fchunk;
new_chunk_info->fspace_shared = FALSE;
tmp_fchunk = NULL;
/* Set the memory chunk dataspace */
new_chunk_info->mspace = NULL;
@ -1701,7 +1864,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Get number of elements selected in chunk */
if((schunk_points = H5S_GET_SELECT_NPOINTS(tmp_fchunk)) < 0)
if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t);
@ -1750,6 +1913,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end while */
done:
/* Clean up on failure */
if(ret_value < 0)
if(tmp_fchunk && H5S_close(tmp_fchunk) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_file_map_hyper() */
@ -1773,13 +1941,13 @@ done:
static herr_t
H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
{
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
H5SL_node_t *curr_node; /* Current node in skip list */
hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@ -1790,8 +1958,6 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
/* Check for all I/O going to a single chunk */
if(H5SL_count(fm->sel_chunks)==1) {
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
/* Get the node */
curr_node = H5SL_first(fm->sel_chunks);
@ -1826,41 +1992,61 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
/* Iterate over each chunk in the chunk list */
curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */
H5S_sel_type chunk_sel_type; /* Chunk's selection type */
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
HDassert(chunk_info);
/* Compute the chunk coordinates from the scaled coordinates */
for(u = 0; u < fm->f_ndims; u++)
coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
/* Copy the information */
/* Copy the memory dataspace */
if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Release the current selection */
if(H5S_SELECT_RELEASE(chunk_info->mspace) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
/* Get the chunk's selection type */
if((chunk_sel_type = H5S_GET_SELECT_TYPE(chunk_info->fspace)) < H5S_SEL_NONE)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection")
/* Copy the file chunk's selection */
if(H5S_select_copy(chunk_info->mspace,chunk_info->fspace,FALSE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
/* Set memory selection for "all" chunk selections */
if(H5S_SEL_ALL == chunk_sel_type) {
/* Adjust the chunk coordinates */
for(u = 0; u < fm->f_ndims; u++)
coords[u] -= adjust[u];
/* Compute the adjustment for this chunk */
for(u = 0; u < fm->f_ndims; u++) {
hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
/* Set to same shape as chunk */
if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection")
} /* end if */
else {
/* Sanity check */
HDassert(H5S_SEL_HYPERSLABS == chunk_sel_type);
/* Compute the chunk coordinates from the scaled coordinates */
coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
/* Release the current selection */
if(H5S_SELECT_RELEASE(chunk_info->mspace) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
/* Compensate for the chunk offset */
H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t);
chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; /*lint !e771 The adjust array will always be initialized */
} /* end for */
/* Copy the file chunk's selection */
if(H5S_select_copy(chunk_info->mspace, chunk_info->fspace, FALSE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
/* Adjust the selection */
if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
/* Compute the adjustment for this chunk */
for(u = 0; u < fm->f_ndims; u++) {
/* Compensate for the chunk offset */
H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t);
chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; /*lint !e771 The adjust array will always be initialized */
} /* end for */
/* Adjust the selection */
if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
} /* end else */
/* Get the next chunk node in the skip list */
curr_node = H5SL_next(curr_node);
@ -4858,12 +5044,12 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk selection iterator")
/* Create a selection iterator for scattering the elements to memory buffer */
if(H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank]) < 0)
if(H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank], 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunk selection information")
chunk_iter_init = TRUE;
/* Scatter the data into memory */
if(H5D__scatter_mem(udata->fb_info.fill_buf, udata->chunk_space, chunk_iter, (size_t)sel_nelmts, chunk/*out*/) < 0)
if(H5D__scatter_mem(udata->fb_info.fill_buf, chunk_iter, (size_t)sel_nelmts, chunk/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")

View File

@ -116,7 +116,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
void *dset = NULL; /* dset token from VOL connector */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -143,18 +142,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id")
if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@ -164,7 +151,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the dataset through the VOL */
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */

View File

@ -276,12 +276,12 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory selection iterator")
/* Create a selection iterator for scattering the elements to memory buffer */
if(H5S_select_iter_init(mem_iter, space, dst_type_size) < 0)
if(H5S_select_iter_init(mem_iter, space, dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
/* Scatter the data into memory */
if(H5D__scatter_mem(tmp_buf, space, mem_iter, (size_t)nelmts, buf/*out*/) < 0)
if(H5D__scatter_mem(tmp_buf, mem_iter, (size_t)nelmts, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end if */
else {

View File

@ -2867,12 +2867,12 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace")
/* Initialize iterator for memory selection */
if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
/* Collect the modification data into the buffer */
if(0 == H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, mod_data_p))
if(0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t)iter_nelmts, mod_data_p))
HGOTO_ERROR(H5E_IO, H5E_CANTGATHER, FAIL, "couldn't gather from write buffer")
/* Send modification data to new owner */
@ -3173,7 +3173,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
if (NULL == (mem_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator")
if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0)
if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
@ -3188,7 +3188,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
if(NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file iterator")
if(H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size) < 0)
if(H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
file_iter_init = TRUE;
@ -3198,13 +3198,13 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
if(!H5D__gather_mem(chunk_entry->buf, chunk_info->fspace, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
if(!H5D__gather_mem(chunk_entry->buf, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer")
if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
if(H5D__scatter_mem(tmp_gath_buf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer")
break;
@ -3217,7 +3217,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
/* Gather modification data from the application write buffer into a temporary buffer */
if(0 == H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
if(0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't gather from write buffer")
if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
@ -3225,7 +3225,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
mem_iter_init = FALSE;
/* Initialize iterator for file selection */
if(H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size) < 0)
if(H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
mem_iter_init = TRUE;
@ -3235,7 +3235,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
/* Scatter the owner's modification data into the chunk data buffer according to
* the file space.
*/
if(H5D__scatter_mem(tmp_gath_buf, chunk_info->fspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to chunk data buffer")
if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
@ -3257,7 +3257,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
if(NULL == (dataspace = H5S_decode(&mod_data_p)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, FAIL, "unable to decode dataspace")
if(H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size) < 0)
if(H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
@ -3265,7 +3265,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
/* Update the chunk data with the received modification data */
if(H5D__scatter_mem(mod_data_p, dataspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
if(H5D__scatter_mem(mod_data_p, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't scatter to write buffer")
if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)

View File

@ -594,10 +594,10 @@ H5_DLL herr_t H5D__select_write(const H5D_io_info_t *io_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
/* Functions that perform scatter-gather serial I/O operations */
H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, const H5S_t *space,
H5S_sel_iter_t *iter, size_t nelmts, void *_buf);
H5_DLL size_t H5D__gather_mem(const void *_buf, const H5S_t *space,
H5S_sel_iter_t *iter, size_t nelmts, void *_tgath_buf/*out*/);
H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter,
size_t nelmts, void *_buf);
H5_DLL size_t H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter,
size_t nelmts, void *_tgath_buf/*out*/);
H5_DLL herr_t H5D__scatgath_read(const H5D_io_info_t *io_info,
const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);

View File

@ -44,13 +44,11 @@
/* Local Prototypes */
/********************/
static herr_t H5D__scatter_file(const H5D_io_info_t *io_info,
const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts,
const void *buf);
H5S_sel_iter_t *file_iter, size_t nelmts, const void *buf);
static size_t H5D__gather_file(const H5D_io_info_t *io_info,
const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts,
void *buf);
static herr_t H5D__compound_opt_read(size_t nelmts, const H5S_t *mem_space,
H5S_sel_iter_t *iter, const H5D_type_info_t *type_info, void *user_buf/*out*/);
H5S_sel_iter_t *file_iter, size_t nelmts, void *buf);
static herr_t H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
const H5D_type_info_t *type_info, void *user_buf/*out*/);
static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info);
@ -91,9 +89,8 @@ H5FL_SEQ_EXTERN(hsize_t);
*-------------------------------------------------------------------------
*/
static herr_t
H5D__scatter_file(const H5D_io_info_t *_io_info,
const H5S_t *space, H5S_sel_iter_t *iter, size_t nelmts,
const void *_buf)
H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
size_t nelmts, const void *_buf)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
hsize_t *off = NULL; /* Pointer to sequence offsets */
@ -112,7 +109,6 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
/* Check args */
HDassert(_io_info);
HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(_buf);
@ -139,7 +135,7 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Reset the current sequence information */
@ -192,9 +188,8 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
H5D__gather_file(const H5D_io_info_t *_io_info,
const H5S_t *space, H5S_sel_iter_t *iter, size_t nelmts,
void *_buf/*out*/)
H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
size_t nelmts, void *_buf/*out*/)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
hsize_t *off = NULL; /* Pointer to sequence offsets */
@ -215,7 +210,6 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
HDassert(_io_info);
HDassert(_io_info->dset);
HDassert(_io_info->store);
HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(_buf);
@ -242,7 +236,7 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
/* Loop until all elements are read */
while(nelmts > 0) {
/* Get list of sequences for selection to read */
if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Reset the current sequence information */
@ -289,8 +283,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
H5S_sel_iter_t *iter, size_t nelmts, void *_buf/*out*/)
H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts,
void *_buf/*out*/)
{
uint8_t *buf = (uint8_t *)_buf; /* Get local copies for address arithmetic */
const uint8_t *tscat_buf = (const uint8_t *)_tscat_buf;
@ -308,7 +302,6 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
/* Check args */
HDassert(tscat_buf);
HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(buf);
@ -330,7 +323,7 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@ -377,8 +370,8 @@ done:
*-------------------------------------------------------------------------
*/
size_t
H5D__gather_mem(const void *_buf, const H5S_t *space,
H5S_sel_iter_t *iter, size_t nelmts, void *_tgath_buf/*out*/)
H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts,
void *_tgath_buf/*out*/)
{
const uint8_t *buf = (const uint8_t *)_buf; /* Get local copies for address arithmetic */
uint8_t *tgath_buf = (uint8_t *)_tgath_buf;
@ -396,7 +389,6 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
/* Check args */
HDassert(buf);
HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(tgath_buf);
@ -418,7 +410,7 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@ -496,13 +488,13 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Figure out the strip mine size. */
if(H5S_select_iter_init(file_iter, file_space, type_info->src_type_size) < 0)
if(H5S_select_iter_init(file_iter, file_space, type_info->src_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init = TRUE; /*file selection iteration info has been initialized */
if(H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size) < 0)
if(H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE; /*file selection iteration info has been initialized */
if(H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size) < 0)
if(H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
@ -523,7 +515,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/*
* Gather data
*/
n = H5D__gather_file(io_info, file_space, file_iter, smine_nelmts, type_info->tconv_buf/*out*/);
n = H5D__gather_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
@ -532,12 +524,12 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* bypass the rest of steps.
*/
if(type_info->cmpd_subset && H5T_SUBSET_FALSE != type_info->cmpd_subset->subset) {
if(H5D__compound_opt_read(smine_nelmts, mem_space, mem_iter, type_info, buf /*out*/) < 0)
if(H5D__compound_opt_read(smine_nelmts, mem_iter, type_info, buf /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed")
} /* end if */
else {
if(H5T_BKG_YES == type_info->need_bkg) {
n = H5D__gather_mem(buf, mem_space, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
@ -563,7 +555,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
}
/* Scatter the data into memory */
if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0)
if(H5D__scatter_mem(type_info->tconv_buf, mem_iter, smine_nelmts, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
} /* end for */
@ -636,13 +628,13 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Figure out the strip mine size. */
if(H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size) < 0)
if(H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init = TRUE; /*file selection iteration info has been initialized */
if(H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size) < 0)
if(H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE; /*file selection iteration info has been initialized */
if(H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size) < 0)
if(H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
@ -659,7 +651,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
* buffer. Also gather data from the file into the background buffer
* if necessary.
*/
n = H5D__gather_mem(buf, mem_space, mem_iter, smine_nelmts, type_info->tconv_buf/*out*/);
n = H5D__gather_mem(buf, mem_iter, smine_nelmts, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
@ -676,7 +668,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
} /* end if */
else {
if(H5T_BKG_YES == type_info->need_bkg) {
n = H5D__gather_file(io_info, file_space, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
n = H5D__gather_file(io_info, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
} /* end if */
@ -706,7 +698,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
/*
* Scatter the data out to the file.
*/
if(H5D__scatter_file(io_info, file_space, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
if(H5D__scatter_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
@ -762,7 +754,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5D__compound_opt_read(size_t nelmts, const H5S_t *space, H5S_sel_iter_t *iter,
H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
const H5D_type_info_t *type_info, void *user_buf/*out*/)
{
uint8_t *ubuf = (uint8_t *)user_buf; /* Cast for pointer arithmetic */
@ -778,7 +770,6 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space, H5S_sel_iter_t *iter,
/* Check args */
HDassert(nelmts > 0);
HDassert(space);
HDassert(iter);
HDassert(type_info);
HDassert(type_info->cmpd_subset);
@ -815,7 +806,7 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space, H5S_sel_iter_t *iter,
size_t elmtno; /* Element counter */
/* Get list of sequences for selection to write */
if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@ -982,7 +973,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize selection iterator */
if(H5S_select_iter_init(iter, dst_space, type_size) < 0)
if(H5S_select_iter_init(iter, dst_space, type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
@ -1006,7 +997,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection")
/* Scatter data */
if(H5D__scatter_mem(src_buf, dst_space, iter, nelmts_scatter, dst_buf) < 0)
if(H5D__scatter_mem(src_buf, iter, nelmts_scatter, dst_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
nelmts -= (hssize_t)nelmts_scatter;
@ -1092,14 +1083,14 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize selection iterator */
if(H5S_select_iter_init(iter, src_space, type_size) < 0)
if(H5S_select_iter_init(iter, src_space, type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
/* Loop until all data has been scattered */
while(nelmts > 0) {
/* Gather data */
if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, src_space, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed")
HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));

View File

@ -175,12 +175,12 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Initialize file iterator */
if(H5S_select_iter_init(file_iter, file_space, elmt_size) < 0)
if(H5S_select_iter_init(file_iter, file_space, elmt_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
file_iter_init = 1; /* File selection iteration info has been initialized */
/* Initialize memory iterator */
if(H5S_select_iter_init(mem_iter, mem_space, elmt_size) < 0)
if(H5S_select_iter_init(mem_iter, mem_space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
mem_iter_init = 1; /* Memory selection iteration info has been initialized */
@ -193,7 +193,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Check if more file sequences are needed */
if(curr_file_seq >= file_nseq) {
/* Get sequences for file selection */
if(H5S_SELECT_GET_SEQ_LIST(file_space, H5S_GET_SEQ_LIST_SORTED, file_iter, vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(file_iter, vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@ -203,7 +203,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Check if more memory sequences are needed */
if(curr_mem_seq >= mem_nseq) {
/* Get sequences for memory selection */
if(H5S_SELECT_GET_SEQ_LIST(mem_space, 0, mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */

View File

@ -3035,7 +3035,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
/* Discard the identifier & replace the dataset */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj)))
if(NULL == (*dset = (H5D_t *)H5VL_object_unwrap(vol_obj)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object")
vol_obj->data = NULL;

View File

@ -715,7 +715,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
(0==file->nmembs ? flags : t_flags), file->memb_fapl_id, HADDR_UNDEF);
} H5E_END_TRY;
if (!file->memb[file->nmembs]) {
if (0==file->nmembs)
if (0 == file->nmembs)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file")
H5E_clear_stack(NULL);
break;
@ -723,7 +723,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
file->nmembs++;
}
/* If the file is reopened and there's only one member file existing, this file maybe
/* If the file is reopened and there's only one member file existing, this file may be
* smaller than the size specified through H5Pset_fapl_family(). Update the actual
* member size.
*/

View File

@ -981,8 +981,7 @@ H5FD_multi_fapl_free(void *_fa)
*-------------------------------------------------------------------------
*/
static H5FD_t *
H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
H5FD_multi_t *file=NULL;
hid_t close_fapl=-1;
@ -996,7 +995,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
/* Check arguments */
if (!name || !*name)
H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL)
if (0==maxaddr || HADDR_UNDEF==maxaddr)
if (0 == maxaddr || HADDR_UNDEF == maxaddr)
H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL)
/*
@ -1007,41 +1006,41 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
*/
if(NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t))))
H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
if(H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) {
if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id)) {
close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE)<0)
if(H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error)
}
fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
assert(fa);
ALL_MEMBERS(mt) {
file->fa.memb_map[mt] = fa->memb_map[mt];
file->fa.memb_addr[mt] = fa->memb_addr[mt];
if (fa->memb_fapl[mt]>=0)
H5Iinc_ref(fa->memb_fapl[mt]);
file->fa.memb_map[mt] = fa->memb_map[mt];
file->fa.memb_addr[mt] = fa->memb_addr[mt];
if (fa->memb_fapl[mt] >= 0)
H5Iinc_ref(fa->memb_fapl[mt]);
file->fa.memb_fapl[mt] = fa->memb_fapl[mt];
if (fa->memb_name[mt])
file->fa.memb_name[mt] = my_strdup(fa->memb_name[mt]);
else
file->fa.memb_name[mt] = NULL;
if (fa->memb_name[mt])
file->fa.memb_name[mt] = my_strdup(fa->memb_name[mt]);
else
file->fa.memb_name[mt] = NULL;
} END_MEMBERS;
file->fa.relax = fa->relax;
file->flags = flags;
file->name = my_strdup(name);
if (close_fapl>=0)
if(H5Pclose(close_fapl)<0)
if (close_fapl >= 0)
if(H5Pclose(close_fapl) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", error)
/* Compute derived properties and open member files */
if (compute_next(file)<0)
if (compute_next(file) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", error);
if (open_members(file)<0)
if (open_members(file) < 0)
H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", error);
/* We must have opened at least the superblock file */
if (H5FD_MEM_DEFAULT==(m=file->fa.memb_map[H5FD_MEM_SUPER]))
if (H5FD_MEM_DEFAULT == (m = file->fa.memb_map[H5FD_MEM_SUPER]))
m = H5FD_MEM_SUPER;
if (NULL==file->memb[m])
if (NULL == file->memb[m])
goto error;
return (H5FD_t*)file;
@ -1049,13 +1048,14 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
error:
/* Cleanup and fail */
if (file) {
ALL_MEMBERS(mt) {
if (file->memb[mt]) (void)H5FDclose(file->memb[mt]);
if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]);
if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]);
} END_MEMBERS;
if (file->name) free(file->name);
free(file);
ALL_MEMBERS(mt) {
if (file->memb[mt]) (void)H5FDclose(file->memb[mt]);
if (file->fa.memb_fapl[mt] >= 0) (void)H5Idec_ref(file->fa.memb_fapl[mt]);
if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]);
} END_MEMBERS;
if (file->name)
free(file->name);
free(file);
}
return NULL;
}

View File

@ -853,7 +853,7 @@ htri_t
H5F__is_hdf5(const char *name, hid_t fapl_id)
{
H5FD_t *file = NULL; /* Low-level file struct */
haddr_t sig_addr; /* Addess of hdf5 file signature */
haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE

View File

@ -320,7 +320,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
void *grp = NULL; /* Structure for new group */
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@ -350,12 +349,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the gcpl structure and set the link properties on it */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id")
/* Get the location object */
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
@ -365,7 +358,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the group */
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, lcpl_id, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
@ -444,7 +437,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */

View File

@ -172,7 +172,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
void *grp = NULL; /* New group created */
H5VL_object_t *vol_obj; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
hid_t ret_value = H5I_INVALID_HID; /* Return value */
@ -217,14 +216,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(tmp_gcpl)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
/* get creation properties */
if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
@ -234,7 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the group */
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, lcpl_id, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
@ -323,7 +314,6 @@ herr_t
H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name)
{
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -339,10 +329,6 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Create link */
if(type == H5L_TYPE_HARD) {
H5VL_object_t *vol_obj; /* Object token of loc_id */
@ -363,18 +349,12 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj->data) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target")
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params")
/* Construct a temporary VOL object */
tmp_vol_obj.data = NULL;
tmp_vol_obj.connector = vol_obj->connector;
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, loc_params1) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
@ -390,12 +370,8 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@ -419,7 +395,6 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
hid_t new_loc_id, const char *new_name)
{
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -435,10 +410,6 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(H5CX_set_loc(cur_loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
H5VL_object_t *vol_obj1; /* Object token of loc_id */
@ -462,14 +433,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, loc_params1) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if(type == H5L_TYPE_SOFT) {
@ -490,12 +455,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else

View File

@ -1134,7 +1134,7 @@ done:
*
*-------------------------------------------------------------------------
*/
void *
static void *
H5I__remove_verify(hid_t id, H5I_type_t id_type)
{
void * ret_value = NULL; /*return value */
@ -1943,6 +1943,8 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata)
ret_value = H5_ITER_STOP; /* terminate iteration early */
else if(cb_ret_val < 0)
ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
else
ret_value = H5_ITER_CONT; /* continue iteration */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I__iterate_pub_cb() */

View File

@ -449,7 +449,6 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
{
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -483,20 +482,12 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &link_target) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Create the link */
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, link_target) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
@ -529,7 +520,6 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
H5VL_object_t tmp_vol_obj; /* Temporary object token of */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -583,22 +573,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
/* Get the link creation plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_LINK, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TARGET, (vol_obj1 ? &(vol_obj1->data) : NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target id")
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name")
/* Construct a temporary VOL object */
tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL);
tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
/* Create the link */
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (vol_obj1 ? vol_obj1->data : NULL), loc_params1) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
@ -636,7 +616,6 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
{
H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */
H5VL_loc_params_t loc_params;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -668,20 +647,8 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
/* Create external link */
if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, udata, udata_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:

View File

@ -349,7 +349,6 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
size_t file_name_len; /* Length of file name string */
size_t norm_obj_name_len; /* Length of normalized object name string */
uint8_t *p; /* Pointer into external link buffer */
H5P_genplist_t *plist; /* Property list pointer */
H5L_type_t link_type = H5L_TYPE_EXTERNAL;
herr_t ret_value = SUCCEED; /* Return value */
@ -400,20 +399,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &ext_link_buf) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &buf_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
/* Create an external link */
if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, ext_link_buf, buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link")
done:

View File

@ -314,7 +314,6 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
H5VL_object_t tmp_vol_obj; /* Temporary object token of */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@ -363,22 +362,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked")
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* set creation properties */
if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id")
/* Construct a temporary VOL object */
tmp_vol_obj.data = vol_obj2->data;
tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
/* Create a link to the object */
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, loc_params1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:

View File

@ -40,10 +40,6 @@
/* Local Macros */
/****************/
/* Definitions for locations parameters */
#define H5A_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t)
#define H5A_CRT_LOCATION_DEF H5I_BADID
/******************/
/* Local Typedefs */
@ -59,9 +55,6 @@
/* Local Prototypes */
/********************/
/* Property class callbacks */
static herr_t H5P_acrt_reg_prop(H5P_genclass_t *pclass);
/*********************/
/* Package Variables */
@ -76,7 +69,7 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{
&H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */
&H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */
&H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */
H5P_acrt_reg_prop, /* Default property registration routine */
NULL, /* Default property registration routine */
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
@ -91,44 +84,3 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{
/* Library Private Variables */
/*****************************/
/*-------------------------------------------------------------------------
* Function: H5P_acrt_reg_prop
*
* Purpose: Register the attribute creation property list class's properties
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
static herr_t
H5P_acrt_reg_prop(H5P_genclass_t *pclass)
{
hid_t type_id = H5I_INVALID_HID;
hid_t space_id = H5I_INVALID_HID;
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
/* Register the type ID property*/
if(H5P__register_real(pclass, H5VL_PROP_ATTR_TYPE_ID, sizeof(hid_t), &type_id,
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 space ID property */
if(H5P__register_real(pclass, H5VL_PROP_ATTR_SPACE_ID, sizeof(hid_t), &space_id,
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 lcpl ID property */
HDmemset(&loc_params, 0, sizeof(H5VL_loc_params_t));
loc_params.obj_type = H5A_CRT_LOCATION_DEF;
if(H5P__register_real(pclass, H5VL_PROP_ATTR_LOC_PARAMS, H5A_CRT_LOCATION_SIZE, &loc_params,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_acrt_reg_prop() */

View File

@ -246,9 +246,6 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE;
static herr_t
H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
{
hid_t type_id = H5I_INVALID_HID;
hid_t space_id = H5I_INVALID_HID;
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@ -283,21 +280,6 @@ H5P__dcrt_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 type ID property*/
if(H5P__register_real(pclass, H5VL_PROP_DSET_TYPE_ID, sizeof(hid_t), &type_id,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the space ID property */
if(H5P__register_real(pclass, H5VL_PROP_DSET_SPACE_ID, sizeof(hid_t), &space_id,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the lcpl ID property */
if(H5P__register_real(pclass, H5VL_PROP_DSET_LCPL_ID, sizeof(hid_t), &lcpl_id,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_reg_prop() */

View File

@ -36,6 +36,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5Iprivate.h" /* IDs */

View File

@ -128,7 +128,6 @@ static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Defaul
static herr_t
H5P__gcrt_reg_prop(H5P_genclass_t *pclass)
{
hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@ -145,11 +144,6 @@ H5P__gcrt_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 lcpl ID property */
if(H5P__register_real(pclass, H5VL_PROP_GRP_LCPL_ID, sizeof(hid_t), &lcpl_id,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__gcrt_reg_prop() */

View File

@ -48,30 +48,6 @@
#define H5L_CRT_INTERMEDIATE_GROUP_ENC H5P__encode_unsigned
#define H5L_CRT_INTERMEDIATE_GROUP_DEC H5P__decode_unsigned
/* ======== VOL specific properties ========= */
/* Definitions for target object ID */
#define H5L_CRT_TARGET_SIZE sizeof(void *)
#define H5L_CRT_TARGET_DEF NULL
/* Definitions for Location params */
#define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t)
#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {{HADDR_UNDEF}}}
/* Definitions for target object NAME */
#define H5L_CRT_TARGET_NAME_SIZE sizeof(char *)
#define H5L_CRT_TARGET_NAME_DEF NULL
/* Definitions for link type */
#define H5L_CRT_LINK_TYPE_SIZE sizeof(link_type)
#define H5L_CRT_LINK_TYPE_DEF H5L_TYPE_ERROR
/* Definitions for UDATA */
#define H5L_CRT_UDATA_SIZE sizeof(void *)
#define H5L_CRT_UDATA_DEF NULL
/* Definitions for UDATA_SIZE */
#define H5L_CRT_UDATA_SIZE_SIZE sizeof(size_t)
#define H5L_CRT_UDATA_SIZE_DEF 0
/******************/
/* Local Typedefs */
@ -143,12 +119,6 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF;
herr_t
H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
{
void* target = H5L_CRT_TARGET_DEF;
H5VL_loc_params_t loc_params = H5L_CRT_LOCATION_DEF;
char *target_name = H5L_CRT_TARGET_NAME_DEF;
H5L_type_t link_type = H5L_CRT_LINK_TYPE_DEF;
void *udata = H5L_CRT_UDATA_DEF;
size_t udata_size = H5L_CRT_UDATA_SIZE_DEF;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@ -159,30 +129,6 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET, H5L_CRT_TARGET_SIZE, &target,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_LOC_PARAMS, H5L_CRT_LOCATION_SIZE, &loc_params,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_NAME, H5L_CRT_TARGET_NAME_SIZE, &target_name,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P__register_real(pclass, H5VL_PROP_LINK_TYPE, H5L_CRT_LINK_TYPE_SIZE, &link_type,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA, H5L_CRT_UDATA_SIZE, &udata,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA_SIZE, H5L_CRT_UDATA_SIZE_SIZE, &udata_size,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_lcrt_reg_prop() */

View File

@ -23,6 +23,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gprivate.h" /* Groups */

View File

@ -51,9 +51,6 @@
/* Selection callbacks */
static herr_t H5S__all_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
static herr_t H5S__all_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__all_release(H5S_t *space);
static htri_t H5S__all_is_valid(const H5S_t *space);
static hssize_t H5S__all_serial_size(const H5S_t *space);
@ -65,10 +62,11 @@ static int H5S__all_unlim_dim(const H5S_t *space);
static htri_t H5S__all_is_contiguous(const H5S_t *space);
static htri_t H5S__all_is_single(const H5S_t *space);
static htri_t H5S__all_is_regular(const H5S_t *space);
static htri_t H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2);
static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
static herr_t H5S__all_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
static herr_t H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@ -77,6 +75,8 @@ static hsize_t H5S__all_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S__all_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S__all_iter_next_block(H5S_sel_iter_t *sel_iter);
static herr_t H5S__all_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__all_iter_release(H5S_sel_iter_t *sel_iter);
@ -95,7 +95,6 @@ const H5S_select_class_t H5S_sel_all[1] = {{
/* Methods on selection */
H5S__all_copy,
H5S__all_get_seq_list,
H5S__all_release,
H5S__all_is_valid,
H5S__all_serial_size,
@ -108,6 +107,7 @@ const H5S_select_class_t H5S_sel_all[1] = {{
H5S__all_is_contiguous,
H5S__all_is_single,
H5S__all_is_regular,
H5S__all_shape_same,
H5S__all_adjust_u,
H5S__all_project_scalar,
H5S__all_project_simple,
@ -130,6 +130,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
H5S__all_iter_has_next_block,
H5S__all_iter_next,
H5S__all_iter_next_block,
H5S__all_iter_get_seq_list,
H5S__all_iter_release,
}};
@ -148,7 +149,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
H5S__all_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
{
FUNC_ENTER_STATIC_NOERR
@ -156,9 +157,6 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
HDassert(space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
/* Initialize the number of elements to iterate over */
iter->elmt_left = H5S_GET_SELECT_NPOINTS(space);
/* Start at the upper left location */
iter->u.all.elmt_offset = 0;
iter->u.all.byte_offset = 0;
@ -361,13 +359,11 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
/*--------------------------------------------------------------------------
NAME
H5S__all_get_seq_list
H5S__all_iter_get_seq_list
PURPOSE
Create a list of offsets & lengths for a selection
USAGE
herr_t H5S__all_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_t *space; IN: Dataspace containing selection to use.
unsigned flags; IN: Flags for extra information about operation
herr_t H5S__all_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
position of interest in selection.
size_t maxseq; IN: Maximum number of sequences to generate
@ -391,16 +387,14 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S__all_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t *iter,
size_t H5_ATTR_UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
H5S__all_iter_get_seq_list(H5S_sel_iter_t *iter, size_t H5_ATTR_UNUSED maxseq,
size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
{
size_t elem_used; /* The number of elements used */
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
HDassert(iter);
HDassert(maxseq > 0);
HDassert(maxelem > 0);
@ -430,7 +424,7 @@ H5S__all_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED
iter->u.all.byte_offset += len[0];
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__all_get_seq_list() */
} /* end H5S__all_iter_get_seq_list() */
/*--------------------------------------------------------------------------
@ -915,6 +909,70 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
FUNC_LEAVE_NOAPI(TRUE)
} /* end H5S__all_is_regular() */
/*--------------------------------------------------------------------------
NAME
H5S__all_shape_same
PURPOSE
Check if a two "all" selections are the same shape
USAGE
htri_t H5S__all_shape_same(space1, space2)
const H5S_t *space1; IN: First dataspace to check
const H5S_t *space2; IN: Second dataspace to check
RETURNS
TRUE / FALSE / FAIL
DESCRIPTION
Checks to see if the current selection in each dataspace are the same
shape.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2)
{
int space1_dim; /* Current dimension in first dataspace */
int space2_dim; /* Current dimension in second dataspace */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space1);
HDassert(space2);
/* Initialize dataspace dims */
space1_dim = (int)space1->extent.rank - 1;
space2_dim = (int)space2->extent.rank - 1;
/* Recall that space1_rank >= space2_rank.
*
* In the following while loop, we test to see if space1 and space2
* have identical size in all dimensions they have in common.
*/
while(space2_dim >= 0) {
if(space1->extent.size[space1_dim] != space2->extent.size[space2_dim])
HGOTO_DONE(FALSE)
space1_dim--;
space2_dim--;
} /* end while */
/* Since we are selecting the entire space, we must also verify that space1
* has size 1 in all dimensions that it does not share with space2.
*/
while(space1_dim >= 0) {
if(space1->extent.size[space1_dim] != 1)
HGOTO_DONE(FALSE)
space1_dim--;
} /* end while */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__all_shape_same() */
/*--------------------------------------------------------------------------
NAME

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MMprivate.h" /* Memory management */
#include "H5Spkg.h" /* Dataspaces */
#include "H5VMprivate.h" /* Vector and array functions */
@ -51,6 +52,18 @@
/* Local Typedefs */
/******************/
/* Node in linked list of MPI data types created during traversal of irregular hyperslab selection */
typedef struct H5S_mpio_mpitype_node_t {
MPI_Datatype type; /* MPI Datatype */
struct H5S_mpio_mpitype_node_t *next; /* Pointer to next node in list */
} H5S_mpio_mpitype_node_t;
/* List to track MPI data types generated during traversal of irregular hyperslab selection */
typedef struct H5S_mpio_mpitype_list_t {
H5S_mpio_mpitype_node_t *head; /* Pointer to head of list */
H5S_mpio_mpitype_node_t *tail; /* Pointer to tail of list */
} H5S_mpio_mpitype_list_t;
/********************/
/* Local Prototypes */
@ -71,9 +84,12 @@ static herr_t H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
static herr_t H5S__obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span,
const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size);
static herr_t H5S__mpio_create_large_type(hsize_t, MPI_Aint, MPI_Datatype , MPI_Datatype *);
static herr_t H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list);
static herr_t H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen);
static herr_t H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
MPI_Datatype old_type, MPI_Datatype *new_type);
/*****************************/
@ -91,6 +107,8 @@ static herr_t H5S__mpio_create_large_type(hsize_t, MPI_Aint, MPI_Datatype , MPI_
/*******************/
static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
/* Declare a free list to manage the H5S_mpio_mpitype_node_t struct */
H5FL_DEFINE_STATIC(H5S_mpio_mpitype_node_t);
@ -542,7 +560,7 @@ H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
/* Initialize selection iterator */
if(H5S_select_iter_init(&sel_iter, space, elmt_size) < 0)
if(H5S_select_iter_init(&sel_iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
sel_iter_init = TRUE; /* Selection iteration info has been initialized */
@ -559,7 +577,7 @@ H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
size_t curr_seq; /* Current sequence being worked on */
/* Get the sequences of bytes */
if(H5S_SELECT_GET_SEQ_LIST(space, 0, &sel_iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(&sel_iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop, while sequences left to process */
@ -679,7 +697,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size,
HDassert(sizeof(MPI_Aint) >= sizeof(elmt_size));
/* Initialize selection iterator */
if(H5S_select_iter_init(&sel_iter, space, elmt_size) < 0)
if(H5S_select_iter_init(&sel_iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
sel_iter_init = TRUE; /* Selection iteration info has been initialized */
@ -979,10 +997,12 @@ static herr_t
H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
H5S_mpio_mpitype_list_t type_list; /* List to track MPI data types created */
MPI_Datatype elmt_type; /* MPI datatype for an element */
hbool_t elmt_type_is_derived = FALSE; /* Whether the element type has been created */
MPI_Datatype span_type; /* MPI datatype for overall span tree */
hsize_t down[H5S_MAX_RANK]; /* 'down' sizes for each dimension */
uint64_t op_gen; /* Operation generation value */
int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED; /* Return value */
@ -1008,12 +1028,21 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
if(H5VM_array_down(space->extent.rank, space->extent.size, down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes")
/* Obtain derived data type */
if(H5S__obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0)
/* Acquire an operation generation value for creating MPI datatypes */
op_gen = H5S__hyper_get_op_gen();
/* Obtain derived MPI data type */
type_list.head = type_list.tail = NULL;
if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&span_type)))
if(MPI_SUCCESS != (mpi_code = MPI_Type_dup(span_type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
*new_type = span_type;
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
/* Release MPI data types generated during span tree traversal */
if(H5S__release_datatype(&type_list) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "couldn't release MPI derived data type")
/* fill in the remaining return values */
*count = 1;
@ -1028,6 +1057,53 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__mpio_span_hyper_type() */
/*-------------------------------------------------------------------------
* Function: H5S__release_datatype
*
* Purpose: Release the MPI derived datatypes for span-tree hyperslab selection
*
* Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol, February 2, 2019
*
*-------------------------------------------------------------------------
*/
static herr_t
H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list)
{
H5S_mpio_mpitype_node_t *curr; /* Pointer to head of list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(type_list);
/* Iterate over the list, freeing the MPI data types */
curr = type_list->head;
while(curr) {
H5S_mpio_mpitype_node_t *next; /* Pointer to next node in list */
int mpi_code; /* MPI return status code */
/* Release the MPI data type for this span tree */
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&curr->type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
/* Get pointer to next node in list */
next = curr->next;
/* Free the current node */
curr = H5FL_FREE(H5S_mpio_mpitype_node_t, curr);
/* Advance to next node */
curr = next;
} /* end while */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__release_datatype() */
/*-------------------------------------------------------------------------
* Function: H5S__obtain_datatype
@ -1043,206 +1119,219 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
H5S__obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size)
H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span to iterate with */
size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */
size_t outercount; /* Number of span tree nodes at this level */
MPI_Datatype *inner_type = NULL;
hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */
hbool_t span_type_valid = FALSE; /* Whether the span_type MPI datatypes is valid */
hbool_t large_block = FALSE; /* Wether the block length is larger than 32 bit integer */
int *blocklen = NULL;
MPI_Aint *disp = NULL;
H5S_hyper_span_t *tspan = NULL; /* Temporary pointer to span tree node */
size_t u; /* Local index variable */
int mpi_code; /* MPI return status code */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(span);
HDassert(spans);
HDassert(type_list);
/* Allocate the initial displacement & block length buffers */
alloc_count = H5S_MPIO_INITIAL_ALLOC_COUNT;
if(NULL == (disp = (MPI_Aint *)H5MM_malloc(alloc_count * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
if(NULL == (blocklen = (int *)H5MM_malloc(alloc_count * sizeof(int))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
/* Check if we've visited this span tree before */
if(spans->op_gen != op_gen) {
H5S_mpio_mpitype_node_t *type_node; /* Pointer to new node in MPI data type list */
/* if this is the fastest changing dimension, it is the base case for derived datatype. */
if(NULL == span->down) {
tspan = span;
outercount = 0;
while(tspan) {
/* Check if we need to increase the size of the buffers */
if(outercount >= alloc_count) {
MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
int *tmp_blocklen; /* Temporary pointer to new block length buffer */
/* Allocate the initial displacement & block length buffers */
alloc_count = H5S_MPIO_INITIAL_ALLOC_COUNT;
if(NULL == (disp = (MPI_Aint *)H5MM_malloc(alloc_count * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
if(NULL == (blocklen = (int *)H5MM_malloc(alloc_count * sizeof(int))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
/* Double the allocation count */
alloc_count *= 2;
/* If this is the fastest changing dimension, it is the base case for derived datatype. */
span = spans->head;
if(NULL == span->down) {
hbool_t large_block = FALSE; /* Wether the block length is larger than 32 bit integer */
/* Re-allocate the buffers */
if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
disp = tmp_disp;
if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
blocklen = tmp_blocklen;
outercount = 0;
while(span) {
hsize_t nelmts; /* # of elements covered by current span */
/* Check if we need to increase the size of the buffers */
if(outercount >= alloc_count) {
MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
int *tmp_blocklen; /* Temporary pointer to new block length buffer */
/* Double the allocation count */
alloc_count *= 2;
/* Re-allocate the buffers */
if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
disp = tmp_disp;
if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
blocklen = tmp_blocklen;
} /* end if */
/* Compute the number of elements to attempt in this span */
nelmts = (span->high - span->low) + 1;
/* Store displacement & block length */
disp[outercount] = (MPI_Aint)elmt_size * span->low;
H5_CHECK_OVERFLOW(nelmts, hsize_t, int)
blocklen[outercount] = (int)nelmts;
if(bigio_count < blocklen[outercount])
large_block = TRUE; /* at least one block type is large, so set this flag to true */
span = span->next;
outercount++;
} /* end while */
/* Everything fits into integers, so cast them and use hindexed */
if(bigio_count >= outercount && large_block == FALSE) {
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
} /* end if */
else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
for(u = 0 ; u < outercount; u++) {
MPI_Datatype temp_type = MPI_DATATYPE_NULL;
/* Store displacement & block length */
disp[outercount] = (MPI_Aint)elmt_size * tspan->low;
H5_CHECK_OVERFLOW(tspan->nelem, hsize_t, int)
blocklen[outercount] = (int)tspan->nelem;
tspan = tspan->next;
/* create the block type from elmt_type while checking the 32 bit int limit */
if(blocklen[u] > bigio_count) {
if(H5S__mpio_create_large_type(blocklen[u], 0, *elmt_type, &temp_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
} /* end if */
else
if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)blocklen[u], *elmt_type, &temp_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
if(bigio_count < blocklen[outercount])
large_block = TRUE; /* at least one block type is large, so set this flag to true */
/* Combine the current datatype that is created with this current block type */
if(0 == u) /* first iteration, there is no combined datatype yet */
spans->u.down_type = temp_type;
else {
int bl[2] = {1, 1};
MPI_Aint ds[2] = {disp[u - 1], disp[u]};
MPI_Datatype dt[2] = {spans->u.down_type, temp_type};
outercount++;
} /* end while */
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, /* count */
bl, /* blocklength */
ds, /* stride in bytes*/
dt, /* old type */
&spans->u.down_type))) /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Everything fits into integers, so cast them and use hindexed */
if(bigio_count >= outercount && large_block == FALSE) {
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, span_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
span_type_valid = TRUE;
}
else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
size_t i;
for (i=0 ; i<outercount ; i++) {
MPI_Datatype temp_type = MPI_DATATYPE_NULL, outer_type = MPI_DATATYPE_NULL;
/* create the block type from elmt_type while checking the 32 bit int limit */
if (blocklen[i] > bigio_count) {
if (H5S__mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0) {
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
"couldn't create a large element datatype in span_hyper selection")
}
}
else {
if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)blocklen[i],
*elmt_type,
&temp_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
}
/* combine the current datatype that is created with this current block type */
if (0 == i) { /* first iteration, there is no combined datatype yet */
*span_type = temp_type;
}
else {
int bl[2] = {1,1};
MPI_Aint ds[2] = {disp[i-1],disp[i]};
MPI_Datatype dt[2] = {*span_type, temp_type};
if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct (2, /* count */
bl, /* blocklength */
ds, /* stride in bytes*/
dt, /* old type */
&outer_type))){ /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
}
*span_type = outer_type;
}
if (outer_type != MPI_DATATYPE_NULL)
MPI_Type_free(&outer_type);
/* temp_type shouldn't be freed here...
* Note that we have simply copied it above (not MPI_Type_dup)
* into the 'span_type' argument of the caller.
* The caller needs to deal with it there!
*/
}
} /* end (LARGE_DATATYPE::) */
} /* end if */
else {
size_t u; /* Local index variable */
if(NULL == (inner_type = (MPI_Datatype *)H5MM_malloc(alloc_count * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
tspan = span;
outercount = 0;
while(tspan) {
MPI_Datatype down_type; /* Temporary MPI datatype for a span tree node's children */
/* Release previous temporary datatype */
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&temp_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
} /* end else */
} /* end for */
} /* end else (LARGE_DATATYPE::) */
} /* end if */
else {
MPI_Aint stride; /* Distance between inner MPI datatypes */
/* Check if we need to increase the size of the buffers */
if(outercount >= alloc_count) {
MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
int *tmp_blocklen; /* Temporary pointer to new block length buffer */
MPI_Datatype *tmp_inner_type; /* Temporary pointer to inner MPI datatype buffer */
if(NULL == (inner_type = (MPI_Datatype *)H5MM_malloc(alloc_count * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
/* Double the allocation count */
alloc_count *= 2;
/* Re-allocate the buffers */
if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
disp = tmp_disp;
if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
blocklen = tmp_blocklen;
if(NULL == (tmp_inner_type = (MPI_Datatype *)H5MM_realloc(inner_type, alloc_count * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
inner_type = tmp_inner_type;
} /* end if */
/* Displacement should be in byte and should have dimension information */
/* First using MPI Type vector to build derived data type for this span only */
/* Need to calculate the disp in byte for this dimension. */
/* Calculate the total bytes of the lower dimension */
disp[outercount] = tspan->low * (*down) * elmt_size;
blocklen[outercount] = 1;
/* Generate MPI datatype for next dimension down */
if(H5S__obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
/* Build the MPI datatype for this node */
stride = (*down) * elmt_size;
H5_CHECK_OVERFLOW(tspan->nelem, hsize_t, int)
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)tspan->nelem, 1, stride, down_type, &inner_type[outercount]))) {
MPI_Type_free(&down_type);
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
} /* end if */
/* Release MPI datatype for next dimension down */
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
/* Loop over span nodes */
outercount = 0;
while(span) {
MPI_Datatype down_type; /* Temporary MPI datatype for a span tree node's children */
hsize_t nelmts; /* # of elements covered by current span */
tspan = tspan->next;
outercount++;
} /* end while */
/* Check if we need to increase the size of the buffers */
if(outercount >= alloc_count) {
MPI_Aint *tmp_disp; /* Temporary pointer to new displacement buffer */
int *tmp_blocklen; /* Temporary pointer to new block length buffer */
MPI_Datatype *tmp_inner_type; /* Temporary pointer to inner MPI datatype buffer */
/* building the whole vector datatype */
H5_CHECK_OVERFLOW(outercount, size_t, int)
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, span_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
span_type_valid = TRUE;
/* Double the allocation count */
alloc_count *= 2;
/* Release inner node types */
for(u = 0; u < outercount; u++)
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[u])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
inner_types_freed = TRUE;
/* Re-allocate the buffers */
if(NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
disp = tmp_disp;
if(NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
blocklen = tmp_blocklen;
if(NULL == (tmp_inner_type = (MPI_Datatype *)H5MM_realloc(inner_type, alloc_count * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
inner_type = tmp_inner_type;
} /* end if */
/* Displacement should be in byte and should have dimension information */
/* First using MPI Type vector to build derived data type for this span only */
/* Need to calculate the disp in byte for this dimension. */
disp[outercount] = span->low * stride;
blocklen[outercount] = 1;
/* Generate MPI datatype for next dimension down */
if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
/* Compute the number of elements to attempt in this span */
nelmts = (span->high - span->low) + 1;
/* Build the MPI datatype for this node */
H5_CHECK_OVERFLOW(nelmts, hsize_t, int)
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)nelmts, 1, stride, down_type, &inner_type[outercount])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
span = span->next;
outercount++;
} /* end while */
/* Building the whole vector datatype */
H5_CHECK_OVERFLOW(outercount, size_t, int)
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Release inner node types */
for(u = 0; u < outercount; u++)
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[u])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
inner_types_freed = TRUE;
} /* end else */
/* Allocate space for the MPI data type list node */
if(NULL == (type_node = H5FL_MALLOC(H5S_mpio_mpitype_node_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate MPI data type list node")
/* Set up MPI type node */
type_node->type = spans->u.down_type;
type_node->next = NULL;
/* Add MPI type node to list */
if(type_list->head == NULL)
type_list->head = type_list->tail = type_node;
else {
type_list->tail->next = type_node;
type_list->tail = type_node;
} /* end else */
/* Remember that we've visited this span tree */
spans->op_gen = op_gen;
} /* end else */
/* Return MPI data type for span tree */
*span_type = spans->u.down_type;
done:
/* General cleanup */
if(inner_type != NULL) {
if(!inner_types_freed) {
size_t u; /* Local index variable */
if(!inner_types_freed)
for(u = 0; u < outercount; u++)
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&inner_type[u])))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
} /* end if */
H5MM_free(inner_type);
} /* end if */
if(blocklen != NULL)
@ -1250,13 +1339,6 @@ done:
if(disp != NULL)
H5MM_free(disp);
/* Error cleanup */
if(ret_value < 0) {
if(span_type_valid)
if(MPI_SUCCESS != (mpi_code = MPI_Type_free(span_type)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__obtain_datatype() */

View File

@ -51,9 +51,6 @@
/* Selection callbacks */
static herr_t H5S__none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
static herr_t H5S__none_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__none_release(H5S_t *space);
static htri_t H5S__none_is_valid(const H5S_t *space);
static hssize_t H5S__none_serial_size(const H5S_t *space);
@ -65,10 +62,11 @@ static int H5S__none_unlim_dim(const H5S_t *space);
static htri_t H5S__none_is_contiguous(const H5S_t *space);
static htri_t H5S__none_is_single(const H5S_t *space);
static htri_t H5S__none_is_regular(const H5S_t *space);
static htri_t H5S__none_shape_same(const H5S_t *space1, const H5S_t *space2);
static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
static herr_t H5S__none_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
static herr_t H5S__none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@ -77,6 +75,8 @@ static hsize_t H5S__none_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S__none_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S__none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S__none_iter_next_block(H5S_sel_iter_t *sel_iter);
static herr_t H5S__none_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__none_iter_release(H5S_sel_iter_t *sel_iter);
@ -95,7 +95,6 @@ const H5S_select_class_t H5S_sel_none[1] = {{
/* Methods on selection */
H5S__none_copy,
H5S__none_get_seq_list,
H5S__none_release,
H5S__none_is_valid,
H5S__none_serial_size,
@ -108,6 +107,7 @@ const H5S_select_class_t H5S_sel_none[1] = {{
H5S__none_is_contiguous,
H5S__none_is_single,
H5S__none_is_regular,
H5S__none_shape_same,
H5S__none_adjust_u,
H5S__none_project_scalar,
H5S__none_project_simple,
@ -130,6 +130,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
H5S__none_iter_has_next_block,
H5S__none_iter_next,
H5S__none_iter_next_block,
H5S__none_iter_get_seq_list,
H5S__none_iter_release,
}};
@ -148,7 +149,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space)
H5S__none_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
{
FUNC_ENTER_STATIC_NOERR
@ -333,13 +334,11 @@ H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
/*--------------------------------------------------------------------------
NAME
H5S__none_get_seq_list
H5S__none_iter_get_seq_list
PURPOSE
Create a list of offsets & lengths for a selection
USAGE
herr_t H5S__none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_t *space; IN: Dataspace containing selection to use.
unsigned flags; IN: Flags for extra information about operation
herr_t H5S__none_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
position of interest in selection.
size_t maxseq; IN: Maximum number of sequences to generate
@ -363,14 +362,13 @@ H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S__none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem,
hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
H5S__none_iter_get_seq_list(H5S_sel_iter_t H5_ATTR_UNUSED *iter,
size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq,
size_t *nelem, hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
{
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
HDassert(iter);
HDassert(maxseq > 0);
HDassert(maxelem > 0);
@ -386,7 +384,7 @@ H5S__none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSE
*nelem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__none_get_seq_list() */
} /* end H5S__none_iter_get_seq_list() */
/*--------------------------------------------------------------------------
@ -855,7 +853,40 @@ H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
/*--------------------------------------------------------------------------
NAME
H5S_none_adjust_u
H5S__none_shape_same
PURPOSE
Check if a two "none" selections are the same shape
USAGE
htri_t H5S__none_shape_same(space1, space2)
const H5S_t *space1; IN: First dataspace to check
const H5S_t *space2; IN: Second dataspace to check
RETURNS
TRUE / FALSE / FAIL
DESCRIPTION
Checks to see if the current selection in each dataspace are the same
shape.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
H5S__none_shape_same(const H5S_t H5_ATTR_UNUSED *space1,
const H5S_t H5_ATTR_UNUSED *space2)
{
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space1);
HDassert(space2);
FUNC_LEAVE_NOAPI(TRUE)
} /* end H5S__none_shape_same() */
/*--------------------------------------------------------------------------
NAME
H5S__none_adjust_u
PURPOSE
Adjust an "none" selection by subtracting an offset
USAGE

View File

@ -111,49 +111,97 @@ struct H5S_extent_t {
/* Node in point selection list (typedef'd in H5Sprivate.h) */
struct H5S_pnt_node_t {
hsize_t *pnt; /* Pointer to a selected point */
struct H5S_pnt_node_t *next; /* pointer to next point in list */
struct H5S_pnt_node_t *next; /* Pointer to next point in list */
hsize_t pnt[]; /* Selected point */
/* (NOTE: This uses the C99 "flexible array member" feature) */
};
/* Information about point selection list */
typedef struct {
/* Information about point selection list (typedef'd in H5Sprivate.h) */
struct H5S_pnt_list_t {
/* The following two fields defines the bounding box of the whole set of points, relative to the offset */
hsize_t low_bounds[H5S_MAX_RANK]; /* The smallest element selected in each dimension */
hsize_t high_bounds[H5S_MAX_RANK]; /* The largest element selected in each dimension */
H5S_pnt_node_t *head; /* Pointer to head of point list */
} H5S_pnt_list_t;
H5S_pnt_node_t *tail; /* Pointer to tail of point list */
};
/* Information about hyperslab spans */
/* Information a particular hyperslab span (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_t {
hsize_t low, high; /* Low & high bounds of span */
hsize_t nelem; /* Number of elements in span (only needed during I/O) */
hsize_t pstride; /* Pseudo-stride from start of previous span (only used during I/O) */
struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */
struct H5S_hyper_span_t *next; /* Pointer to next span in list */
hsize_t low, high; /* Low & high bounds of elements selected for span, inclusive */
struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */
struct H5S_hyper_span_t *next; /* Pointer to next span in list */
};
/* Information about a list of hyperslab spans in one dimension */
/* Information about a list of hyperslab spans in one dimension (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_info_t {
unsigned count; /* Ref. count of number of spans which share this span */
struct H5S_hyper_span_info_t *scratch; /* Scratch pointer
* (used during copies, as mark
* during precomputes for I/O &
* to point to the last span in a
* list during single element adds)
*/
struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
unsigned count; /* Ref. count of number of spans which share this span */
/* The following two fields define the bounding box of this set of spans
* and all lower dimensions, relative to the offset.
*/
/* (NOTE: The bounds arrays are _relative_ to the depth of the span_info
* node in the span tree, so the top node in a 5-D span tree will
* use indices 0-4 in the arrays to store it's bounds information,
* but the next level down in the span tree will use indices 0-3.
* So, each level in the span tree will have the 0th index in the
* arrays correspond to the bounds in "this" dimension, even if
* it's not the highest level in the span tree.
*/
hsize_t *low_bounds; /* The smallest element selected in each dimension */
hsize_t *high_bounds; /* The largest element selected in each dimension */
/* "Operation generation" fields */
/* (Used during copies, 'adjust', 'nelem', and 'rebuild' operations) */
uint64_t op_gen; /* Generation of the scratch info */
union {
struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
hsize_t nelmts; /* # of elements */
hsize_t nblocks; /* # of blocks */
#ifdef H5_HAVE_PARALLEL
MPI_Datatype down_type; /* MPI datatype for span tree */
#endif /* H5_HAVE_PARALLEL */
}u;
struct H5S_hyper_span_t *head; /* Pointer to the first span of list of spans in the current dimension */
struct H5S_hyper_span_t *tail; /* Pointer to the last span of list of spans in the current dimension */
hsize_t bounds[]; /* Array for storing low & high bounds */
/* (NOTE: This uses the C99 "flexible array member" feature) */
};
/* Enum for diminfo_valid field in H5S_hyper_sel_t */
typedef enum {
H5S_DIMINFO_VALID_IMPOSSIBLE, /* 0: diminfo is not valid and can never be valid with the current selection */
H5S_DIMINFO_VALID_NO, /* 1: diminfo is not valid but may or may not be possible to constuct */
H5S_DIMINFO_VALID_YES /* 2: diminfo is valid */
} H5S_diminfo_valid_t;
/* Information about 'diminfo' form of hyperslab selection */
typedef struct {
hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */
H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
H5S_hyper_dim_t app_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
/* 'opt_diminfo' points to a [potentially] optimized version of the user's
* hyperslab information. 'app_diminfo' points to the actual parameters
* that the application used for setting the hyperslab selection. These
* are only used for re-gurgitating the original values used to set the
* hyperslab to the application when it queries the hyperslab selection
* information. */
/* 'opt' points to a [potentially] optimized version of the user's
* regular hyperslab information. 'app' points to the actual parameters
* that the application used for setting the hyperslab selection.
*
* The 'app' values are only used for regurgitating the original values
* used to set the hyperslab to the application when it queries the
* hyperslab selection information.
*/
H5S_hyper_dim_t app[H5S_MAX_RANK]; /* Application-set per-dim selection info */
H5S_hyper_dim_t opt[H5S_MAX_RANK]; /* Optimized per-dim selection info */
/* The following two fields defines the bounding box of the diminfo selection */
/* (relative to the offset) */
hsize_t low_bounds[H5S_MAX_RANK]; /* The smallest element selected in each dimension */
hsize_t high_bounds[H5S_MAX_RANK]; /* The largest element selected in each dimension */
} H5S_hyper_diminfo_t;
/* Information about hyperslab selection */
typedef struct {
H5S_diminfo_valid_t diminfo_valid; /* Whether the dataset has valid diminfo */
H5S_hyper_diminfo_t diminfo; /* Dimension info form of hyperslab selection */
int unlim_dim; /* Dimension where selection is unlimited, or -1 if none */
hsize_t num_elem_non_unlim; /* # of elements in a "slice" excluding the unlimited dimension */
H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */
@ -162,10 +210,6 @@ typedef struct {
/* Selection information methods */
/* Method to copy a selection */
typedef herr_t (*H5S_sel_copy_func_t)(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
/* Method to retrieve a list of offset/length sequences for selection */
typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
/* Method to release current selection */
typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space);
/* Method to determine if current selection is valid for dataspace */
@ -191,6 +235,8 @@ typedef htri_t (*H5S_sel_is_contiguous_func_t)(const H5S_t *space);
typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space);
/* Method to determine if current selection is "regular" */
typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space);
/* Method to determine if two dataspaces' selections are the same shape */
typedef htri_t (*H5S_sel_shape_same_func_t)(const H5S_t *space1, const H5S_t *space2);
/* Method to adjust a selection by an offset */
typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
/* Method to construct single element projection onto scalar dataspace */
@ -198,7 +244,7 @@ typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset);
/* Method to construct selection projection onto/into simple dataspace */
typedef herr_t (*H5S_sel_project_simple)(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
/* Method to initialize iterator for current selection */
typedef herr_t (*H5S_sel_iter_init_func_t)(H5S_sel_iter_t *sel_iter, const H5S_t *space);
typedef herr_t (*H5S_sel_iter_init_func_t)(const H5S_t *space, H5S_sel_iter_t *sel_iter);
/* Selection class information */
typedef struct {
@ -206,7 +252,6 @@ typedef struct {
/* Methods */
H5S_sel_copy_func_t copy; /* Method to make a copy of a selection */
H5S_sel_get_seq_list_func_t get_seq_list; /* Method to retrieve a list of offset/length sequences for selection */
H5S_sel_release_func_t release; /* Method to release current selection */
H5S_sel_is_valid_func_t is_valid; /* Method to determine if current selection is valid for dataspace */
H5S_sel_serial_size_func_t serial_size; /* Method to determine number of bytes required to store current selection */
@ -219,6 +264,7 @@ typedef struct {
H5S_sel_is_contiguous_func_t is_contiguous; /* Method to determine if current selection is contiguous */
H5S_sel_is_single_func_t is_single; /* Method to determine if current selection is a single block */
H5S_sel_is_regular_func_t is_regular; /* Method to determine if current selection is "regular" */
H5S_sel_shape_same_func_t shape_same; /* Method to determine if two dataspaces' selections are the same shape */
H5S_sel_adjust_u_func_t adjust_u; /* Method to adjust a selection by an offset */
H5S_sel_project_scalar project_scalar; /* Method to construct scalar dataspace projection */
H5S_sel_project_simple project_simple; /* Method to construct simple dataspace projection */
@ -261,6 +307,10 @@ typedef htri_t (*H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter)
typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem);
/* Method to move selection iterator to the next block in the selection */
typedef herr_t (*H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter);
/* Method to retrieve a list of offset/length sequences for selection iterator */
typedef herr_t (*H5S_sel_iter_get_seq_list_func_t)(H5S_sel_iter_t *iter,
size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off,
size_t *len);
/* Method to release iterator for current selection */
typedef herr_t (*H5S_sel_iter_release_func_t)(H5S_sel_iter_t *iter);
@ -275,6 +325,7 @@ typedef struct H5S_sel_iter_class_t {
H5S_sel_iter_has_next_block_func_t iter_has_next_block; /* Method to query if there is another block left in the selection */
H5S_sel_iter_next_func_t iter_next; /* Method to move selection iterator to the next element in the selection */
H5S_sel_iter_next_block_func_t iter_next_block; /* Method to move selection iterator to the next block in the selection */
H5S_sel_iter_get_seq_list_func_t iter_get_seq_list; /* Method to retrieve a list of offset/length sequences for selection iterator */
H5S_sel_iter_release_func_t iter_release; /* Method to release iterator for current selection */
} H5S_sel_iter_class_t;
@ -307,14 +358,20 @@ H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
hbool_t copy_max);
/* Operations on hyperslab selections */
H5_DLL uint64_t H5S__hyper_get_op_gen(void);
H5_DLL void H5S__hyper_rebuild(H5S_t *space);
H5_DLL herr_t H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space);
/* Testing functions */
#ifdef H5S_TESTING
H5_DLL htri_t H5S__select_shape_same_test(hid_t sid1, hid_t sid2);
H5_DLL htri_t H5S__get_rebuild_status_test(hid_t space_id);
H5_DLL herr_t H5S__get_rebuild_status_test(hid_t space_id,
H5S_diminfo_valid_t *status1, H5S_diminfo_valid_t *status2);
H5_DLL herr_t H5S__get_diminfo_status_test(hid_t space_id,
H5S_diminfo_valid_t *status);
H5_DLL htri_t H5S__internal_consistency_test(hid_t space_id);
#endif /* H5S_TESTING */
#endif /*_H5Spkg_H*/

View File

@ -47,16 +47,22 @@
/* Local Typedefs */
/******************/
/* Define alias for hsize_t, for allocating H5S_pnt_node_t + point objects */
/* (Makes it easier to understand the alloc / free calls) */
typedef hsize_t hcoords_t;
/********************/
/* Local Prototypes */
/********************/
static herr_t H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem,
const hsize_t *coord);
static H5S_pnt_list_t *H5S__copy_pnt_list(const H5S_pnt_list_t *src,
unsigned rank);
static void H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst);
/* Selection callbacks */
static herr_t H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
static herr_t H5S__point_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__point_release(H5S_t *space);
static htri_t H5S__point_is_valid(const H5S_t *space);
static hssize_t H5S__point_serial_size(const H5S_t *space);
@ -68,13 +74,14 @@ static int H5S__point_unlim_dim(const H5S_t *space);
static htri_t H5S__point_is_contiguous(const H5S_t *space);
static htri_t H5S__point_is_single(const H5S_t *space);
static htri_t H5S__point_is_regular(const H5S_t *space);
static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2);
static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space,
hsize_t *offset);
static herr_t H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
static herr_t
H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size);
static herr_t H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
static herr_t H5S__point_get_version_enc_size(const H5S_t *space,
uint32_t *version, uint8_t *enc_size);
/* Selection iteration callbacks */
static herr_t H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@ -84,6 +91,8 @@ static hsize_t H5S__point_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S__point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S__point_iter_next_block(H5S_sel_iter_t *sel_iter);
static herr_t H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
static herr_t H5S__point_iter_release(H5S_sel_iter_t *sel_iter);
@ -102,7 +111,6 @@ const H5S_select_class_t H5S_sel_point[1] = {{
/* Methods on selection */
H5S__point_copy,
H5S__point_get_seq_list,
H5S__point_release,
H5S__point_is_valid,
H5S__point_serial_size,
@ -115,6 +123,7 @@ const H5S_select_class_t H5S_sel_point[1] = {{
H5S__point_is_contiguous,
H5S__point_is_single,
H5S__point_is_regular,
H5S__point_shape_same,
H5S__point_adjust_u,
H5S__point_project_scalar,
H5S__point_project_simple,
@ -144,11 +153,12 @@ static const H5S_sel_iter_class_t H5S_sel_iter_point[1] = {{
H5S__point_iter_has_next_block,
H5S__point_iter_next,
H5S__point_iter_next_block,
H5S__point_iter_get_seq_list,
H5S__point_iter_release,
}};
/* Declare a free list to manage the H5S_pnt_node_t struct */
H5FL_DEFINE_STATIC(H5S_pnt_node_t);
/* Declare a free list to manage the H5S_pnt_node_t + hcoords_t array struct */
H5FL_BARR_DEFINE_STATIC(H5S_pnt_node_t, hcoords_t, H5S_MAX_RANK);
/* Declare a free list to manage the H5S_pnt_list_t struct */
H5FL_DEFINE_STATIC(H5S_pnt_list_t);
@ -168,7 +178,7 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t);
*-------------------------------------------------------------------------
*/
static herr_t
H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter)
{
FUNC_ENTER_STATIC_NOERR
@ -176,11 +186,11 @@ H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
/* Initialize the number of points to iterate over */
iter->elmt_left = space->select.num_elem;
/* Share point list for internal iterations */
iter->u.pnt.pnt_lst = space->select.sel_info.pnt_lst;
/* Start at the head of the list of points */
iter->u.pnt.curr=space->select.sel_info.pnt_lst->head;
iter->u.pnt.curr = iter->u.pnt.pnt_lst->head;
/* Initialize type of selection iterator */
iter->type = H5S_sel_iter_point;
@ -380,13 +390,11 @@ H5S__point_iter_next_block(H5S_sel_iter_t *iter)
/*--------------------------------------------------------------------------
NAME
H5S__point_get_seq_list
H5S__point_iter_get_seq_list
PURPOSE
Create a list of offsets & lengths for a selection
USAGE
herr_t H5S__point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_t *space; IN: Dataspace containing selection to use.
unsigned flags; IN: Flags for extra information about operation
herr_t H5S__point_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
position of interest in selection.
size_t maxseq; IN: Maximum number of sequences to generate
@ -410,25 +418,22 @@ H5S__point_iter_next_block(H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem,
size_t *nseq, size_t *nelem, hsize_t *off, size_t *len)
{
size_t io_left; /* The number of bytes left in the selection */
size_t start_io_left; /* The initial number of bytes left in the selection */
H5S_pnt_node_t *node; /* Point node */
hsize_t dims[H5S_MAX_RANK]; /* Total size of memory buf */
int ndims; /* Dimensionality of space*/
unsigned ndims; /* Dimensionality of dataspace*/
hsize_t acc; /* Coordinate accumulator */
hsize_t loc; /* Coordinate offset */
size_t curr_seq; /* Current sequence being operated on */
int i; /* Local index variable */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
HDassert(iter);
HDassert(maxseq > 0);
HDassert(maxelem > 0);
@ -441,9 +446,8 @@ H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter
H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
/* Get the dataspace dimensions */
if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve dataspace dimensions")
/* Get the dataspace's rank */
ndims = iter->rank;
/* Walk through the points in the selection, starting at the current */
/* location in the iterator */
@ -451,15 +455,15 @@ H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter
curr_seq = 0;
while(NULL != node) {
/* Compute the offset of each selected point in the buffer */
for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
acc *= dims[i];
for(i = (int)(ndims - 1), acc = iter->elmt_size, loc = 0; i >= 0; i--) {
loc += (hsize_t)((hssize_t)node->pnt[i] + iter->sel_off[i]) * acc;
acc *= iter->dims[i];
} /* end for */
/* Check if this is a later point in the selection */
if(curr_seq > 0) {
/* If a sorted sequence is requested, make certain we don't go backwards in the offset */
if((flags&H5S_GET_SEQ_LIST_SORTED) && loc<off[curr_seq-1])
if((iter->flags & H5S_SEL_ITER_GET_SEQ_LIST_SORTED) && loc < off[curr_seq - 1])
break;
/* Check if this point extends the previous sequence */
@ -511,9 +515,8 @@ H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter
/* Set the number of elements used */
*nelem = start_io_left - io_left;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__point_get_seq_list() */
} /* end H5S__point_iter_get_seq_list() */
/*--------------------------------------------------------------------------
@ -580,14 +583,14 @@ H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *c
HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND);
for(u = 0; u < num_elem; u++) {
unsigned dim; /* Counter for dimensions */
/* Allocate space for the new node */
if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, space->extent.rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
/* Initialize fields in node */
new_node->next = NULL;
if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(space->extent.rank * sizeof(hsize_t))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
/* Copy over the coordinates */
H5MM_memcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t)));
@ -598,6 +601,17 @@ H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *c
else
curr->next = new_node;
curr = new_node;
/* Update bound box */
/* (Note: when op is H5S_SELECT_SET, the bound box has been reset
* inside H5S_select_elements, the only caller of this function.
* So the following bound box update procedure works correctly
* for the SET operation)
*/
for(dim = 0; dim < space->extent.rank; dim++) {
space->select.sel_info.pnt_lst->low_bounds[dim] = MIN(space->select.sel_info.pnt_lst->low_bounds[dim], curr->pnt[dim]);
space->select.sel_info.pnt_lst->high_bounds[dim] = MAX(space->select.sel_info.pnt_lst->high_bounds[dim], curr->pnt[dim]);
} /* end for */
} /* end for */
new_node = NULL;
@ -609,20 +623,22 @@ H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *c
/* Put new list in point selection */
space->select.sel_info.pnt_lst->head = top;
/* Change the tail pointer if tail has not been set */
if(NULL == space->select.sel_info.pnt_lst->tail)
space->select.sel_info.pnt_lst->tail = curr;
} /* end if */
else { /* op==H5S_SELECT_APPEND */
H5S_pnt_node_t *tmp_node; /* Temporary point selection node */
tmp_node = space->select.sel_info.pnt_lst->head;
if(tmp_node != NULL) {
while(tmp_node->next != NULL)
tmp_node = tmp_node->next;
/* Append new list to point selection */
tmp_node->next = top;
HDassert(space->select.sel_info.pnt_lst->tail);
space->select.sel_info.pnt_lst->tail->next = top;
} /* end if */
else
space->select.sel_info.pnt_lst->head = top;
space->select.sel_info.pnt_lst->tail = curr;
} /* end else */
/* Set the number of elements in the new selection */
@ -635,13 +651,12 @@ done:
if(ret_value < 0) {
/* Release possibly partially initialized new node */
if(new_node)
new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
new_node = (H5S_pnt_node_t *)H5FL_ARR_FREE(hcoords_t, new_node);
/* Release possible linked list of nodes */
while(top) {
curr = top->next;
H5MM_xfree(top->pnt);
top = H5FL_FREE(H5S_pnt_node_t, top);
curr = top->next;
top = (H5S_pnt_node_t *)H5FL_ARR_FREE(hcoords_t, top);
top = curr;
} /* end while */
} /* end if */
@ -670,24 +685,16 @@ done:
static herr_t
H5S__point_release(H5S_t *space)
{
H5S_pnt_node_t *curr, *next; /* Point selection nodes */
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
/* Delete all the nodes from the list */
curr = space->select.sel_info.pnt_lst->head;
while(curr != NULL) {
next = curr->next;
H5MM_xfree(curr->pnt);
curr = H5FL_FREE(H5S_pnt_node_t, curr);
curr = next;
} /* end while */
/* Free the point list */
H5S__free_pnt_list(space->select.sel_info.pnt_lst);
/* Free & reset the point list header */
space->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, space->select.sel_info.pnt_lst);
/* Reset the point list header */
space->select.sel_info.pnt_lst = NULL;
/* Reset the number of elements in the selection */
space->select.num_elem = 0;
@ -743,10 +750,17 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection")
/* Allocate space for the point selection information if necessary */
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL)
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL) {
hsize_t tmp = HSIZET_MAX;
if(NULL == (space->select.sel_info.pnt_lst = H5FL_CALLOC(H5S_pnt_list_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information")
/* Set the bound box to the default value */
H5VM_array_fill(space->select.sel_info.pnt_lst->low_bounds, &tmp, sizeof(hsize_t), space->extent.rank);
HDmemset(space->select.sel_info.pnt_lst->high_bounds, 0, sizeof(hsize_t) * space->extent.rank);
} /* end if */
/* Add points to selection */
if(H5S__point_add(space, op, num_elem, coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements")
@ -758,6 +772,124 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_elements() */
/*--------------------------------------------------------------------------
NAME
H5S__copy_pnt_list
PURPOSE
Copy a point selection list
USAGE
H5S_pnt_list_t *H5S__copy_pnt_list(src)
const H5S_pnt_list_t *src; IN: Pointer to the source point list
unsigned rank; IN: # of dimensions for points
RETURNS
Non-NULL pointer to new point list on success / NULL on failure
DESCRIPTION
Copies point selection information from the source point list to newly
created point list.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_pnt_list_t *
H5S__copy_pnt_list(const H5S_pnt_list_t *src, unsigned rank)
{
H5S_pnt_list_t *dst = NULL; /* New point list */
H5S_pnt_node_t *curr, *new_tail; /* Point information nodes */
H5S_pnt_list_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(src);
HDassert(rank > 0);
/* Allocate room for the head of the point list */
if(NULL == (dst = H5FL_MALLOC(H5S_pnt_list_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point list node")
curr = src->head;
new_tail = NULL;
while(curr) {
H5S_pnt_node_t *new_node; /* New point information node */
/* Create new point */
if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point node")
new_node->next = NULL;
/* Copy over the point's coordinates */
H5MM_memcpy(new_node->pnt, curr->pnt, (rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == new_tail)
new_tail = dst->head = new_node;
else {
new_tail->next = new_node;
new_tail = new_node;
} /* end else */
curr = curr->next;
} /* end while */
dst->tail = new_tail;
/* Copy the selection bounds */
H5MM_memcpy(dst->high_bounds, src->high_bounds, (rank * sizeof(hsize_t)));
H5MM_memcpy(dst->low_bounds, src->low_bounds, (rank * sizeof(hsize_t)));
/* Set return value */
ret_value = dst;
done:
if(NULL == ret_value && dst)
H5S__free_pnt_list(dst);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__copy_pnt_list() */
/*--------------------------------------------------------------------------
NAME
H5S__free_pnt_list
PURPOSE
Free a point selection list
USAGE
void H5S__free_pnt_list(pnt_lst)
H5S_pnt_list_t *pnt_lst; IN: Pointer to the point list to free
RETURNS
None
DESCRIPTION
Frees point selection information from the point list
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static void
H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst)
{
H5S_pnt_node_t *curr; /* Point information nodes */
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(pnt_lst);
/* Traverse the list, freeing all memory */
curr = pnt_lst->head;
while(curr) {
H5S_pnt_node_t *tmp_node = curr;
curr = curr->next;
tmp_node = (H5S_pnt_node_t *)H5FL_ARR_FREE(hcoords_t, tmp_node);
} /* end while */
H5FL_FREE(H5S_pnt_list_t, pnt_lst);
FUNC_LEAVE_NOAPI_VOID
} /* end H5S__free_pnt_list() */
/*--------------------------------------------------------------------------
NAME
@ -766,8 +898,8 @@ done:
Copy a selection from one dataspace to another
USAGE
herr_t H5S__point_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
hbool_t share_selection; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
@ -782,60 +914,19 @@ done:
static herr_t
H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection)
{
H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
/* Sanity check */
HDassert(src);
HDassert(dst);
/* Allocate room for the head of the point list */
if(NULL == (dst->select.sel_info.pnt_lst = H5FL_MALLOC(H5S_pnt_list_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point list node")
curr = src->select.sel_info.pnt_lst->head;
new_tail = NULL;
while(curr) {
/* Create new point */
if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
new_node->next = NULL;
if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank * sizeof(hsize_t)))) {
new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
} /* end if */
/* Copy over the point's coordinates */
H5MM_memcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
if(NULL == new_tail)
new_tail = dst->select.sel_info.pnt_lst->head = new_node;
else {
new_tail->next = new_node;
new_tail = new_node;
} /* end else */
curr = curr->next;
} /* end while */
if(NULL == (dst->select.sel_info.pnt_lst = H5S__copy_pnt_list(src->select.sel_info.pnt_lst, src->extent.rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy point list")
done:
if(ret_value < 0 && dst->select.sel_info.pnt_lst) {
/* Traverse the (incomplete?) dst list, freeing all memory */
curr = dst->select.sel_info.pnt_lst->head;
while(curr) {
H5S_pnt_node_t *tmp_node = curr;
curr->pnt = (hsize_t *)H5MM_xfree(curr->pnt);
curr = curr->next;
tmp_node = H5FL_FREE(H5S_pnt_node_t, tmp_node);
} /* end while */
dst->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, dst->select.sel_info.pnt_lst);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__point_copy() */
@ -863,7 +954,6 @@ done:
static htri_t
H5S__point_is_valid(const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
unsigned u; /* Counter */
htri_t ret_value = TRUE; /* Return value */
@ -871,20 +961,14 @@ H5S__point_is_valid(const H5S_t *space)
HDassert(space);
/* Check each point to determine whether selection+offset is within extent */
curr = space->select.sel_info.pnt_lst->head;
while(curr != NULL) {
/* Check each dimension */
for(u = 0; u < space->extent.rank; u++) {
/* Check if an offset has been defined */
/* Bounds check the selected point + offset against the extent */
if(((curr->pnt[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u])
|| (((hssize_t)curr->pnt[u] + space->select.offset[u]) < 0))
HGOTO_DONE(FALSE)
} /* end for */
curr = curr->next;
} /* end while */
/* Check each dimension */
for(u = 0; u < space->extent.rank; u++) {
/* Bounds check the selected point + offset against the extent */
if((space->select.sel_info.pnt_lst->high_bounds[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u])
HGOTO_DONE(FALSE)
if(((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]) < 0)
HGOTO_DONE(FALSE)
} /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -929,6 +1013,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Sget_select_elem_npoints() */
/*--------------------------------------------------------------------------
NAME
H5S__point_get_version_enc_size
@ -982,13 +1067,12 @@ H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *
/* Determine whether number of points or high bounds exceeds (2^32 - 1) */
if(space->select.num_elem > H5S_UINT32_MAX)
count_up_version = TRUE;
else {
else
for(u = 0; u < space->extent.rank; u++)
if(bounds_end[u] > H5S_UINT32_MAX) {
bound_up_version = TRUE;
break;
}
}
} /* end if */
/* If exceed (2^32 -1) */
if(count_up_version || bound_up_version)
@ -1011,7 +1095,7 @@ H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in point selection exceeds 2^32")
else
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace point selection version out of bounds")
}
} /* end if */
/* Set the version to return */
*version = tmp_version;
@ -1540,8 +1624,6 @@ done:
static herr_t
H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@ -1552,31 +1634,20 @@ H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
HDassert(start);
HDassert(end);
/* Get the dataspace extent rank */
rank = space->extent.rank;
/* Loop over dimensions */
for(u = 0; u < space->extent.rank; u++) {
/* Sanity check */
HDassert(space->select.sel_info.pnt_lst->low_bounds[u] <= space->select.sel_info.pnt_lst->high_bounds[u]);
/* Set the start and end arrays up */
for(u = 0; u < rank; u++) {
start[u] = HSIZET_MAX;
end[u] = 0;
/* Check for offset moving selection negative */
if(((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Set the low & high bounds in this dimension */
start[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]);
end[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->high_bounds[u] + space->select.offset[u]);
} /* end for */
/* Iterate through the node, checking the bounds on each element */
node = space->select.sel_info.pnt_lst->head;
while(node != NULL) {
for(u = 0; u < rank; u++) {
/* Check for offset moving selection negative */
if(((hssize_t)node->pnt[u] + space->select.offset[u]) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
if(start[u] > (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]))
start[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]);
if(end[u] < (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]))
end[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]);
} /* end for */
node = node->next;
} /* end while */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__point_bounds() */
@ -1792,6 +1863,114 @@ H5S__point_is_regular(const H5S_t *space)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__point_is_regular() */
/*--------------------------------------------------------------------------
NAME
H5S__point_shape_same
PURPOSE
Check if a two "point" selections are the same shape
USAGE
htri_t H5S__point_shape_same(space1, space2)
const H5S_t *space1; IN: First dataspace to check
const H5S_t *space2; IN: Second dataspace to check
RETURNS
TRUE / FALSE / FAIL
DESCRIPTION
Checks to see if the current selection in each dataspace are the same
shape.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2)
{
H5S_pnt_node_t *pnt1, *pnt2; /* Point information nodes */
hssize_t offset[H5S_MAX_RANK]; /* Offset between the selections */
unsigned space1_rank; /* Number of dimensions of first dataspace */
unsigned space2_rank; /* Number of dimensions of second dataspace */
int space1_dim; /* Current dimension in first dataspace */
int space2_dim; /* Current dimension in second dataspace */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space1);
HDassert(space2);
/* Get dataspace ranks */
space1_rank = space1->extent.rank;
space2_rank = space2->extent.rank;
/* Sanity check */
HDassert(space1_rank >= space2_rank);
HDassert(space2_rank > 0);
/* Initialize dimensions */
space1_dim = (int)space1_rank - 1;
space2_dim = (int)space2_rank - 1;
/* Look at first point in each selection to compute the offset for common
* dimensions.
*/
pnt1 = space1->select.sel_info.pnt_lst->head;
pnt2 = space2->select.sel_info.pnt_lst->head;
while(space2_dim >= 0) {
/* Set the relative locations of the selections */
offset[space1_dim] = (hssize_t)pnt2->pnt[space2_dim] - (hssize_t)pnt1->pnt[space1_dim];
space1_dim--;
space2_dim--;
} /* end while */
/* For dimensions that appear only in space1: */
while(space1_dim >= 0) {
/* Set the absolute offset of the remaining dimensions */
offset[space1_dim] = (hssize_t)pnt1->pnt[space1_dim];
space1_dim--;
} /* end while */
/* Advance to next point */
pnt1 = pnt1->next;
pnt2 = pnt2->next;
/* Loop over remaining points */
while(pnt1 && pnt2) {
/* Initialize dimensions */
space1_dim = (int)space1_rank - 1;
space2_dim = (int)space2_rank - 1;
/* Compare locations in common dimensions, including relative offset */
while(space2_dim >= 0) {
if((hsize_t)((hssize_t)pnt1->pnt[space1_dim] + offset[space1_dim]) != pnt2->pnt[space2_dim])
HGOTO_DONE(FALSE)
space1_dim--;
space2_dim--;
} /* end while */
/* For dimensions that appear only in space1: */
while(space1_dim >= 0) {
/* Compare the absolute offset in the remaining dimensions */
if((hssize_t)pnt1->pnt[space1_dim] != offset[space1_dim])
HGOTO_DONE(FALSE)
space1_dim--;
} /* end while */
/* Advance to next point */
pnt1 = pnt1->next;
pnt2 = pnt2->next;
} /* end while */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__point_shape_same() */
/*--------------------------------------------------------------------------
NAME
@ -1816,6 +1995,7 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@ -1826,8 +2006,6 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
node = space->select.sel_info.pnt_lst->head;
rank = space->extent.rank;
while(node) {
unsigned u; /* Local index variable */
/* Adjust each coordinate for point node */
for(u = 0; u < rank; u++) {
/* Check for offset moving selection negative */
@ -1841,6 +2019,12 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
node = node->next;
} /* end while */
/* update the bound box of the selection */
for(u = 0; u < rank; u++) {
space->select.sel_info.pnt_lst->low_bounds[u] -= offset[u];
space->select.sel_info.pnt_lst->high_bounds[u] -= offset[u];
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__point_adjust_u() */
@ -1905,6 +2089,7 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
H5S_pnt_node_t *new_node; /* Point node in new space */
H5S_pnt_node_t *prev_node; /* Previous point node in new space */
unsigned rank_diff; /* Difference in ranks between spaces */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@ -1939,13 +2124,9 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
prev_node = NULL;
while(base_node) {
/* Create new point */
if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, new_space->extent.rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
new_node->next = NULL;
if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(new_space->extent.rank * sizeof(hsize_t)))) {
new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
} /* end if */
/* Copy over the point's coordinates */
H5MM_memcpy(new_node->pnt, &base_node->pnt[rank_diff], (new_space->extent.rank * sizeof(hsize_t)));
@ -1961,6 +2142,12 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
/* Advance to next node */
base_node = base_node->next;
} /* end while */
/* Update the bounding box */
for(u = 0; u < new_space->extent.rank; u++) {
new_space->select.sel_info.pnt_lst->low_bounds[u] = base_space->select.sel_info.pnt_lst->low_bounds[u + rank_diff];
new_space->select.sel_info.pnt_lst->high_bounds[u] = base_space->select.sel_info.pnt_lst->high_bounds[u + rank_diff];
} /* end for */
} /* end if */
else {
HDassert(new_space->extent.rank > base_space->extent.rank);
@ -1976,13 +2163,9 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
prev_node = NULL;
while(base_node) {
/* Create new point */
if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
if(NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, new_space->extent.rank)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
new_node->next = NULL;
if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(new_space->extent.rank * sizeof(hsize_t)))) {
new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information")
} /* end if */
/* Copy over the point's coordinates */
HDmemset(new_node->pnt, 0, sizeof(hsize_t) * rank_diff);
@ -1999,6 +2182,16 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
/* Advance to next node */
base_node = base_node->next;
} /* end while */
/* Update the bounding box */
for(u = 0; u < rank_diff; u++) {
new_space->select.sel_info.pnt_lst->low_bounds[u] = 0;
new_space->select.sel_info.pnt_lst->high_bounds[u] = 0;
} /* end for */
for(; u < new_space->extent.rank; u++) {
new_space->select.sel_info.pnt_lst->low_bounds[u] = base_space->select.sel_info.pnt_lst->low_bounds[u - rank_diff];
new_space->select.sel_info.pnt_lst->high_bounds[u] = base_space->select.sel_info.pnt_lst->high_bounds[u - rank_diff];
} /* end for */
} /* end else */
/* Number of elements selected will be the same */

View File

@ -39,12 +39,10 @@
#define H5S_CONV_STORAGE_CHUNKED 0x0004 /* i.e. '2' */
#define H5S_CONV_STORAGE_MASK 0x0006
/* Flags for "get_seq_list" methods */
#define H5S_GET_SEQ_LIST_SORTED 0x0001
/* Forward references of package typedefs */
typedef struct H5S_extent_t H5S_extent_t;
typedef struct H5S_pnt_node_t H5S_pnt_node_t;
typedef struct H5S_pnt_list_t H5S_pnt_list_t;
typedef struct H5S_hyper_span_t H5S_hyper_span_t;
typedef struct H5S_hyper_span_info_t H5S_hyper_span_info_t;
@ -58,6 +56,7 @@ typedef struct H5S_hyper_dim_t {
/* Point selection iteration container */
typedef struct {
H5S_pnt_list_t *pnt_lst; /* Pointer to point list */
H5S_pnt_node_t *curr; /* Pointer to next node to output */
} H5S_point_iter_t;
@ -65,6 +64,7 @@ typedef struct {
typedef struct {
/* Common fields for all hyperslab selections */
hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
hsize_t slab[H5S_MAX_RANK]; /* Cumulative size of each dimension in bytes */
unsigned iter_rank; /* Rank of iterator information */
/* (This should always be the same as the dataspace
* rank, except for regular hyperslab selections in
@ -80,6 +80,7 @@ typedef struct {
hbool_t flattened[H5S_MAX_RANK]; /* Whether this dimension has been flattened */
/* Irregular hyperslab selection fields */
hsize_t loc_off[H5S_MAX_RANK]; /* Byte offset in buffer, for each dimension's current offset */
H5S_hyper_span_info_t *spans; /* Pointer to copy of the span tree */
H5S_hyper_span_t *span[H5S_MAX_RANK];/* Array of pointers to span nodes */
} H5S_hyper_iter_t;
@ -100,9 +101,11 @@ typedef struct H5S_sel_iter_t {
/* Information common to all iterators */
unsigned rank; /* Rank of dataspace the selection iterator is operating on */
hsize_t *dims; /* Dimensions of dataspace the selection is operating on */
hsize_t dims[H5S_MAX_RANK]; /* Dimensions of dataspace the selection is operating on */
hssize_t sel_off[H5S_MAX_RANK]; /* Selection offset in dataspace */
hsize_t elmt_left; /* Number of elements left to iterate over */
size_t elmt_size; /* Size of elements to iterate over */
unsigned flags; /* Flags controlling iterator behavior */
/* Information specific to each type of iterator */
union {
@ -142,7 +145,6 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_GET_EXTENT_NPOINTS(S) ((S)->extent.nelem)
#define H5S_GET_SELECT_NPOINTS(S) ((S)->select.num_elem)
#define H5S_GET_SELECT_TYPE(S) ((S)->select.type->type)
#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.type->get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_VALID(S) ((*(S)->select.type->is_valid)(S))
#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.type->serial_size)(S))
#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.type->serialize)(S,BUF))
@ -160,6 +162,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) ((*(ITER)->type->iter_has_next_block)(ITER))
#define H5S_SELECT_ITER_NEXT(ITER,NELEM)((*(ITER)->type->iter_next)(ITER,NELEM))
#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) ((*(ITER)->type->iter_next_block)(ITER))
#define H5S_SELECT_ITER_GET_SEQ_LIST(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(ITER)->type->iter_get_seq_list)(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_ITER_RELEASE(ITER) ((*(ITER)->type->iter_release)(ITER))
#else /* H5S_MODULE */
#define H5S_GET_EXTENT_TYPE(S) (H5S_get_simple_extent_type(S))
@ -167,7 +170,6 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_GET_EXTENT_NPOINTS(S) (H5S_get_simple_extent_npoints(S))
#define H5S_GET_SELECT_NPOINTS(S) (H5S_get_select_npoints(S))
#define H5S_GET_SELECT_TYPE(S) (H5S_get_select_type(S))
#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_VALID(S) (H5S_select_valid(S))
#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S))
#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF))
@ -185,6 +187,7 @@ typedef struct H5S_sel_iter_op_t {
#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) (H5S_select_iter_has_next_block(ITER))
#define H5S_SELECT_ITER_NEXT(ITER,NELEM)(H5S_select_iter_next(ITER,NELEM))
#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) (H5S_select_iter_next_block(ITER))
#define H5S_SELECT_ITER_GET_SEQ_LIST(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_iter_get_seq_list(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER))
#endif /* H5S_MODULE */
/* Handle these callbacks in a special way, since they have prologs that need to be executed */
@ -253,9 +256,6 @@ H5_DLL herr_t H5S_select_construct_projection(const H5S_t *base_space,
H5S_t **new_space_ptr, unsigned new_space_rank, const void *buf,
void const **adj_buf_ptr, hsize_t element_size);
H5_DLL herr_t H5S_select_release(H5S_t *ds);
H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space);
H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p);
H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
@ -282,10 +282,11 @@ H5_DLL herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op,
/* Operations on hyperslab selections */
H5_DLL herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block);
H5_DLL herr_t H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op,
const hsize_t start[], const hsize_t *stride, const hsize_t count[],
const hsize_t *block, H5S_t **new_space);
H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
const hsize_t *coords);
H5_DLL herr_t H5S_hyper_reset_scratch(H5S_t *space);
H5_DLL herr_t H5S_hyper_convert(H5S_t *space);
H5_DLL htri_t H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
@ -302,11 +303,14 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space,
/* Operations on selection iterators */
H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space,
size_t elmt_size);
size_t elmt_size, unsigned flags);
H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords);
H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
H5_DLL herr_t H5S_select_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq,
size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_sel_iter_close(H5S_sel_iter_t *sel_iter);
#ifdef H5_HAVE_PARALLEL
H5_DLL hsize_t H5S_mpio_set_bigio_count(hsize_t new_count);

View File

@ -28,6 +28,23 @@
/* Define user-level maximum number of dimensions */
#define H5S_MAX_RANK 32
/* Flags for selection iterators */
#define H5S_SEL_ITER_GET_SEQ_LIST_SORTED 0x0001 /* Retrieve elements from iterator
* in increasing offset order, for
* each call to retrieve sequences.
* Currently, this only applies to
* point selections, as hyperslab
* selections are always returned
* in increasing offset order.
*
* Note that the order is only
* increasing for each call to
* get_seq_list, the next set of
* sequences could start with an
* earlier offset than the previous
* one.
*/
/* Different types of dataspaces */
typedef enum H5S_class_t {
H5S_NO_CLASS = -1, /*error */

View File

@ -32,7 +32,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Spkg.h" /* Dataspaces */
#include "H5VMprivate.h" /* Vector and array functions */
@ -941,7 +940,9 @@ H5S_select_is_regular(const H5S_t *space)
herr_t
H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
{
herr_t ret_value = FAIL; /* Return value */
hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@ -949,7 +950,16 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(space);
HDassert(offset);
ret_value = (*space->select.type->adjust_u)(space, offset);
/* Check for an all-zero offset vector */
for(u = 0; u < space->extent.rank; u++)
if(0 != offset[u]) {
non_zero_offset = TRUE;
break;
} /* end if */
/* Only perform operation if the offset is non-zero */
if(non_zero_offset)
ret_value = (*space->select.type->adjust_u)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_adjust_u() */
@ -1041,11 +1051,12 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
PURPOSE
Initializes iteration information for a selection.
USAGE
herr_t H5S_select_iter_init(sel_iter, space, elmt_size)
herr_t H5S_select_iter_init(sel_iter, space, elmt_size, flags)
H5S_sel_iter_t *sel_iter; OUT: Selection iterator to initialize.
H5S_t *space; IN: Dataspace object containing selection to
iterate over
size_t elmt_size; IN: Size of elements in the selection
unsigned flags; IN: Flags to control iteration behavior
RETURNS
Non-negative on success, negative on failure.
DESCRIPTION
@ -1053,7 +1064,8 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
in the dataspace's selection.
--------------------------------------------------------------------------*/
herr_t
H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_size)
H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space,
size_t elmt_size, unsigned flags)
{
herr_t ret_value = FAIL; /* Return value */
@ -1068,17 +1080,23 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
/* Save the dataspace's rank */
sel_iter->rank = space->extent.rank;
/* Point to the dataspace dimensions, if there are any */
if(sel_iter->rank > 0)
sel_iter->dims = space->extent.size;
else
sel_iter->dims = NULL;
/* If dims > 0, copy the dataspace dimensions & selection offset */
if(sel_iter->rank > 0) {
H5MM_memcpy(sel_iter->dims, space->extent.size, sizeof(hsize_t) * space->extent.rank);
H5MM_memcpy(sel_iter->sel_off, space->select.offset, sizeof(hsize_t) * space->extent.rank);
} /* end if */
/* Save the element size */
sel_iter->elmt_size = elmt_size;
/* Initialize the number of elements to iterate over */
sel_iter->elmt_left = space->select.num_elem;
/* Set the flags for the iterator */
sel_iter->flags = flags;
/* Call initialization routine for selection type */
ret_value = (*space->select.type->iter_init)(sel_iter, space);
ret_value = (*space->select.type->iter_init)(space, sel_iter);
HDassert(sel_iter->type);
FUNC_LEAVE_NOAPI(ret_value)
@ -1332,7 +1350,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
/*-------------------------------------------------------------------------
* Function: H5S_select_get_seq_list
* Function: H5S_select_iter_get_seq_list
*
* Purpose: Retrieves the next sequence of offset/length pairs for an
* iterator on a dataspace
@ -1349,24 +1367,23 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
*-------------------------------------------------------------------------
*/
herr_t
H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
H5S_select_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelmts,
size_t *nseq, size_t *nelmts, hsize_t *off, size_t *len)
{
herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity check */
HDassert(space);
HDassert(iter);
/* Call the selection type's get_seq_list function */
if((ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len)) < 0)
if((ret_value = (*iter->type->iter_get_seq_list)(iter, maxseq, maxelmts, nseq, nelmts, off, len)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_get_seq_list() */
} /* end H5S_select_iter_get_seq_list() */
/*--------------------------------------------------------------------------
@ -1467,7 +1484,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize iterator */
if(H5S_select_iter_init(iter, space, elmt_size) < 0)
if(H5S_select_iter_init(iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
@ -1501,7 +1518,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
size_t curr_seq; /* Current sequence being worked on */
/* Get the sequences of bytes */
if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop, while sequences left to process */
@ -1672,7 +1689,6 @@ H5S_get_select_type(const H5S_t *space)
This is primarily used for reading the entire selection in one swoop.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Assumes that there is only a single "block" for hyperslab selections.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@ -1702,6 +1718,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
const H5S_t *space_b; /* Dataspace with smaller rank */
unsigned space_a_rank; /* Number of dimensions of dataspace A */
unsigned space_b_rank; /* Number of dimensions of dataspace B */
int space_a_dim; /* Current dimension in dataspace A */
int space_b_dim; /* Current dimension in dataspace B */
H5S_sel_type sel_a_type; /* Selection type for dataspace A */
H5S_sel_type sel_b_type; /* Selection type for dataspace B */
/* Need to be able to handle spaces of different rank:
*
@ -1719,106 +1739,77 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
*/
if(space1->extent.rank >= space2->extent.rank) {
space_a = space1;
space_a_rank = space_a->extent.rank;
space_b = space2;
space_b_rank = space_b->extent.rank;
} /* end if */
else {
space_a = space2;
space_a_rank = space_a->extent.rank;
space_b = space1;
space_b_rank = space_b->extent.rank;
} /* end else */
space_a_rank = space_a->extent.rank;
space_b_rank = space_b->extent.rank;
HDassert(space_a_rank >= space_b_rank);
HDassert(space_b_rank > 0);
/* Check for "easy" cases before getting into generalized block iteration code */
if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_ALL) && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_ALL)) {
hsize_t dims1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */
hsize_t dims2[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #2 */
int space_a_dim; /* Current dimension in dataspace A */
int space_b_dim; /* Current dimension in dataspace B */
/* Get selection type for both dataspaces */
sel_a_type = H5S_GET_SELECT_TYPE(space_a);
sel_b_type = H5S_GET_SELECT_TYPE(space_b);
if(H5S_get_simple_extent_dims(space_a, dims1, NULL) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
if(H5S_get_simple_extent_dims(space_b, dims2, NULL) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
/* If selections aren't "none", compare their bounds */
if(sel_a_type != H5S_SEL_NONE && sel_b_type != H5S_SEL_NONE) {
hsize_t low_a[H5S_MAX_RANK]; /* Low bound of selection in dataspace a */
hsize_t low_b[H5S_MAX_RANK]; /* Low bound of selection in dataspace b */
hsize_t high_a[H5S_MAX_RANK]; /* High bound of selection in dataspace a */
hsize_t high_b[H5S_MAX_RANK]; /* High bound of selection in dataspace b */
/* Get low & high bounds for both dataspaces */
if(H5S_SELECT_BOUNDS(space_a, low_a, high_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds for first dataspace")
if(H5S_SELECT_BOUNDS(space_b, low_b, high_b) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds for second dataspace")
/* Check that the range between the low & high bounds are the same */
space_a_dim = (int)space_a_rank - 1;
space_b_dim = (int)space_b_rank - 1;
/* recall that space_a_rank >= space_b_rank.
*
* In the following while loop, we test to see if space_a and space_b
* have identical size in all dimensions they have in common.
*/
while(space_b_dim >= 0) {
if(dims1[space_a_dim] != dims2[space_b_dim])
/* Sanity check */
HDassert(low_a[space_a_dim] <= high_a[space_a_dim]);
HDassert(low_a[space_b_dim] <= high_a[space_b_dim]);
/* Verify that the ranges are the same */
if((high_a[space_a_dim] - low_a[space_a_dim])
!= (high_b[space_b_dim] - low_b[space_b_dim]))
HGOTO_DONE(FALSE)
/* Go to next dimension */
space_a_dim--;
space_b_dim--;
} /* end while */
/* Since we are selecting the entire space, we must also verify that space_a
* has size 1 in all dimensions that it does not share with space_b.
*/
/* Check that the rest of the ranges in space a are "flat" */
while(space_a_dim >= 0) {
if(dims1[space_a_dim] != 1)
/* Sanity check */
HDassert(low_a[space_a_dim] <= high_a[space_a_dim]);
/* This range should be flat to be the same in a lower dimension */
if(low_a[space_a_dim] != high_a[space_a_dim])
HGOTO_DONE(FALSE)
space_a_dim--;
} /* end while */
} /* end if */
else if((H5S_GET_SELECT_TYPE(space1) == H5S_SEL_NONE) || (H5S_GET_SELECT_TYPE(space2) == H5S_SEL_NONE)) {
/* (Both must be, at this point, if one is) */
HGOTO_DONE(TRUE)
} /* end if */
else if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_HYPERSLABS && space_a->select.sel_info.hslab->diminfo_valid)
&& (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_HYPERSLABS && space_b->select.sel_info.hslab->diminfo_valid)) {
int space_a_dim; /* Current dimension in dataspace A */
int space_b_dim; /* Current dimension in dataspace B */
space_a_dim = (int)space_a_rank - 1;
space_b_dim = (int)space_b_rank - 1;
/* check that the shapes are the same in the common dimensions, and that
* block == 1 in all dimensions that appear only in space_a.
*/
while(space_b_dim >= 0) {
if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].stride !=
space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].stride)
HGOTO_DONE(FALSE)
if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].count !=
space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].count)
HGOTO_DONE(FALSE)
if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].block !=
space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].block)
HGOTO_DONE(FALSE)
space_a_dim--;
space_b_dim--;
} /* end while */
while(space_a_dim >= 0) {
if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].block != 1)
HGOTO_DONE(FALSE)
space_a_dim--;
} /* end while */
} /* end if */
/* Iterate through all the blocks in the selection */
/* If the dataspaces have the same selection type, use the selection's
* shape_same operator.
*/
if(sel_a_type == sel_b_type)
ret_value = (*space_a->select.type->shape_same)(space_a, space_b);
/* Otherwise, iterate through all the blocks in the selection */
else {
hsize_t start_a[H5S_MAX_RANK]; /* Start point of selection block in dataspace a */
hsize_t start_b[H5S_MAX_RANK]; /* Start point of selection block in dataspace b */
hsize_t end_a[H5S_MAX_RANK]; /* End point of selection block in dataspace a */
hsize_t end_b[H5S_MAX_RANK]; /* End point of selection block in dataspace b */
hsize_t off_a[H5S_MAX_RANK]; /* Offset of selection a blocks */
hsize_t off_b[H5S_MAX_RANK]; /* Offset of selection b blocks */
hssize_t offset[H5S_MAX_RANK]; /* Offset of selection b blocks relative to selection a blocks */
hbool_t first_block = TRUE; /* Flag to indicate the first block */
/* Allocate the selection iterators */
@ -1832,17 +1823,15 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
* that the selection iterator shouldn't be "flattened", since we
* aren't actually going to be doing I/O with the iterators.
*/
if(H5S_select_iter_init(iter_a, space_a, (size_t)0) < 0)
if(H5S_select_iter_init(iter_a, space_a, (size_t)0, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator a")
iter_a_init = TRUE;
if(H5S_select_iter_init(iter_b, space_b, (size_t)0) < 0)
if(H5S_select_iter_init(iter_b, space_b, (size_t)0, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator b")
iter_b_init = TRUE;
/* Iterate over all the blocks in each selection */
while(1) {
int space_a_dim; /* Current dimension in dataspace A */
int space_b_dim; /* Current dimension in dataspace B */
htri_t status_a, status_b; /* Status from next block checks */
/* Get the current block for each selection iterator */
@ -1867,8 +1856,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
HGOTO_DONE(FALSE)
/* Set the relative locations of the selections */
off_a[space_a_dim] = start_a[space_a_dim];
off_b[space_b_dim] = start_b[space_b_dim];
offset[space_a_dim] = (hssize_t)start_b[space_b_dim] - (hssize_t)start_a[space_a_dim];
space_a_dim--;
space_b_dim--;
@ -1878,12 +1866,9 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
* in space_a is not equal to 1, get out.
*/
while(space_a_dim >= 0) {
if((end_a[space_a_dim] - start_a[space_a_dim]) != 0)
if(start_a[space_a_dim] != end_a[space_a_dim])
HGOTO_DONE(FALSE)
/* Set the relative locations of the selections */
off_a[space_a_dim] = start_a[space_a_dim];
space_a_dim--;
} /* end while */
@ -1895,8 +1880,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
/* For dimensions that space_a and space_b have in common: */
while(space_b_dim >= 0) {
/* Check if the blocks are in the same relative location */
if((start_a[space_a_dim] - off_a[space_a_dim]) !=
(start_b[space_b_dim] - off_b[space_b_dim]))
if((hsize_t)((hssize_t)start_a[space_a_dim] + offset[space_a_dim]) != start_b[space_b_dim])
HGOTO_DONE(FALSE)
/* If the block sizes from each selection doesn't match, get out */
@ -1911,7 +1895,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
/* For dimensions that appear only in space_a: */
while(space_a_dim >= 0) {
/* If the block size isn't 1, get out */
if((end_a[space_a_dim] - start_a[space_a_dim]) != 0)
if(start_a[space_a_dim] != end_a[space_a_dim])
HGOTO_DONE(FALSE)
space_a_dim--;
@ -2272,7 +2256,7 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize iterator */
if(H5S_select_iter_init(iter, space, fill_size) < 0)
if(H5S_select_iter_init(iter, space, fill_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
@ -2296,7 +2280,7 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
size_t nelem; /* Number of elements used in sequences */
/* Get the sequences of bytes */
if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop over sequences */
@ -2471,12 +2455,13 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space)
if(H5S_select_none(space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
} /* end if */
/* If either selection is a point selection, fail currently */
else if((subtract_space->select.type->type == H5S_SEL_POINTS) ||
(space->select.type->type == H5S_SEL_POINTS)) {
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
} /* end if */
else {
/* Check for point selection in subtract_space, convert to hyperslab */
if(subtract_space->select.type->type == H5S_SEL_POINTS)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
/* Check for point or all selection in space, convert to hyperslab */
/* Check for all selection in space, convert to hyperslab */
if(space->select.type->type == H5S_SEL_ALL) {
/* Convert current "all" selection to "real" hyperslab selection */
/* Then allow operation to proceed */
@ -2498,14 +2483,12 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space)
if(H5S_select_hyperslab(space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
} /* end if */
else if(space->select.type->type == H5S_SEL_POINTS)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
HDassert(space->select.type->type == H5S_SEL_HYPERSLABS);
HDassert(subtract_space->select.type->type == H5S_SEL_HYPERSLABS);
/* Both spaces are now hyperslabs, perform the operation */
if(H5S__hyper_subtract(space, subtract_space) < 0)
if(H5S__modify_select(space, H5S_SELECT_NOTB, subtract_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't subtract hyperslab")
} /* end else */
} /* end if */

View File

@ -112,12 +112,18 @@ done:
NAME
H5S__get_rebuild_status_test
PURPOSE
Determine the status of hyperslab rebuild
Determine the status of the diminfo_valid field (whether we know the
selection information for an equivalent single hyperslab selection)
before and after calling H5S__hyper_rebuild.
USAGE
htri_t H5S__get_rebuild_status_test(hid_t space_id)
herr_t H5S__get_rebuild_status_test(space_id, status1, status2)
hid_t space_id; IN: dataspace id
H5S_diminfo_valid_t *status1; OUT: status before calling
H5S__hyper_rebuild
H5S_diminfo_valid_t *status2; OUT: status after calling
H5S__hyper_rebuild
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
Non-negative on success, negative on failure
DESCRIPTION
Query the status of rebuilding the hyperslab
GLOBAL VARIABLES
@ -126,11 +132,271 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
H5S__get_rebuild_status_test(hid_t space_id)
herr_t
H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1,
H5S_diminfo_valid_t *status2)
{
H5S_t *space; /* Pointer to 1st dataspace */
htri_t ret_value = FAIL; /* Return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
HDassert(status1);
HDassert(status2);
/* Get dataspace structures */
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
*status1 = space->select.sel_info.hslab->diminfo_valid;
/* Fully rebuild diminfo, if necessary */
if(*status1 == H5S_DIMINFO_VALID_NO)
H5S__hyper_rebuild(space);
*status2 = space->select.sel_info.hslab->diminfo_valid;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S__get_rebuild_status_test() */
/*--------------------------------------------------------------------------
NAME
H5S__get_diminfo_status_test
PURPOSE
Determine the status of the diminfo_valid field (whether we know the
selection information for an equivalent single hyperslab selection)
USAGE
herr_t H5S__get_diminfo_status_test(space_id, status)
hid_t space_id; IN: dataspace id
H5S_diminfo_valid_t *status; OUT: status of diminfo_valid
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
Query the status of rebuilding the hyperslab
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5S__get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t *status)
{
H5S_t *space; /* Pointer to 1st dataspace */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
HDassert(status);
/* Get dataspace structures */
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
*status = space->select.sel_info.hslab->diminfo_valid;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S__get_diminfo_status_test() */
/*--------------------------------------------------------------------------
NAME
H5S__check_spans_tail_ptr
PURPOSE
Determine if the tail pointer of the spans are correctly set
USAGE
herr_t H5S__check_spans_tail_ptr(span_lst)
const H5S_hyper_span_info_t *span_lst; IN: the spans to check for taill pointers
RETURNS
SUCCEED/FAIL
DESCRIPTION
Checks to see if the current selection in the dataspaces has tail pointers of each
dimension correctly set.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Only check the hyperslab selection
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S__check_spans_tail_ptr(const H5S_hyper_span_info_t *span_lst)
{
H5S_hyper_span_t *cur_elem;
H5S_hyper_span_t *actual_tail = NULL;
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC
HDassert(span_lst);
cur_elem = span_lst->head;
while(cur_elem) {
actual_tail = cur_elem;
/* check the next dimension of lower order */
if(NULL != cur_elem->down)
if((ret_value = H5S__check_spans_tail_ptr(cur_elem->down)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
cur_elem = cur_elem->next;
} /* end while */
if(actual_tail != span_lst->tail)
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S__check_spans_tail_ptr */
/*--------------------------------------------------------------------------
NAME
H5S__check_points_tail_ptr
PURPOSE
Determine if the tail pointer of the points list are correctly set
USAGE
herr_t H5S__check_points_tail_ptr(pnt_lst)
const H5S_pnt_list_t *pnt_lst; IN: the points list to check for taill pointers
RETURNS
SUCCEED/FAIL
DESCRIPTION
Checks to see if the current selection in the dataspaces has tail pointers correctly set.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Only check the points selection
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S__check_points_tail_ptr(const H5S_pnt_list_t *pnt_lst)
{
H5S_pnt_node_t *cur_elem;
H5S_pnt_node_t *actual_tail = NULL;
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC
HDassert(pnt_lst);
cur_elem = pnt_lst->head;
while(cur_elem) {
actual_tail = cur_elem;
cur_elem = cur_elem->next;
} /* end while */
if(actual_tail != pnt_lst->tail)
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S__check_points_tail_ptr */
/*--------------------------------------------------------------------------
NAME
H5S__check_internal_consistency
PURPOSE
Determine if internal data structures are consistent
USAGE
herr_t H5S__check_internal_consistency(space)
const H5S_t *space; IN: 1st Dataspace pointer to compare
RETURNS
SUCCEED/FAIL
DESCRIPTION
Checks to see if the current selection in the dataspaces has consistent
state of internal data structure.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Currently only check the hyperslab selection
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S__check_internal_consistency(const H5S_t *space)
{
hsize_t low_bounds[H5S_MAX_RANK];
hsize_t high_bounds[H5S_MAX_RANK];
unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
if(space->select.type->type == H5S_SEL_NONE)
HGOTO_DONE(ret_value);
/* Initialize the inputs */
for(u = 0; u < space->extent.rank; u++) {
low_bounds[u] = HSIZET_MAX;
high_bounds[u] = 0;
} /* end for */
/* Check the bound box */
if(H5S_get_select_bounds(space, low_bounds, high_bounds) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the bound box could not be retrieved")
if(space->select.type->type == H5S_SEL_HYPERSLABS) {
H5S_hyper_sel_t *hslab = space->select.sel_info.hslab;
if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
for(u = 0; u < space->extent.rank; u++) {
if((hsize_t)((hssize_t)hslab->diminfo.low_bounds[u] + space->select.offset[u]) != low_bounds[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the lower bound box of the selection is inconsistent")
if((hsize_t)((hssize_t)hslab->diminfo.high_bounds[u] + space->select.offset[u]) != high_bounds[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the higher bound box of the selection is inconsistent")
} /* end for */
} /* end if */
else {
for(u = 0; u < space->extent.rank; u++) {
if((hsize_t)((hssize_t)hslab->span_lst->low_bounds[u] + space->select.offset[u]) != low_bounds[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the lower bound box of the selection is inconsistent")
if((hsize_t)((hssize_t)hslab->span_lst->high_bounds[u] + space->select.offset[u]) != high_bounds[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the higher bound box of the selection is inconsistent")
} /* end for */
} /* end else */
/* check the tail pointer */
if((NULL != hslab) && (NULL != hslab->span_lst))
if(H5S__check_spans_tail_ptr(hslab->span_lst) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
} /* end if */
else if(space->select.type->type == H5S_SEL_POINTS) {
H5S_pnt_list_t *pnt_lst = space->select.sel_info.pnt_lst;
if(NULL != pnt_lst)
if(H5S__check_points_tail_ptr(pnt_lst) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
} /* end else-if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S__check_internal_consistency */
/*--------------------------------------------------------------------------
NAME
H5S__internal_consistency_test
PURPOSE
Determine if states of internal data structures are consistent
USAGE
htri_t H5S__internal_consistency_test(hid_t space_id)
hid_t space_id; IN: dataspace id
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
Check the states of internal data structures of the hyperslab, and see
whether they are consistent or not
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
H5S__internal_consistency_test(hid_t space_id)
{
H5S_t *space; /* Pointer to 1st dataspace */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_PACKAGE
@ -138,9 +404,11 @@ H5S__get_rebuild_status_test(hid_t space_id)
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
ret_value = (htri_t)space->select.sel_info.hslab->diminfo_valid;
/* Check if the dataspace selections are the same shape */
if(FAIL == H5S__check_internal_consistency(space))
HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "The dataspace has inconsistent internal state")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S__get_rebuild_status_test() */
} /* H5S__internal_consistency_test() */

View File

@ -57,8 +57,8 @@
/* Local Prototypes */
/********************/
static void *H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id,
hid_t dxpl_id, void **req);
const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t space_id,
hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
static void *H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id,
void **req);
@ -76,8 +76,8 @@ static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl
static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
void **req);
static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id,
hid_t dxpl_id, void **req);
const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t type_id,
hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id,
void **req);
@ -108,8 +108,8 @@ static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl
static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
void **req);
static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id,
hid_t dxpl_id, void **req);
const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t gcpl_id,
hid_t gapl_id, hid_t dxpl_id, void **req);
static void *H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id,
void **req);
@ -123,7 +123,7 @@ static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls,
hid_t dxpl_id, void **req);
static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
@ -738,6 +738,145 @@ done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* H5VLget_wrap_ctx() */
/*-------------------------------------------------------------------------
* Function: H5VL_wrap_object
*
* Purpose: Wrap an object with connector
*
* Return: Success: Non-NULL
* Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
H5I_type_t obj_type)
{
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Sanity checks */
HDassert(connector);
HDassert(obj);
/* Only wrap object if there's a wrap context */
if(wrap_ctx) {
/* Ask the connector to wrap the object */
if(NULL == (ret_value = (connector->wrap_cls.wrap_object)(obj, obj_type, wrap_ctx)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
} /* end if */
else
ret_value = obj;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_wrap_object() */
/*---------------------------------------------------------------------------
* Function: H5VLwrap_object
*
* Purpose: Asks a connector to wrap an underlying object.
*
* Return: Success: Non-NULL
* Failure: NULL
*
*---------------------------------------------------------------------------
*/
void *
H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx);
/* Check args and get class pointer */
if(NULL == obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Wrap the object */
if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* H5VLwrap_object */
/*-------------------------------------------------------------------------
* Function: H5VL_unwrap_object
*
* Purpose: Unwrap an object from connector
*
* Return: Success: Non-NULL
* Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
H5VL_unwrap_object(const H5VL_class_t *connector, void *obj)
{
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Sanity checks */
HDassert(connector);
HDassert(obj);
/* Only unwrap object if there's an unwrap callback */
if(connector->wrap_cls.wrap_object) {
/* Ask the connector to unwrap the object */
if(NULL == (ret_value = (connector->wrap_cls.unwrap_object)(obj)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object")
} /* end if */
else
ret_value = obj;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_unwrap_object() */
/*---------------------------------------------------------------------------
* Function: H5VLunwrap_object
*
* Purpose: Unwrap an object from connector
*
* Return: Success: Non-NULL
* Failure: NULL
*
*---------------------------------------------------------------------------
*/
void *
H5VLunwrap_object(void *obj, hid_t connector_id)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE2("*x", "*xi", obj, connector_id);
/* Check args and get class pointer */
if(NULL == obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Unwrap the object */
if(NULL == (ret_value = H5VL_unwrap_object(cls, obj)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* H5VLunwrap_object */
/*-------------------------------------------------------------------------
* Function: H5VL_free_wrap_ctx
@ -802,76 +941,6 @@ done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* H5VLfree_wrap_ctx() */
/*-------------------------------------------------------------------------
* Function: H5VL_wrap_object
*
* Purpose: Wrap an object with connector
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
void *
H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj,
H5I_type_t obj_type)
{
void *ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Sanity checks */
HDassert(connector);
HDassert(obj);
/* Only wrap object if there's a wrap context */
if(wrap_ctx) {
/* Ask the connector to wrap the object */
if(NULL == (ret_value = (connector->wrap_cls.wrap_object)(obj, obj_type, wrap_ctx)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object")
} /* end if */
else
ret_value = obj;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_wrap_object() */
/*---------------------------------------------------------------------------
* Function: H5VLwrap_object
*
* Purpose: Asks a connector to wrap an underlying object.
*
* Return: Success: Non-NULL
* Failure: NULL
*
*---------------------------------------------------------------------------
*/
void *
H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx);
/* Check args and get class pointer */
if(NULL == obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object")
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Wrap the object */
if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* H5VLwrap_object */
/*-------------------------------------------------------------------------
* Function: H5VL__attr_create
@ -885,7 +954,8 @@ done:
*/
static void *
H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
hid_t aapl_id, hid_t dxpl_id, void **req)
{
void *ret_value = NULL; /* Return value */
@ -896,12 +966,12 @@ H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cla
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method")
/* Call the corresponding VOL callback */
if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req)))
if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_attr_create() */
} /* end H5VL__attr_create() */
/*-------------------------------------------------------------------------
@ -916,7 +986,8 @@ done:
*/
void *
H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
hid_t aapl_id, hid_t dxpl_id, void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
void *ret_value = NULL; /* Return value */
@ -929,7 +1000,7 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_para
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req)))
if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed")
done:
@ -953,14 +1024,15 @@ done:
*/
void *
H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
hid_t aapl_id, hid_t dxpl_id, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, acpl_id,
aapl_id, dxpl_id, req);
H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name,
type_id, space_id, acpl_id, aapl_id, dxpl_id, req);
/* Check args and get class pointer */
if(NULL == obj)
@ -969,7 +1041,7 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req)))
if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute")
done:
@ -1725,7 +1797,8 @@ done:
*/
static void *
H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
void *ret_value = NULL; /* Return value */
@ -1736,7 +1809,7 @@ H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method")
/* Call the corresponding VOL callback */
if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req)))
if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
done:
@ -1756,7 +1829,8 @@ done:
*/
void *
H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
void *ret_value = NULL; /* Return value */
@ -1769,7 +1843,7 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_p
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req)))
if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed")
done:
@ -1793,14 +1867,15 @@ done:
*/
void *
H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, dcpl_id,
dapl_id, dxpl_id, req);
H5TRACE11("*x", "*x*xi*siiiiii**x", obj, loc_params, connector_id, name,
lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req);
/* Check args and get class pointer */
if(NULL == obj)
@ -1809,7 +1884,7 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req)))
if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset")
done:
@ -3279,7 +3354,8 @@ done:
*/
static void *
H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,
hid_t dxpl_id, void **req)
{
void *ret_value = NULL; /* Return value */
@ -3290,7 +3366,7 @@ H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cl
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method")
/* Call the corresponding VOL callback */
if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req)))
if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
done:
@ -3310,7 +3386,8 @@ done:
*/
void *
H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id,
void **req)
{
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
void *ret_value = NULL; /* Return value */
@ -3323,7 +3400,7 @@ H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req)))
if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed")
done:
@ -3346,15 +3423,16 @@ done:
*-------------------------------------------------------------------------
*/
void *
H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name,
hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,hid_t dxpl_id,
void **req)
{
H5VL_class_t *cls; /* VOL connector's class struct */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, gcpl_id,
gapl_id, dxpl_id, req);
H5TRACE9("*x", "*x*xi*siiii**x", obj, loc_params, connector_id, name, lcpl_id,
gcpl_id, gapl_id, dxpl_id, req);
/* Check args and get class pointer */
if(NULL == obj)
@ -3363,7 +3441,7 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req)))
if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req)))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group")
done:
@ -3927,7 +4005,8 @@ done:
*/
static herr_t
H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
@ -3938,7 +4017,7 @@ H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method")
/* Call the corresponding VOL callback */
if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0)
if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
@ -3959,23 +4038,28 @@ done:
herr_t
H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
void **req)
void **req, ...)
{
H5VL_object_t tmp_vol_obj; /* Temporary object token of */
va_list arguments; /* Argument list passed from the API call */
hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Start the varargs, so they can be copied */
HDva_start(arguments, req);
arg_started = TRUE;
/* Special case for hard links */
if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) {
H5P_genplist_t *plist; /* Property list pointer */
va_list tmp_arguments; /* Copy of argument list passed in */
/* Get the VOL data pointer from the fapl */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list")
if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info")
/* Get the VOL data pointer from the varargs */
HDva_copy(tmp_arguments, arguments);
tmp_vol_obj.data = HDva_arg(tmp_arguments, void *);
HDva_end(tmp_arguments);
} /* end if */
else
/* Use the VOL object passed in */
@ -3988,10 +4072,14 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
/* End access to the va_list, if we started it */
if(arg_started)
HDva_end(arguments);
/* Reset object wrapping info in API context */
if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@ -4014,21 +4102,22 @@ done:
*/
herr_t
H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
va_list arguments)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE8("e", "Vk*x*xiiii**x", create_type, obj, loc_params, connector_id,
lcpl_id, lapl_id, dxpl_id, req);
H5TRACE9("e", "Vk*x*xiiii**xx", create_type, obj, loc_params, connector_id,
lcpl_id, lapl_id, dxpl_id, req, arguments);
/* Get class pointer */
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link")
done:

View File

@ -1356,6 +1356,32 @@ H5VL_object_data(const H5VL_object_t *vol_obj)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_object_data() */
/*-------------------------------------------------------------------------
* Function: H5VL_object_unwrap
*
* Purpose: Correctly unwrap the 'data' field for a VOL object (H5VL_object),
* even for nested / stacked VOL connectors.
*
* Return: Success: Object pointer
* Failure: NULL
*
*-------------------------------------------------------------------------
*/
void *
H5VL_object_unwrap(const H5VL_object_t *vol_obj)
{
void *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
if(NULL == (ret_value = H5VL_unwrap_object(vol_obj->connector->cls, vol_obj->data)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_object_unwrap() */
/*-------------------------------------------------------------------------
* Function: H5VL__object
@ -1444,7 +1470,7 @@ H5VL_object(hid_t id)
/* Get the underlying object */
if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id))))
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID")
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't retrieve object for ID")
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -50,6 +50,7 @@ static H5VL_class_t H5VL_native_cls_g = {
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
NULL, /* unwrap_object */
NULL /* free_wrap_ctx */
},
{ /* attribute_cls */

View File

@ -44,14 +44,12 @@
*/
void *
H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req)
hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id,
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc; /* Object location */
H5G_loc_t obj_loc; /* Location used to open group */
hbool_t loc_found = FALSE;
H5P_genplist_t *plist; /* Property list pointer */
hid_t type_id, space_id;
H5T_t *type, *dt; /* Datatype to use for attribute */
H5S_t *space; /* Dataspace to use for attribute */
H5A_t *attr = NULL;
@ -59,16 +57,6 @@ H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const c
FUNC_ENTER_PACKAGE
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
/* get creation properties */
if(H5P_get(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))

View File

@ -43,32 +43,17 @@
*/
void *
H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req)
{
H5P_genplist_t *plist; /* Property list pointer */
H5G_loc_t loc; /* Object location to insert dataset into */
hid_t type_id = H5I_INVALID_HID;
hid_t space_id = H5I_INVALID_HID;
hid_t lcpl_id = H5I_INVALID_HID;
H5D_t *dset = NULL; /* New dataset's info */
const H5S_t *space; /* Dataspace for dataset */
void *ret_value;
FUNC_ENTER_PACKAGE
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
/* Get creation properties */
if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id")
if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id")
if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
/* Check arguments */
if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")

View File

@ -41,25 +41,15 @@
*/
void *
H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req)
hid_t lcpl_id, hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id,
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5P_genplist_t *plist; /* Property list pointer */
H5G_loc_t loc; /* Location to create group */
H5G_t *grp = NULL; /* New group created */
hid_t lcpl_id;
void *ret_value;
FUNC_ENTER_PACKAGE
/* Get the property list structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
/* Get creation properties */
if(H5P_get(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id")
/* Set up the location */
if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")

View File

@ -41,7 +41,7 @@
herr_t
H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id,
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
@ -57,13 +57,8 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
{
H5G_loc_t cur_loc;
H5G_loc_t link_loc;
void *cur_obj;
H5VL_loc_params_t cur_params;
if(H5P_get(plist, H5VL_PROP_LINK_TARGET, &cur_obj) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current location id")
if(H5P_get(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &cur_params) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current name")
void *cur_obj = HDva_arg(arguments, void *);
H5VL_loc_params_t cur_params = HDva_arg(arguments, H5VL_loc_params_t);
if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
@ -99,15 +94,12 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
case H5VL_LINK_CREATE_SOFT:
{
char *target_name;
char *target_name = HDva_arg(arguments, char *);
H5G_loc_t link_loc; /* Group location for new link */
if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
if(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name")
/* Create the link */
if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
@ -117,23 +109,15 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
case H5VL_LINK_CREATE_UD:
{
H5G_loc_t link_loc; /* Group location for new link */
H5L_type_t link_type;
void *udata;
size_t udata_size;
H5L_type_t link_type = (H5L_type_t)HDva_arg(arguments, int);
void *udata = HDva_arg(arguments, void *);
size_t udata_size = HDva_arg(arguments, size_t);
if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
if(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for link type")
if(H5P_get(plist, H5VL_PROP_LINK_UDATA, &udata) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata")
if(H5P_get(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size")
/* Create link */
if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size,
link_type, lcpl_id) < 0)
if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size, link_type, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
break;
}

View File

@ -24,7 +24,7 @@ extern "C" {
#endif
/* Atrribute callbacks */
H5_DLL void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
@ -34,7 +34,7 @@ H5_DLL herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, v
H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
H5_DLL void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
@ -52,7 +52,7 @@ H5_DLL herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req,
H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
@ -60,7 +60,7 @@ H5_DLL herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req,
H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);

View File

@ -80,6 +80,9 @@ static herr_t H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector
H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
H5VL_request_specific_t specific_type, ...);
static herr_t H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type,
void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...);
static H5VL_pass_through_t *H5VL_pass_through_new_obj(void *under_obj,
hid_t under_vol_id);
static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj);
@ -98,12 +101,13 @@ static herr_t H5VL_pass_through_str_to_info(const char *str, void **info);
/* VOL object wrap / retrieval callbacks */
static void *H5VL_pass_through_get_object(const void *obj);
static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx);
static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
static void *H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type,
void *wrap_ctx);
static void *H5VL_pass_through_unwrap_object(void *obj);
static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
/* Attribute callbacks */
static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
@ -113,7 +117,7 @@ static herr_t H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **r
static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf, void **req);
@ -140,7 +144,7 @@ static herr_t H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **
static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
@ -148,7 +152,7 @@ static herr_t H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **
static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
@ -194,6 +198,7 @@ static const H5VL_class_t H5VL_pass_through_g = {
H5VL_pass_through_get_object, /* get_object */
H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */
H5VL_pass_through_wrap_object, /* wrap_object */
H5VL_pass_through_unwrap_object, /* unwrap_object */
H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */
},
{ /* attribute_cls */
@ -683,8 +688,8 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
*
* Purpose: Use a "wrapper context" to wrap a data object
*
* Return: Success: 0
* Failure: -1
* Return: Success: Pointer to wrapped object
* Failure: NULL
*
*---------------------------------------------------------------------------
*/
@ -709,6 +714,37 @@ H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
return new_obj;
} /* end H5VL_pass_through_wrap_object() */
/*---------------------------------------------------------------------------
* Function: H5VL_pass_through_unwrap_object
*
* Purpose: Unwrap a wrapped object, discarding the wrapper, but returning
* underlying object.
*
* Return: Success: Pointer to unwrapped object
* Failure: NULL
*
*---------------------------------------------------------------------------
*/
static void *
H5VL_pass_through_unwrap_object(void *obj)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
void *under;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL UNWRAP Object\n");
#endif
/* Unrap the object with the underlying VOL */
under = H5VLunwrap_object(o->under_object, o->under_vol_id);
if(under)
H5VL_pass_through_free_obj(o);
return under;
} /* end H5VL_pass_through_unwrap_object() */
/*---------------------------------------------------------------------------
* Function: H5VL_pass_through_free_wrap_ctx
@ -761,7 +797,8 @@ H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
*/
static void *
H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
hid_t aapl_id, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *attr;
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
@ -771,7 +808,7 @@ H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL ATTRIBUTE Create\n");
#endif
under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, acpl_id, aapl_id, dxpl_id, req);
under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req);
if(under) {
attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
@ -1024,7 +1061,8 @@ H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req)
*/
static void *
H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *dset;
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
@ -1034,7 +1072,7 @@ H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL DATASET Create\n");
#endif
under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, dcpl_id, dapl_id, dxpl_id, req);
under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req);
if(under) {
dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
@ -1194,17 +1232,22 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL H5Dspecific\n");
#endif
// Save copy of underlying VOL connector ID and prov helper, in case of
// refresh destroying the current object
under_vol_id = o->under_vol_id;
ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_dataset_specific() */
@ -1396,17 +1439,22 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL DATATYPE Specific\n");
#endif
// Save copy of underlying VOL connector ID and prov helper, in case of
// refresh destroying the current object
under_vol_id = o->under_vol_id;
ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_datatype_specific() */
@ -1828,7 +1876,8 @@ H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req)
*/
static void *
H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,
hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *group;
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
@ -1838,7 +1887,7 @@ H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL GROUP Create\n");
#endif
under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, gcpl_id, gapl_id, dxpl_id, req);
under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req);
if(under) {
group = H5VL_pass_through_new_obj(under, o->under_vol_id);
@ -1936,17 +1985,22 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL GROUP Specific\n");
#endif
// Save copy of underlying VOL connector ID and prov helper, in case of
// refresh destroying the current object
under_vol_id = o->under_vol_id;
ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_group_specific() */
@ -2017,6 +2071,32 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
} /* end H5VL_pass_through_group_close() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_link_create_reissue
*
* Purpose: Re-wrap vararg arguments into a va_list and reissue the
* link create callback to the underlying VOL connector.
*
* Return: Success: 0
* Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type,
void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...)
{
va_list arguments;
herr_t ret_value;
va_start(arguments, req);
ret_value = H5VLlink_create(create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req, arguments);
va_end(arguments);
return ret_value;
} /* end H5VL_pass_through_link_create_reissue() */
/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_link_create
*
@ -2028,7 +2108,9 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
*-------------------------------------------------------------------------
*/
static herr_t
H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req, va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id = -1;
@ -2045,9 +2127,11 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, co
/* Fix up the link target object for hard link creation */
if(H5VL_LINK_CREATE_HARD == create_type) {
void *cur_obj;
H5VL_loc_params_t cur_params;
/* Retrieve the object for the link target */
H5Pget(lcpl_id, H5VL_PROP_LINK_TARGET, &cur_obj);
/* Retrieve the object & loc params for the link target */
cur_obj = va_arg(arguments, void *);
cur_params = va_arg(arguments, H5VL_loc_params_t);
/* If it's a non-NULL pointer, find the 'under object' and re-set the property */
if(cur_obj) {
@ -2056,11 +2140,14 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, co
under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id;
/* Set the object for the link target */
H5Pset(lcpl_id, H5VL_PROP_LINK_TARGET, &(((H5VL_pass_through_t *)cur_obj)->under_object));
cur_obj = ((H5VL_pass_through_t *)cur_obj)->under_object;
} /* end if */
} /* end if */
ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
/* Re-issue 'link create' call, using the unwrapped pieces */
ret_value = H5VL_pass_through_link_create_reissue(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, cur_obj, cur_params);
} /* end if */
else
ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
@ -2372,17 +2459,22 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
va_list arguments)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL OBJECT Specific\n");
#endif
// Save copy of underlying VOL connector ID and prov helper, in case of
// refresh destroying the current object
under_vol_id = o->under_vol_id;
ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
/* Check for async request */
if(req && *req)
*req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
return ret_value;
} /* end H5VL_pass_through_object_specific() */

View File

@ -86,6 +86,7 @@ H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vip
/* Functions that manipulate VOL objects */
H5_DLL void *H5VL_object(hid_t id);
H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_unwrap(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type);
H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id);
H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
@ -93,13 +94,14 @@ H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
/* Functions that wrap / unwrap VOL objects */
H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj,
void **wrap_ctx);
H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx,
void *obj, H5I_type_t obj_type);
H5_DLL void * H5VL_unwrap_object(const H5VL_class_t *connector, void *obj);
H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx);
H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, H5VL_t *vol_connector);
H5_DLL herr_t H5VL_inc_vol_wrapper(void *vol_wrap_ctx);
H5_DLL herr_t H5VL_dec_vol_wrapper(void *vol_wrap_ctx);
H5_DLL herr_t H5VL_reset_vol_wrapper(void);
H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx,
void *obj, H5I_type_t obj_type);
/* Library state functions */
H5_DLL herr_t H5VL_retrieve_lib_state(void **state);
@ -125,7 +127,7 @@ H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_va
H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, void *info);
/* Attribute functions */
H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
@ -135,7 +137,7 @@ H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo
H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Dataset functions */
H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
@ -153,7 +155,7 @@ H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo
H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Group functions */
H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...);
@ -161,7 +163,7 @@ H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, v
H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Link functions */
H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...);
H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);

View File

@ -32,27 +32,6 @@
/* Public Macros */
/*****************/
/* Dataset creation property names */
#define H5VL_PROP_DSET_TYPE_ID "dataset_type_id"
#define H5VL_PROP_DSET_SPACE_ID "dataset_space_id"
#define H5VL_PROP_DSET_LCPL_ID "dataset_lcpl_id"
/* Attribute creation property names */
#define H5VL_PROP_ATTR_TYPE_ID "attr_type_id"
#define H5VL_PROP_ATTR_SPACE_ID "attr_space_id"
#define H5VL_PROP_ATTR_LOC_PARAMS "attr_location"
/* Link creation property names */
#define H5VL_PROP_LINK_TARGET "target_location_object"
#define H5VL_PROP_LINK_TARGET_LOC_PARAMS "target_params"
#define H5VL_PROP_LINK_TARGET_NAME "target_name"
#define H5VL_PROP_LINK_TYPE "link type"
#define H5VL_PROP_LINK_UDATA "udata"
#define H5VL_PROP_LINK_UDATA_SIZE "udata size"
/* Group creation property names */
#define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id"
/* Default VOL connector value */
#define H5VL_VOL_DEFAULT 0
@ -253,13 +232,15 @@ typedef struct H5VL_wrap_class_t {
void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */
herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
void * (*wrap_object)(void *obj, H5I_type_t obj_type, void *wrap_ctx); /* Callback to wrap a library object */
void * (*unwrap_object)(void *obj); /* Callback to unwrap a library object */
herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
} H5VL_wrap_class_t;
/* H5A routines */
typedef struct H5VL_attr_class_t {
void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id,
hid_t dxpl_id, void **req);
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
hid_t aapl_id, hid_t dxpl_id, void **req);
herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
@ -274,7 +255,8 @@ typedef struct H5VL_attr_class_t {
/* H5D routines */
typedef struct H5VL_dataset_class_t {
void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
hid_t dapl_id, hid_t dxpl_id, void **req);
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t dapl_id, hid_t dxpl_id, void **req);
herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
@ -316,7 +298,7 @@ typedef struct H5VL_file_class_t {
/* H5G routines */
typedef struct H5VL_group_class_t {
void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gapl_id, hid_t dxpl_id, void **req);
herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
@ -329,7 +311,7 @@ typedef struct H5VL_group_class_t {
/* H5L routines */
typedef struct H5VL_link_class_t {
herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list argumenmts);
herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req);
@ -472,10 +454,11 @@ H5_DLL void *H5VLget_object(void *obj, hid_t connector_id);
H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx);
H5_DLL void *H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id,
void *wrap_ctx);
H5_DLL void *H5VLunwrap_object(void *obj, hid_t connector_id);
H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
/* Public wrappers for attribute callbacks */
H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
@ -485,7 +468,7 @@ H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, vo
H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for dataset callbacks */
H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
@ -503,7 +486,7 @@ H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, vo
H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for group callbacks */
H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL void *H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
@ -511,7 +494,7 @@ H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, v
H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for link callbacks */
H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);

View File

@ -226,6 +226,7 @@ MINOR, DSPACE, H5E_CANTSELECT, Can't select hyperslab
MINOR, DSPACE, H5E_CANTNEXT, Can't move to next iterator location
MINOR, DSPACE, H5E_BADSELECT, Invalid selection
MINOR, DSPACE, H5E_CANTCOMPARE, Can't compare objects
MINOR, DSPACE, H5E_INCONSISTENTSTATE, Internal states are inconsistent
MINOR, DSPACE, H5E_CANTAPPEND, Can't append object
# Property list errors

View File

@ -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 5 /* For tweaks, bug-fixes, or development */
#define H5_VERS_RELEASE 6 /* 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.5" /* Full version string */
#define H5_VERS_INFO "HDF5 library version: 1.11.6" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)

View File

@ -62,7 +62,7 @@ if (BUILD_SHARED_LIBS)
endif ()
#################################################################################
# If filter plugin tests can be tested
# If filter and vol plugin tests can be tested
#################################################################################
if (BUILD_SHARED_LIBS)
# make plugins dir
@ -131,6 +131,11 @@ if (BUILD_SHARED_LIBS)
)
endforeach ()
#################################################################################
# make vol plugins dir
#################################################################################
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/null_vol_plugin_dir")
#-----------------------------------------------------------------------------
# Define VOL Plugin Test Sources
#-----------------------------------------------------------------------------
@ -159,7 +164,7 @@ if (BUILD_SHARED_LIBS)
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
"$<TARGET_FILE:${HDF5_VOL_PLUGIN_LIB_TARGET}>"
"${CMAKE_BINARY_DIR}/vol/$<TARGET_FILE_NAME:${HDF5_VOL_PLUGIN_LIB_TARGET}>"
"${CMAKE_BINARY_DIR}/null_vol_plugin_dir/$<TARGET_FILE_NAME:${HDF5_VOL_PLUGIN_LIB_TARGET}>"
)
endforeach ()
endif ()
@ -458,12 +463,24 @@ if (BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (filter_plugin SHARED)
target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
set_target_properties (filter_plugin PROPERTIES FOLDER test)
add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c)
target_include_directories(vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (vol_plugin SHARED)
target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
set_target_properties (vol_plugin PROPERTIES FOLDER test)
else ()
add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (filter_plugin STATIC)
target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
set_target_properties (filter_plugin PROPERTIES FOLDER test)
add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c)
target_include_directories(vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (vol_plugin STATIC)
target_link_libraries (vol_plugin PRIVATE ${HDF5_TEST_LIB_TARGET})
set_target_properties (vol_plugin PROPERTIES FOLDER test)
endif ()
##############################################################################

View File

@ -99,6 +99,8 @@ endif ()
tcheck_version
testmeta
links_env
external_env
vds_env
)
if (NOT CYGWIN)
list (REMOVE_ITEM H5_VOL_SKIP_TESTS big cache)

View File

@ -1293,6 +1293,25 @@ endif ()
##############################################################################
##############################################################################
##############################################################################
### V O L P L U G I N T E S T S
##############################################################################
if (BUILD_SHARED_LIBS)
if (WIN32)
set (CMAKE_SEP "\;")
set (BIN_REL_PATH "../../")
else ()
set (CMAKE_SEP ":")
set (BIN_REL_PATH "../")
endif ()
add_test (NAME H5PLUGIN-vol_plugin COMMAND $<TARGET_FILE:vol_plugin>)
set_tests_properties (H5PLUGIN-vol_plugin PROPERTIES
ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/null_vol_plugin_dir;srcdir=${HDF5_TEST_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
)
endif ()
if (HDF5_TEST_PASSTHROUGH_VOL)
include (CMakePassthroughVOLTests.cmake)
endif ()

View File

@ -102,6 +102,8 @@ endif ()
tcheck_version
testmeta
links_env
external_env
vds_env
)
if (NOT CYGWIN)
list (REMOVE_ITEM H5_VFD_SKIP_TESTS big cache)

View File

@ -635,7 +635,7 @@ test_read_file_set(hid_t fapl)
TEST_ERROR
/* Reset the raw data files */
if(reset_raw_data_files() < 0)
if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the file and an initial group. This causes messages about
@ -775,7 +775,7 @@ test_write_file_set(hid_t fapl)
} /* end for */
/* Reset the raw data files */
if(reset_raw_data_files() < 0)
if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@ -876,7 +876,7 @@ test_path_absolute(hid_t fapl)
FAIL_STACK_ERROR
/* Reset the raw data files */
if(reset_raw_data_files() < 0)
if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dcpl */
@ -972,7 +972,7 @@ test_path_relative(hid_t fapl)
FAIL_STACK_ERROR;
/* Reset the raw data files */
if(reset_raw_data_files() < 0)
if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@ -1067,7 +1067,7 @@ test_path_relative_cwd(hid_t fapl)
FAIL_STACK_ERROR;
/* Reset the raw data files */
if(reset_raw_data_files() < 0)
if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the dataset */
@ -1209,7 +1209,7 @@ test_h5d_get_access_plist(hid_t fapl_id)
TEST_ERROR
/* Reset the raw data files */
if(reset_raw_data_files() < 0)
if(reset_raw_data_files(0) < 0)
TEST_ERROR
/* Create the file */

View File

@ -35,7 +35,7 @@
*-------------------------------------------------------------------------
*/
herr_t
reset_raw_data_files(void)
reset_raw_data_files(int is_env)
{
int fd = 0; /* external file descriptor */
size_t i, j; /* iterators */
@ -59,7 +59,10 @@ reset_raw_data_files(void)
for(i = 0; i < N_EXT_FILES; i++) {
/* Open file */
HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
if(is_env)
HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1);
else
HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
@ -93,7 +96,10 @@ reset_raw_data_files(void)
for(i = 0; i < N_EXT_FILES; i++) {
/* Open file */
HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
if(is_env)
HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1);
else
HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;

View File

@ -33,6 +33,11 @@ static const char *EXT_FNAME[] = {
NULL
};
static const char *EXT_ENV_FNAME[] = {
"extern_env_dir/env_file_1",
NULL
};
/* A similar collection of files is used for the tests that
* perform file I/O.
*/
@ -41,5 +46,5 @@ static const char *EXT_FNAME[] = {
#define TOTAL_SIZE 100
#define GARBAGE_PER_FILE 10
H5TEST_DLL herr_t reset_raw_data_files(void);
H5TEST_DLL herr_t reset_raw_data_files(int);
#endif /* _EXTERNAL_COMMON_H */

View File

@ -56,15 +56,15 @@ test_path_env(hid_t fapl)
TESTING("prefix in HDF5_EXTFILE_PREFIX");
if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST)
if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR;
h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename));
h5_fixname(EXT_ENV_FNAME[0], fapl, filename, sizeof(filename));
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Reset the raw data files */
if(reset_raw_data_files() < 0)
if(reset_raw_data_files(1) < 0)
TEST_ERROR
/* Create the dataset */
@ -73,7 +73,7 @@ test_path_env(hid_t fapl)
if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
TEST_ERROR
for(i = 0; i < N_EXT_FILES; i++) {
HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1);
HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1);
if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
FAIL_STACK_ERROR
} /* end for */
@ -144,7 +144,6 @@ main(void)
hid_t fapl_id_new = -1; /* file access properties (new format) */
hid_t fid = -1; /* file for test_1* functions */
hid_t gid = -1; /* group to emit diagnostics */
char filename[1024]; /* file name for test_1* funcs */
unsigned latest_format; /* default or latest file format */
int nerrors = 0; /* number of errors */
@ -152,7 +151,6 @@ main(void)
/* Get a fapl for the old (default) file format */
fapl_id_old = h5_fileaccess();
h5_fixname(EXT_FNAME[0], fapl_id_old, filename, sizeof(filename));
/* Copy and set up a fapl for the latest file format */
if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0)
@ -186,17 +184,17 @@ main(void)
/* Clean up files used by file set tests */
if(h5_cleanup(EXT_FNAME, fapl_id_old)) {
HDremove("extern_1r.raw");
HDremove("extern_2r.raw");
HDremove("extern_3r.raw");
HDremove("extern_4r.raw");
HDremove("extern_env_1r.raw");
HDremove("extern_env_2r.raw");
HDremove("extern_env_3r.raw");
HDremove("extern_env_4r.raw");
HDremove("extern_1w.raw");
HDremove("extern_2w.raw");
HDremove("extern_3w.raw");
HDremove("extern_4w.raw");
HDremove("extern_env_1w.raw");
HDremove("extern_env_2w.raw");
HDremove("extern_env_3w.raw");
HDremove("extern_env_4w.raw");
HDrmdir("extern_dir");
HDrmdir("extern_env_dir");
} /* end if */
return EXIT_SUCCESS;

View File

@ -115,8 +115,8 @@ const char *LIBVER_NAMES[] = {
static H5E_auto2_t err_func = NULL;
static herr_t h5_errors(hid_t estack, void *client_data);
static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix,
char *fullname, size_t size, hbool_t nest_printf);
static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock);
/*-------------------------------------------------------------------------
@ -471,7 +471,33 @@ h5_test_init(void)
char *
h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE));
return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE, FALSE));
}
/*-------------------------------------------------------------------------
* Function: h5_fixname_superblock
*
* Purpose: Like h5_fixname() but returns the name of the file you'd
* open to find the superblock. Useful for when you have to
* open a file with open(2) but the h5_fixname() string
* contains stuff like format strings.
*
* Return: Success: The FULLNAME pointer.
*
* Failure: NULL if BASENAME or FULLNAME is the null
* pointer or if FULLNAME isn't large enough for
* the result.
*
* Programmer: Dana Robinson
* Spring 2019
*
*-------------------------------------------------------------------------
*/
char *
h5_fixname_superblock(const char *base_name, hid_t fapl_id, char *fullname, size_t size)
{
return (h5_fixname_real(base_name, fapl_id, ".h5", fullname, size, FALSE, TRUE));
}
@ -491,7 +517,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
char *
h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE));
return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE, FALSE));
}
@ -517,7 +543,7 @@ h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t s
char *
h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE));
return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE, FALSE));
}
@ -545,9 +571,10 @@ h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size
*/
static char *
h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
char *fullname, size_t size, hbool_t nest_printf)
char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock)
{
const char *prefix = NULL;
const char *env = NULL; /* HDF5_DRIVER environment variable */
char *ptr, last = '\0';
const char *suffix = _suffix;
size_t i, j;
@ -565,17 +592,46 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
return NULL;
if(suffix) {
if(H5FD_FAMILY == driver)
suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
else if (H5FD_MULTI == driver)
suffix = NULL;
if(H5FD_FAMILY == driver) {
if(subst_for_superblock)
suffix = "00000.h5";
else
suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
}
else if (H5FD_MULTI == driver) {
/* Get the environment variable, if it exists, in case
* we are using the split driver since both of those
* use the multi VFD under the hood.
*/
env = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
/* Use the environment variable, then the compile-time constant */
if(!env)
env = HDF5_DRIVER;
#endif
if(env && !HDstrcmp(env, "split")) {
/* split VFD */
if(subst_for_superblock)
suffix = "-m.h5";
else
suffix = NULL;
}
else {
/* multi VFD */
if(subst_for_superblock)
suffix = "-s.h5";
else
suffix = NULL;
}
}
}
}
/* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX
* could be of value -1 if it is not defined.
*/
isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO==driver);
isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver);
/* Check HDF5_NOCLEANUP environment setting.
* (The #ifdef is needed to prevent compile failure in case MPI is not

View File

@ -133,6 +133,7 @@ extern "C" {
H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl);
H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL char *h5_fixname_superblock(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL hid_t h5_fileaccess(void);

View File

@ -27,16 +27,21 @@ static const H5VL_class_t null_vol_g = {
0, /* capability flags */
NULL, /* initialize */
NULL, /* terminate */
(size_t)0, /* info size */
NULL, /* info copy */
NULL, /* info compare */
NULL, /* info free */
NULL, /* info to str */
NULL, /* str to info */
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
NULL, /* free_wrap_ctx */
{ /* info_cls */
(size_t)0, /* size */
NULL, /* copy */
NULL, /* compare */
NULL, /* free */
NULL, /* to_str */
NULL, /* from_str */
},
{ /* wrap_cls */
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
NULL, /* unwrap_object */
NULL, /* free_wrap_ctx */
},
{ /* attribute_cls */
NULL, /* create */
NULL, /* open */

View File

@ -1594,54 +1594,72 @@ test_file_perm2(void)
** H5Fis_accessible() API call.
**
*****************************************************************/
#define FILE_IS_ACCESSIBLE "tfile_is_accessible"
static void
test_file_is_accessible(const char *env_h5_drvr)
{
hid_t fid; /* File opened with read-write permission */
hid_t fcpl_id; /* File creation property list */
hid_t fapl = -1; /* File access property list */
int fd; /* POSIX file descriptor */
char filename[FILENAME_LEN]; /* Filename to use */
ssize_t nbytes; /* Number of bytes written */
unsigned u; /* Local index variable */
unsigned char buf[1024]; /* Buffer of data to write */
htri_t status; /* Whether a file is an HDF5 file */
hbool_t single_file_vfd; /* Whether VFD used is a single file */
herr_t ret;
hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
int fd; /* POSIX file descriptor */
char filename[FILENAME_LEN]; /* Filename to use */
char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
ssize_t nbytes; /* Number of bytes written */
unsigned u; /* Local index variable */
unsigned char buf[1024]; /* Buffer of data to write */
htri_t is_hdf5; /* Whether a file is an HDF5 file */
int posix_ret; /* Return value from POSIX calls */
herr_t ret; /* Return value from HDF5 calls */
/* Output message about test being performed */
MESSAGE(5, ("Testing Detection of HDF5 Files\n"));
/* Get FAPL */
fapl = h5_fileaccess();
CHECK(fapl, FAIL, "H5Pcreate");
h5_fixname(FILE1, fapl, filename, sizeof filename);
fapl_id = h5_fileaccess();
CHECK(fapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Fix up filenames
* For VFDs that create multiple files, we also need the name
* of the file with the superblock. With single-file VFDs, this
* will be equal to the one from h5_fixname().
*/
h5_fixname(FILE_IS_ACCESSIBLE, fapl_id, filename, sizeof(filename));
h5_fixname_superblock(FILE_IS_ACCESSIBLE, fapl_id, sb_filename, sizeof(filename));
/****************/
/* Normal usage */
/****************/
/* Create a file */
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid, FAIL, "H5Fcreate");
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Verify that the file is an HDF5 file */
status = H5Fis_accessible(filename, fapl);
VERIFY(status, TRUE, "H5Fis_accessible");
is_hdf5 = H5Fis_accessible(filename, fapl_id);
VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
/*******************************/
/* Non-default user block size */
/*******************************/
/* This test is not currently working for the family VFD */
/* This test is not currently working for the family VFD.
* There are failures when creating files with userblocks.
*/
if(0 != HDstrcmp(env_h5_drvr, "family")) {
/* Create a file creation property list with a non-default user block size */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl_id, FAIL, "H5Pcreate");
CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate");
ret = H5Pset_userblock(fcpl_id, (hsize_t)2048);
CHECK(ret, FAIL, "H5Pset_userblock");
/* Create file with non-default user block */
fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl);
CHECK(fid, FAIL, "H5Fcreate");
fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Release file-creation property list */
ret = H5Pclose(fcpl_id);
@ -1652,37 +1670,56 @@ test_file_is_accessible(const char *env_h5_drvr)
CHECK(ret, FAIL, "H5Fclose");
/* Verify that the file is an HDF5 file */
status = H5Fis_accessible(filename, fapl);
VERIFY(status, TRUE, "H5Fis_accessible");
is_hdf5 = H5Fis_accessible(filename, fapl_id);
VERIFY(is_hdf5, TRUE, "H5Fis_accessible");
} /* end if */
/***********************/
/* EMPTY non-HDF5 file */
/***********************/
/* This test only works for VFDs with a single file */
single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
if(single_file_vfd) {
/* Create non-HDF5 file and check it */
fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW);
CHECK(fd, FAIL, "HDopen");
/* Create non-HDF5 file and check it */
fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
CHECK(fd, (-1), "HDopen");
/* Initialize information to write */
for (u=0; u<1024; u++)
buf[u]=(unsigned char)u;
/* Close the file */
posix_ret = HDclose(fd);
CHECK(posix_ret, (-1), "HDclose");
/* Write some information */
nbytes = HDwrite(fd, buf, (size_t)1024);
VERIFY(nbytes, 1024, "HDwrite");
/* Verify that the file is NOT an HDF5 file */
is_hdf5 = H5Fis_accessible(filename, fapl_id);
VERIFY(is_hdf5, FALSE, "H5Fis_accessible (empty non-HDF5 file)");
/* Close the file */
ret = HDclose(fd);
CHECK(ret, FAIL, "HDclose");
/***************************/
/* Non-empty non-HDF5 file */
/***************************/
/* Verify that the file is not an HDF5 file */
status = H5Fis_accessible(filename, fapl);
VERIFY(status, FALSE, "H5Fis_accessible");
} /* end if */
/* Create non-HDF5 file and check it */
fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
CHECK(fd, (-1), "HDopen");
/* Initialize information to write */
for (u = 0; u < 1024; u++)
buf[u]=(unsigned char)u;
/* Write some information */
nbytes = HDwrite(fd, buf, (size_t)1024);
VERIFY(nbytes, 1024, "HDwrite");
/* Close the file */
posix_ret = HDclose(fd);
CHECK(posix_ret, (-1), "HDclose");
/* Verify that the file is not an HDF5 file */
is_hdf5 = H5Fis_accessible(filename, fapl_id);
VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)");
/* Clean up files */
h5_delete_test_file(filename, fapl_id);
/* Close property list */
ret = H5Pclose(fapl);
ret = H5Pclose(fapl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end test_file_is_accessible() */
@ -1697,70 +1734,97 @@ test_file_is_accessible(const char *env_h5_drvr)
*****************************************************************/
#ifndef H5_NO_DEPRECATED_SYMBOLS
static void
test_file_ishdf5(void)
test_file_ishdf5(const char *env_h5_drvr)
{
hid_t file; /* File opened with read-write permission */
hid_t fcpl; /* File creation property list */
hid_t fapl = -1; /* File access property list */
int fd; /* File Descriptor */
char filename[FILENAME_LEN]; /* Filename to use */
ssize_t nbytes; /* Number of bytes written */
unsigned u; /* Local index variable */
unsigned char buf[1024]; /* Buffer of data to write */
htri_t status; /* Whether a file is an HDF5 file */
herr_t ret;
hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */
hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */
hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
int fd; /* POSIX file descriptor */
char filename[FILENAME_LEN]; /* Filename to use */
char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */
ssize_t nbytes; /* Number of bytes written */
unsigned u; /* Local index variable */
unsigned char buf[1024]; /* Buffer of data to write */
htri_t is_hdf5; /* Whether a file is an HDF5 file */
int posix_ret; /* Return value from POSIX calls */
herr_t ret; /* Return value from HDF5 calls */
/* Output message about test being performed */
MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n"));
/* Get FAPL */
fapl = h5_fileaccess();
CHECK(fapl, FAIL, "H5Pcreate");
h5_fixname(FILE1, fapl, filename, sizeof filename);
fapl_id = h5_fileaccess();
CHECK(fapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Fix up filenames
* For VFDs that create multiple files, we also need the name
* of the file with the superblock. With single-file VFDs, this
* will be equal to the one from h5_fixname().
*/
h5_fixname(FILE_IS_ACCESSIBLE, fapl_id, filename, sizeof(filename));
h5_fixname_superblock(FILE_IS_ACCESSIBLE, fapl_id, sb_filename, sizeof(filename));
/****************/
/* Normal usage */
/****************/
/* Create a file */
file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Close file */
ret = H5Fclose(file);
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Verify that the file is an HDF5 file */
status = H5Fis_hdf5(filename);
VERIFY(status, TRUE, "H5Fis_hdf5");
is_hdf5 = H5Fis_hdf5(sb_filename);
VERIFY(is_hdf5, TRUE, "H5Fis_hdf5");
/*******************************/
/* Non-default user block size */
/*******************************/
/* Create a file creation property list with a non-default user block size */
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
/* This test is not currently working for the family VFD.
* There are failures when creating files with userblocks.
*/
if(0 != HDstrcmp(env_h5_drvr, "family")) {
/* Create a file creation property list with a non-default user block size */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate");
ret = H5Pset_userblock(fcpl, (hsize_t)2048);
CHECK(ret, FAIL, "H5Pset_userblock");
ret = H5Pset_userblock(fcpl_id, (hsize_t)2048);
CHECK(ret, FAIL, "H5Pset_userblock");
/* Create file with non-default user block */
file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(file, FAIL, "H5Fcreate");
/* Create file with non-default user block */
fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Release file-creation property list */
ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
/* Release file creation property list */
ret = H5Pclose(fcpl_id);
CHECK(ret, FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
/* Verify that the file is an HDF5 file */
status = H5Fis_hdf5(filename);
VERIFY(status, TRUE, "H5Fis_hdf5");
/* Verify that the file is an HDF5 file */
is_hdf5 = H5Fis_hdf5(sb_filename);
VERIFY(is_hdf5, TRUE, "H5Fis_hdf5");
} /* end if */
/***************************/
/* Non-empty non-HDF5 file */
/***************************/
/* Create non-HDF5 file and check it */
fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW);
CHECK(fd, FAIL, "HDopen");
/* Create non-HDF5 file. Use the calculated superblock
* filename to avoid the format strings that will make
* open(2) sad.
*/
fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
CHECK(fd, (-1), "HDopen");
/* Initialize information to write */
for(u=0; u<1024; u++)
for(u = 0; u < 1024; u++)
buf[u]=(unsigned char)u;
/* Write some information */
@ -1768,15 +1832,19 @@ test_file_ishdf5(void)
VERIFY(nbytes, 1024, "HDwrite");
/* Close the file */
ret = HDclose(fd);
CHECK(ret, FAIL, "HDclose");
posix_ret = HDclose(fd);
CHECK(posix_ret, (-1), "HDclose");
/* Verify that the file is not an HDF5 file */
status = H5Fis_hdf5(filename);
VERIFY(status, FALSE, "H5Fis_hdf5");
is_hdf5 = H5Fis_hdf5(sb_filename);
VERIFY(is_hdf5, FALSE, "H5Fis_hdf5");
/* Clean up files */
h5_delete_test_file(filename, fapl_id);
/* Close property list */
ret = H5Pclose(fapl);
ret = H5Pclose(fapl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end test_file_ishdf5() */
@ -7537,7 +7605,6 @@ test_deprec(void)
void
test_file(void)
{
hbool_t single_file_vfd; /* Whether VFD used is a single file */
const char *env_h5_drvr; /* File Driver value from environment */
/* Output message about test being performed */
@ -7547,7 +7614,6 @@ test_file(void)
env_h5_drvr = HDgetenv("HDF5_DRIVER");
if(env_h5_drvr == NULL)
env_h5_drvr = "nomatch";
single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"));
test_file_create(); /* Test file creation(also creation templates)*/
test_file_open(); /* Test file opening */
@ -7593,10 +7659,7 @@ test_file(void)
test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */
test_min_dset_ohdr(); /* Test datset object header minimization */
#ifndef H5_NO_DEPRECATED_SYMBOLS
if(single_file_vfd)
test_file_ishdf5(); /* Test detecting HDF5 files correctly */
else
MESSAGE(5, ("Skipping testing detection of HDF5 Files (using deprecated H5Fis_hdf5() call for non-single file VFDs)\n"));
test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */
test_deprec(); /* Test deprecated routines */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* test_file() */

File diff suppressed because it is too large Load Diff

View File

@ -61,6 +61,7 @@ static const H5VL_class_t fake_vol_g = {
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
NULL, /* unwrap_object */
NULL, /* free_wrap_ctx */
},
{ /* attribute_cls */

View File

@ -25,10 +25,25 @@ add_test (NAME MPI_TEST-clear-testphdf5-objects
)
set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5)
set (SKIP_tests
cchunk1
cchunk2
cchunk3
cchunk4
ecdsetw
eidsetw2
selnone
cngrpw-ingrpr
cschunkw
ccchunkw
tldsc
actualio
MC_coll_MD_read
)
set (SKIP_testphdf5 "")
#if (HDF5_OPENMPI_VERSION_SKIP)
# set (SKIP_testphdf5 "${SKIP_testphdf5};-x;ecdsetw")
#endif ()
foreach (skiptest ${SKIP_tests})
set (SKIP_testphdf5 "${SKIP_testphdf5};-x;${skiptest}")
endforeach ()
add_test (NAME MPI_TEST_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS} ${SKIP_testphdf5})
set_tests_properties (MPI_TEST_testphdf5 PROPERTIES
@ -41,6 +56,20 @@ if (last_test)
endif ()
set (last_test "MPI_TEST_testphdf5")
#execute the skipped tests
foreach (skiptest ${SKIP_tests})
add_test (NAME MPI_TEST_testphdf5_${skiptest} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS} -o ${skiptest})
set_tests_properties (MPI_TEST_testphdf5_${skiptest} PROPERTIES
FIXTURES_REQUIRED par_clear_testphdf5
ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
)
if (last_test)
set_tests_properties (MPI_TEST_testphdf5_${skiptest} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "MPI_TEST_testphdf5_${skiptest}")
endforeach ()
#if (HDF5_OPENMPI_VERSION_SKIP)
# list (REMOVE_ITEM H5P_TESTS t_shapesame)
#endif ()

View File

@ -838,6 +838,13 @@ void dataset_fillvalue(void)
HDfree(wdata);
}
/* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */
void collective_group_write_independent_group_read(void)
{
collective_group_write();
independent_group_read();
}
/* Write multiple groups with a chunked dataset in each group collectively.
* These groups and datasets are for testing independent read later.
*

View File

@ -26,15 +26,15 @@ int dim0;
int dim1;
int chunkdim0;
int chunkdim1;
int nerrors = 0; /* errors count */
int ndatasets = 300; /* number of datasets to create*/
int nerrors = 0; /* errors count */
int ndatasets = 300; /* number of datasets to create*/
int ngroups = 512; /* number of groups to create in root
* group. */
int facc_type = FACC_MPIO; /*Test file access type */
int facc_type = FACC_MPIO; /*Test file access type */
int dxfer_coll_type = DXFER_COLLECTIVE_IO;
H5E_auto2_t old_func; /* previous error handler */
void *old_client_data; /* previous error handler arg.*/
H5E_auto2_t old_func; /* previous error handler */
void *old_client_data; /* previous error handler arg.*/
/* other option flags */
@ -46,10 +46,10 @@ void *old_client_data; /* previous error handler arg.*/
#define NFILENAME 2
#define PARATESTFILE filenames[0]
const char *FILENAME[NFILENAME]={
"ParaTest",
NULL};
char filenames[NFILENAME][PATH_MAX];
hid_t fapl; /* file access property list */
"ParaTest",
NULL};
char filenames[NFILENAME][PATH_MAX];
hid_t fapl; /* file access property list */
#ifdef USE_PAUSE
/* pause the process for a moment to allow debugger to attach if desired. */
@ -62,7 +62,7 @@ void pause_proc(void)
{
int pid;
h5_stat_t statbuf;
h5_stat_t statbuf;
char greenlight[] = "go";
int maxloop = 10;
int loops = 0;
@ -80,14 +80,14 @@ void pause_proc(void)
if (MAINPROCESS)
while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){
if (!loops++){
printf("Proc %d (%*s, %d): to debug, attach %d\n",
mpi_rank, mpi_namelen, mpi_name, pid, pid);
}
printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
fflush(stdout);
if (!loops++){
printf("Proc %d (%*s, %d): to debug, attach %d\n",
mpi_rank, mpi_namelen, mpi_name, pid, pid);
}
printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
fflush(stdout);
HDsleep(time_int);
}
}
MPI_Barrier(MPI_COMM_WORLD);
}
@ -99,7 +99,7 @@ int MPI_Init(int *argc, char ***argv)
pause_proc();
return (ret_code);
}
#endif /* USE_PAUSE */
#endif /* USE_PAUSE */
/*
@ -109,15 +109,15 @@ static void
usage(void)
{
printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
"[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
"[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
printf("\t-m<n_datasets>"
"\tset number of datasets for the multiple dataset test\n");
"\tset number of datasets for the multiple dataset test\n");
printf("\t-n<n_groups>"
"\tset number of groups for the multiple group test\n");
printf("\t-f <prefix>\tfilename prefix\n");
printf("\t-2\t\tuse Split-file together with MPIO\n");
printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n",
ROW_FACTOR, COL_FACTOR);
ROW_FACTOR, COL_FACTOR);
printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
printf("\n");
}
@ -129,7 +129,7 @@ usage(void)
static int
parse_options(int argc, char **argv)
{
int mpi_size, mpi_rank; /* mpi variables */
int mpi_size, mpi_rank; /* mpi variables */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@ -140,107 +140,107 @@ parse_options(int argc, char **argv)
chunkdim1 = (dim1+9)/10;
while (--argc){
if (**(++argv) != '-'){
break;
}else{
switch(*(*argv+1)){
case 'm': ndatasets = atoi((*argv+1)+1);
if (ndatasets < 0){
nerrors++;
return(1);
}
break;
case 'n': ngroups = atoi((*argv+1)+1);
if (ngroups < 0){
if (**(++argv) != '-'){
break;
}else{
switch(*(*argv+1)){
case 'm': ndatasets = atoi((*argv+1)+1);
if (ndatasets < 0){
nerrors++;
return(1);
}
break;
case 'n': ngroups = atoi((*argv+1)+1);
if (ngroups < 0){
nerrors++;
return(1);
}
}
break;
case 'f': if (--argc < 1) {
nerrors++;
return(1);
}
if (**(++argv) == '-') {
nerrors++;
return(1);
}
paraprefix = *argv;
break;
case 'i': /* Collective MPI-IO access with independent IO */
dxfer_coll_type = DXFER_INDEPENDENT_IO;
break;
case '2': /* Use the split-file driver with MPIO access */
/* Can use $HDF5_METAPREFIX to define the */
/* meta-file-prefix. */
facc_type = FACC_MPIO | FACC_SPLIT;
break;
case 'd': /* dimensizes */
if (--argc < 2){
nerrors++;
return(1);
}
dim0 = atoi(*(++argv))*mpi_size;
argc--;
dim1 = atoi(*(++argv))*mpi_size;
/* set default chunkdim sizes too */
chunkdim0 = (dim0+9)/10;
chunkdim1 = (dim1+9)/10;
break;
case 'c': /* chunk dimensions */
if (--argc < 2){
nerrors++;
return(1);
}
chunkdim0 = atoi(*(++argv));
argc--;
chunkdim1 = atoi(*(++argv));
break;
case 'h': /* print help message--return with nerrors set */
return(1);
default: printf("Illegal option(%s)\n", *argv);
nerrors++;
return(1);
}
}
case 'f': if (--argc < 1) {
nerrors++;
return(1);
}
if (**(++argv) == '-') {
nerrors++;
return(1);
}
paraprefix = *argv;
break;
case 'i': /* Collective MPI-IO access with independent IO */
dxfer_coll_type = DXFER_INDEPENDENT_IO;
break;
case '2': /* Use the split-file driver with MPIO access */
/* Can use $HDF5_METAPREFIX to define the */
/* meta-file-prefix. */
facc_type = FACC_MPIO | FACC_SPLIT;
break;
case 'd': /* dimensizes */
if (--argc < 2){
nerrors++;
return(1);
}
dim0 = atoi(*(++argv))*mpi_size;
argc--;
dim1 = atoi(*(++argv))*mpi_size;
/* set default chunkdim sizes too */
chunkdim0 = (dim0+9)/10;
chunkdim1 = (dim1+9)/10;
break;
case 'c': /* chunk dimensions */
if (--argc < 2){
nerrors++;
return(1);
}
chunkdim0 = atoi(*(++argv));
argc--;
chunkdim1 = atoi(*(++argv));
break;
case 'h': /* print help message--return with nerrors set */
return(1);
default: printf("Illegal option(%s)\n", *argv);
nerrors++;
return(1);
}
}
} /*while*/
/* check validity of dimension and chunk sizes */
if (dim0 <= 0 || dim1 <= 0){
printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
nerrors++;
return(1);
printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
nerrors++;
return(1);
}
if (chunkdim0 <= 0 || chunkdim1 <= 0){
printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
nerrors++;
return(1);
printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
nerrors++;
return(1);
}
/* Make sure datasets can be divided into equal portions by the processes */
if ((dim0 % mpi_size) || (dim1 % mpi_size)){
if (MAINPROCESS)
printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
dim0, dim1, mpi_size);
nerrors++;
return(1);
if (MAINPROCESS)
printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
dim0, dim1, mpi_size);
nerrors++;
return(1);
}
/* compose the test filenames */
{
int i, n;
int i, n;
n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
for (i=0; i < n; i++)
if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
== NULL){
printf("h5_fixname failed\n");
nerrors++;
return(1);
}
printf("Test filenames are:\n");
for (i=0; i < n; i++)
printf(" %s\n", filenames[i]);
for (i=0; i < n; i++)
if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
== NULL){
printf("h5_fixname failed\n");
nerrors++;
return(1);
}
printf("Test filenames are:\n");
for (i=0; i < n; i++)
printf(" %s\n", filenames[i]);
}
return(0);
@ -255,7 +255,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
{
hid_t ret_pl = -1;
herr_t ret; /* generic return value */
int mpi_rank; /* mpi variables */
int mpi_rank; /* mpi variables */
/* need the rank for error checking macros */
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@ -264,36 +264,36 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");
if (l_facc_type == FACC_DEFAULT)
return (ret_pl);
return (ret_pl);
if (l_facc_type == FACC_MPIO){
/* set Parallel access with communicator */
ret = H5Pset_fapl_mpio(ret_pl, comm, info);
VRFY((ret >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_fapl_mpio(ret_pl, comm, info);
VRFY((ret >= 0), "");
ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE);
VRFY((ret >= 0), "");
VRFY((ret >= 0), "");
ret = H5Pset_coll_metadata_write(ret_pl, TRUE);
VRFY((ret >= 0), "");
return(ret_pl);
VRFY((ret >= 0), "");
return(ret_pl);
}
if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){
hid_t mpio_pl;
hid_t mpio_pl;
mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((mpio_pl >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
VRFY((ret >= 0), "");
mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((mpio_pl >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
VRFY((ret >= 0), "");
/* setup file access template */
ret_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((ret_pl >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
H5Pclose(mpio_pl);
return(ret_pl);
/* setup file access template */
ret_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((ret_pl >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
H5Pclose(mpio_pl);
return(ret_pl);
}
/* unknown file access types */
@ -303,7 +303,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
int main(int argc, char **argv)
{
int mpi_size, mpi_rank; /* mpi variables */
int mpi_size, mpi_rank; /* mpi variables */
H5Ptest_param_t ndsets_params, ngroups_params;
H5Ptest_param_t collngroups_params;
H5Ptest_param_t io_mode_confusion_params;
@ -323,9 +323,9 @@ int main(int argc, char **argv)
dim1 = COL_FACTOR*mpi_size;
if (MAINPROCESS){
printf("===================================\n");
printf("PHDF5 TESTS START\n");
printf("===================================\n");
printf("===================================\n");
printf("PHDF5 TESTS START\n");
printf("===================================\n");
}
/* Attempt to turn off atexit post processing so that in case errors
@ -334,7 +334,7 @@ int main(int argc, char **argv)
* calls. By then, MPI calls may not work.
*/
if (H5dont_atexit() < 0){
printf("Failed to turn off atexit processing. Continue.\n");
printf("Failed to turn off atexit processing. Continue.\n");
};
H5open();
h5_show_hostname();
@ -344,10 +344,10 @@ int main(int argc, char **argv)
/* Tests are generally arranged from least to most complexity... */
AddTest("mpiodup", test_fapl_mpio_dup, NULL,
"fapl_mpio duplicate", NULL);
"fapl_mpio duplicate", NULL);
AddTest("split", test_split_comm_access, NULL,
"dataset using split communicators", PARATESTFILE);
"dataset using split communicators", PARATESTFILE);
#ifdef PB_OUT /* temporary: disable page buffering when parallel */
AddTest("page_buffer", test_page_buffer_access, NULL,
@ -355,64 +355,64 @@ int main(int argc, char **argv)
#endif
AddTest("props", test_file_properties, NULL,
"Coll Metadata file property settings", PARATESTFILE);
"Coll Metadata file property settings", PARATESTFILE);
AddTest("idsetw", dataset_writeInd, NULL,
"dataset independent write", PARATESTFILE);
"dataset independent write", PARATESTFILE);
AddTest("idsetr", dataset_readInd, NULL,
"dataset independent read", PARATESTFILE);
"dataset independent read", PARATESTFILE);
AddTest("cdsetw", dataset_writeAll, NULL,
"dataset collective write", PARATESTFILE);
"dataset collective write", PARATESTFILE);
AddTest("cdsetr", dataset_readAll, NULL,
"dataset collective read", PARATESTFILE);
"dataset collective read", PARATESTFILE);
AddTest("eidsetw", extend_writeInd, NULL,
"extendible dataset independent write", PARATESTFILE);
"extendible dataset independent write", PARATESTFILE);
AddTest("eidsetr", extend_readInd, NULL,
"extendible dataset independent read", PARATESTFILE);
"extendible dataset independent read", PARATESTFILE);
AddTest("ecdsetw", extend_writeAll, NULL,
"extendible dataset collective write", PARATESTFILE);
"extendible dataset collective write", PARATESTFILE);
AddTest("ecdsetr", extend_readAll, NULL,
"extendible dataset collective read", PARATESTFILE);
"extendible dataset collective read", PARATESTFILE);
AddTest("eidsetw2", extend_writeInd2, NULL,
"extendible dataset independent write #2", PARATESTFILE);
"extendible dataset independent write #2", PARATESTFILE);
AddTest("selnone", none_selection_chunk, NULL,
"chunked dataset with none-selection", PARATESTFILE);
AddTest("calloc", test_chunk_alloc, NULL,
"parallel extend Chunked allocation on serial file", PARATESTFILE);
AddTest("fltread", test_filter_read, NULL,
"parallel read of dataset written serially with filters", PARATESTFILE);
"parallel read of dataset written serially with filters", PARATESTFILE);
#ifdef H5_HAVE_FILTER_DEFLATE
AddTest("cmpdsetr", compress_readAll, NULL,
"compressed dataset collective read", PARATESTFILE);
"compressed dataset collective read", PARATESTFILE);
#endif /* H5_HAVE_FILTER_DEFLATE */
AddTest("zerodsetr", zero_dim_dset, NULL,
"zero dim dset", PARATESTFILE);
"zero dim dset", PARATESTFILE);
ndsets_params.name = PARATESTFILE;
ndsets_params.count = ndatasets;
AddTest("ndsetw", multiple_dset_write, NULL,
"multiple datasets write", &ndsets_params);
"multiple datasets write", &ndsets_params);
ngroups_params.name = PARATESTFILE;
ngroups_params.count = ngroups;
AddTest("ngrpw", multiple_group_write, NULL,
"multiple groups write", &ngroups_params);
"multiple groups write", &ngroups_params);
AddTest("ngrpr", multiple_group_read, NULL,
"multiple groups read", &ngroups_params);
"multiple groups read", &ngroups_params);
AddTest("compact", compact_dataset, NULL,
"compact dataset test", PARATESTFILE);
"compact dataset test", PARATESTFILE);
collngroups_params.name = PARATESTFILE;
collngroups_params.count = ngroups;
AddTest("cngrpw", collective_group_write, NULL,
"collective group and dataset write", &collngroups_params);
AddTest("ingrpr", independent_group_read, NULL,
"independent group and dataset read", &collngroups_params);
/* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */
AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL,
"collective grp/dset write - independent grp/dset read",
&collngroups_params);
#ifndef H5_HAVE_WIN32_API
AddTest("bigdset", big_dataset, NULL,
"big dataset test", PARATESTFILE);
@ -420,71 +420,71 @@ int main(int argc, char **argv)
printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n");
#endif
AddTest("fill", dataset_fillvalue, NULL,
"dataset fill value", PARATESTFILE);
"dataset fill value", PARATESTFILE);
AddTest("cchunk1",
coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
AddTest("cchunk2",
coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
AddTest("cchunk3",
coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
AddTest("cchunk4",
coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE);
if((mpi_size < 3)&& MAINPROCESS ) {
printf("Collective chunk IO optimization APIs ");
printf("needs at least 3 processes to participate\n");
printf("Collective chunk IO API tests will be skipped \n");
printf("Collective chunk IO optimization APIs ");
printf("needs at least 3 processes to participate\n");
printf("Collective chunk IO API tests will be skipped \n");
}
AddTest((mpi_size <3)? "-cchunk5":"cchunk5" ,
coll_chunk5,NULL,
"linked chunk collective IO without optimization",PARATESTFILE);
"linked chunk collective IO without optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6",
coll_chunk6,NULL,
"multi-chunk collective IO with direct request",PARATESTFILE);
coll_chunk6,NULL,
"multi-chunk collective IO with direct request",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7",
coll_chunk7,NULL,
"linked chunk collective IO with optimization",PARATESTFILE);
coll_chunk7,NULL,
"linked chunk collective IO with optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8",
coll_chunk8,NULL,
"linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
coll_chunk8,NULL,
"linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9",
coll_chunk9,NULL,
"multiple chunk collective IO with optimization",PARATESTFILE);
coll_chunk9,NULL,
"multiple chunk collective IO with optimization",PARATESTFILE);
AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10",
coll_chunk10,NULL,
"multiple chunk collective IO transferring to independent IO",PARATESTFILE);
coll_chunk10,NULL,
"multiple chunk collective IO transferring to independent IO",PARATESTFILE);
/* irregular collective IO tests*/
AddTest("ccontw",
coll_irregular_cont_write,NULL,
"collective irregular contiguous write",PARATESTFILE);
coll_irregular_cont_write,NULL,
"collective irregular contiguous write",PARATESTFILE);
AddTest("ccontr",
coll_irregular_cont_read,NULL,
"collective irregular contiguous read",PARATESTFILE);
coll_irregular_cont_read,NULL,
"collective irregular contiguous read",PARATESTFILE);
AddTest("cschunkw",
coll_irregular_simple_chunk_write,NULL,
"collective irregular simple chunk write",PARATESTFILE);
coll_irregular_simple_chunk_write,NULL,
"collective irregular simple chunk write",PARATESTFILE);
AddTest("cschunkr",
coll_irregular_simple_chunk_read,NULL,
"collective irregular simple chunk read",PARATESTFILE);
coll_irregular_simple_chunk_read,NULL,
"collective irregular simple chunk read",PARATESTFILE);
AddTest("ccchunkw",
coll_irregular_complex_chunk_write,NULL,
"collective irregular complex chunk write",PARATESTFILE);
coll_irregular_complex_chunk_write,NULL,
"collective irregular complex chunk write",PARATESTFILE);
AddTest("ccchunkr",
coll_irregular_complex_chunk_read,NULL,
"collective irregular complex chunk read",PARATESTFILE);
coll_irregular_complex_chunk_read,NULL,
"collective irregular complex chunk read",PARATESTFILE);
AddTest("null", null_dataset, NULL,
"null dataset test", PARATESTFILE);
"null dataset test", PARATESTFILE);
io_mode_confusion_params.name = PARATESTFILE;
io_mode_confusion_params.count = 0; /* value not used */
AddTest("I/Omodeconf", io_mode_confusion, NULL,
"I/O mode confusion test -- hangs quickly on failure",
"I/O mode confusion test -- hangs quickly on failure",
&io_mode_confusion_params);
if((mpi_size < 3) && MAINPROCESS) {
@ -506,12 +506,12 @@ int main(int argc, char **argv)
AddTest("tldsc",
lower_dim_size_comp_test, NULL,
"test lower dim size comp in span tree to mpi derived type",
"test lower dim size comp in span tree to mpi derived type",
PARATESTFILE);
AddTest("lccio",
link_chunk_collective_io_test, NULL,
"test mpi derived type management",
"test mpi derived type management",
PARATESTFILE);
AddTest("actualio", actual_io_mode_tests, NULL,
@ -523,7 +523,7 @@ int main(int argc, char **argv)
PARATESTFILE);
AddTest("edpl", test_plist_ed, NULL,
"encode/decode Property Lists", NULL);
"encode/decode Property Lists", NULL);
if((mpi_size < 2) && MAINPROCESS) {
printf("File Image Ops daisy chain test needs at least 2 processes.\n");
@ -533,11 +533,11 @@ int main(int argc, char **argv)
"file image ops daisy chain", NULL);
if((mpi_size < 2)&& MAINPROCESS ) {
printf("Atomicity tests need at least 2 processes to participate\n");
printf("8 is more recommended.. Atomicity tests will be skipped \n");
printf("Atomicity tests need at least 2 processes to participate\n");
printf("8 is more recommended.. Atomicity tests will be skipped \n");
}
else if (facc_type != FACC_MPIO && MAINPROCESS) {
printf("Atomicity tests will not work with a non MPIO VFD\n");
printf("Atomicity tests will not work with a non MPIO VFD\n");
}
else if(mpi_size >= 2 && facc_type == FACC_MPIO){
AddTest("atomicity", dataset_atomicity, NULL,
@ -545,13 +545,13 @@ int main(int argc, char **argv)
}
AddTest("denseattr", test_dense_attr, NULL,
"Store Dense Attributes", PARATESTFILE);
"Store Dense Attributes", PARATESTFILE);
AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL,
"Collective Metadata read with some ranks having no selection", PARATESTFILE);
AddTest("MC coll MD read", test_multi_chunk_io_addrmap_issue, NULL,
AddTest("MC_coll_MD_read", test_multi_chunk_io_addrmap_issue, NULL,
"Collective MD read with multi chunk I/O (H5D__chunk_addrmap)", PARATESTFILE);
AddTest("LC coll MD read", test_link_chunk_io_sort_chunk_issue, NULL,
AddTest("LC_coll_MD_read", test_link_chunk_io_sort_chunk_issue, NULL,
"Collective MD read with link chunk I/O (H5D__sort_chunk)", PARATESTFILE);
/* Display testing information */
@ -565,9 +565,9 @@ int main(int argc, char **argv)
TestParseCmdLine(argc, argv);
if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){
printf("===================================\n"
" Using Independent I/O with file set view to replace collective I/O \n"
"===================================\n");
printf("===================================\n"
" Using Independent I/O with file set view to replace collective I/O \n"
"===================================\n");
}
@ -592,16 +592,16 @@ int main(int argc, char **argv)
{
int temp;
MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
nerrors=temp;
nerrors=temp;
}
if (MAINPROCESS){ /* only process 0 reports */
printf("===================================\n");
if (nerrors)
printf("***PHDF5 tests detected %d errors***\n", nerrors);
else
printf("PHDF5 tests finished with no errors\n");
printf("===================================\n");
if (MAINPROCESS){ /* only process 0 reports */
printf("===================================\n");
if (nerrors)
printf("***PHDF5 tests detected %d errors***\n", nerrors);
else
printf("PHDF5 tests finished with no errors\n");
printf("===================================\n");
}
/* close HDF5 library */

View File

@ -240,6 +240,7 @@ void test_file_properties(void);
void multiple_dset_write(void);
void multiple_group_write(void);
void multiple_group_read(void);
void collective_group_write_independent_group_read(void);
void collective_group_write(void);
void independent_group_read(void);
void test_fapl_mpio_dup(void);

View File

@ -11,7 +11,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
PARAMS { 9 1 11 5 }
PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
PARAMS { 9 1 11 5 }
PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
PARAMS { 9 1 11 5 }
PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
PARAMS { 9 1 11 5 }
PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
PARAMS { 9 1 11 5 }
PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
PARAMS { 9 1 11 5 }
PARAMS { 9 1 11 6 }
}
}
FILLVALUE {
@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
PARAMS { 9 1 11 5 }
PARAMS { 9 1 11 6 }
}
}
FILLVALUE {