summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-02-24 19:54:48 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-02-24 19:54:48 (GMT)
commit28111339143e6c3f9aa8d4f96c771472a1a79c55 (patch)
tree76000c9a80ce336f86cdf85d4d0cf01fc34464ac
parent80e77e7d778ea5d5bfcfc92f9492cdfdc1dd0197 (diff)
downloadhdf5-28111339143e6c3f9aa8d4f96c771472a1a79c55.zip
hdf5-28111339143e6c3f9aa8d4f96c771472a1a79c55.tar.gz
hdf5-28111339143e6c3f9aa8d4f96c771472a1a79c55.tar.bz2
[svn-r26293] Implement patching of virtual dataspace extent in mapping dataspaces when
opening virtual dataset. Add tests for this. Tested: ummon
-rw-r--r--src/H5Dlayout.c10
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5S.c43
-rw-r--r--src/H5Spkg.h2
-rw-r--r--src/H5Sprivate.h1
-rw-r--r--test/vds.c37
6 files changed, 73 insertions, 24 deletions
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 5929163..c0e1b20 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -449,6 +449,16 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
break;
case H5D_VIRTUAL:
+ {
+ size_t i;
+
+ HDassert(!dataset->shared->layout.storage.u.virt.list == (dataset->shared->layout.storage.u.virt.list_nused == 0));
+
+ /* Patch the virtual selection dataspaces */
+ for(i = 0; i < dataset->shared->layout.storage.u.virt.list_nused; i++)
+ if(H5S_extent_copy(dataset->shared->layout.storage.u.virt.list[i].virtual_select, dataset->shared->space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy virtual dataspace extent")
+ } /* end block */
break;
case H5D_LAYOUT_ERROR:
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 9ca8436..3be5b82 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -312,7 +312,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy extent information */
- if(H5S_extent_copy(dest, mesg, TRUE) < 0)
+ if(H5S_extent_copy_real(dest, mesg, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Set return value */
@@ -467,7 +467,7 @@ H5O_sdspace_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src,
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed")
/* Create a copy of the dataspace extent */
- if(H5S_extent_copy(udata->src_space_extent, src_space_extent, TRUE) < 0)
+ if(H5S_extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
} /* end if */
diff --git a/src/H5S.c b/src/H5S.c
index 7798049..106d75a 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -479,7 +479,7 @@ H5Sextent_copy(hid_t dst_id,hid_t src_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Copy */
- if(H5S_extent_copy(&(dst->extent), &(src->extent), TRUE) < 0)
+ if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
done:
@@ -488,7 +488,40 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_extent_copy
+ * Function: H5S_extent_copy
+ *
+ * Purpose: Copies a dataspace extent
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Monday, February 23, 2015
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_extent_copy(H5S_t *dst, const H5S_t *src)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(dst);
+ HDassert(src);
+
+ /* Copy */
+ if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_extent_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_extent_copy_real
*
* Purpose: Copies a dataspace extent
*
@@ -502,7 +535,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
+H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
{
unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
@@ -551,7 +584,7 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_extent_copy() */
+} /* end H5S_extent_copy_real() */
/*-------------------------------------------------------------------------
@@ -587,7 +620,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the source dataspace's extent */
- if(H5S_extent_copy(&(dst->extent), &(src->extent), copy_max) < 0)
+ if(H5S_extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Copy the source dataspace's selection */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 5f84717..f5511fb 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -245,7 +245,7 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1];
/* Extent functions */
H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent);
-H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src,
+H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
hbool_t copy_max);
/* Operations on selections */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 7b7b8c6..7cb5285 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -204,6 +204,7 @@ H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size);
H5_DLL hsize_t H5S_extent_nelem(const H5S_extent_t *ext);
H5_DLL int H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]);
H5_DLL htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2);
+H5_DLL herr_t H5S_extent_copy(H5S_t *dst, const H5S_t *src);
/* Operations on selections */
H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p);
diff --git a/test/vds.c b/test/vds.c
index a37f2b0..42f3f06 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -164,6 +164,7 @@ test_api(test_api_config_t config, hid_t fapl)
hid_t space_out = -1;
char name_out[32];
hsize_t blocklist[4];
+ htri_t tri_ret;
unsigned i;
switch(config) {
@@ -218,14 +219,6 @@ test_api(test_api_config_t config, hid_t fapl)
if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
TEST_ERROR
- /* Close dataspaces */
- if(H5Sclose(srcspace[0]) < 0)
- TEST_ERROR
- srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
- TEST_ERROR
- vspace[0] = -1;
-
/* Test H5Pget_virtual_count */
if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
@@ -235,6 +228,10 @@ test_api(test_api_config_t config, hid_t fapl)
/* Test H5Pget_virtual_vspace */
if((space_out = H5Pget_virtual_vspace(ex_dcpl, 0)) < 0)
TEST_ERROR
+ if((tri_ret = H5Sextent_equal(space_out, vspace[0])) < 0)
+ TEST_ERROR
+ if(!tri_ret)
+ TEST_ERROR
if(H5Sget_select_type(space_out) != H5S_SEL_ALL)
TEST_ERROR
if(H5Sclose(space_out) < 0)
@@ -277,6 +274,12 @@ test_api(test_api_config_t config, hid_t fapl)
TEST_ERROR
/* Close */
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
if(H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
@@ -333,14 +336,6 @@ test_api(test_api_config_t config, hid_t fapl)
if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
TEST_ERROR
- /* Close dataspaces */
- if(H5Sclose(srcspace[0]) < 0)
- TEST_ERROR
- srcspace[0] = -1;
- if(H5Sclose(vspace[0]) < 0)
- TEST_ERROR
- vspace[0] = -1;
-
/* Test H5Pget_virtual_count */
if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
@@ -352,6 +347,10 @@ test_api(test_api_config_t config, hid_t fapl)
/* Test H5Pget_virtual_vspace */
if((space_out = H5Pget_virtual_vspace(ex_dcpl, i)) < 0)
TEST_ERROR
+ if((tri_ret = H5Sextent_equal(space_out, vspace[0])) < 0)
+ TEST_ERROR
+ if(!tri_ret)
+ TEST_ERROR
if(H5Sget_select_type(space_out) != H5S_SEL_HYPERSLABS)
TEST_ERROR
if((ssize_out = H5Sget_select_hyper_nblocks(space_out)) < 0)
@@ -413,6 +412,12 @@ test_api(test_api_config_t config, hid_t fapl)
} /* end if */
/* Close */
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
if(H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;