summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2019-12-05 22:13:12 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2019-12-05 22:13:12 (GMT)
commit5efd80f6ec558845e7438a7407888de56da63588 (patch)
tree1aba6f2886fd76ed857b796f6391b5c15fc96a60 /src
parent8c9b8047ea6aafa8d2249238658d0c29724adb61 (diff)
parent12ac0587e7b9b18a56907aa78f68c084dd5b51b4 (diff)
downloadhdf5-5efd80f6ec558845e7438a7407888de56da63588.zip
hdf5-5efd80f6ec558845e7438a7407888de56da63588.tar.gz
hdf5-5efd80f6ec558845e7438a7407888de56da63588.tar.bz2
Merge pull request #2073 in HDFFV/hdf5 from ~NFORTNE2/hdf5_naf:vol_vl_buf_size to develop
* commit '12ac0587e7b9b18a56907aa78f68c084dd5b51b4': Implement support for using H5Dvlen_get_buf_size with non-native VOL connectors.
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c31
-rw-r--r--src/H5Dint.c2
-rw-r--r--src/H5Dpkg.h1
3 files changed, 26 insertions, 8 deletions
diff --git a/src/H5D.c b/src/H5D.c
index a2e6f0a..7c68127 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -736,7 +736,7 @@ herr_t
H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
hsize_t *size)
{
- H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0};
+ H5D_vlen_bufsize_t vlen_bufsize = {NULL, H5I_INVALID_HID, H5I_INVALID_HID, NULL, NULL, 0, H5P_DATASET_XFER_DEFAULT};
H5VL_object_t *vol_obj; /* Dataset for this operation */
H5S_t *mspace = NULL; /* Memory dataspace */
char bogus; /* bogus value to pass to H5Diterate() */
@@ -763,8 +763,6 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
/* Save the dataset */
vlen_bufsize.dset_vol_obj = vol_obj;
- vlen_bufsize.fspace_id = H5I_INVALID_HID;
- vlen_bufsize.mspace_id = H5I_INVALID_HID;
/* Get a copy of the dataset's dataspace */
if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
@@ -786,6 +784,22 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine")
+ /* If we are not using the native VOL connector we must also set this
+ * property on the DXPL since the context is not visible to the connector
+ * and will be ignored if the connector re-enters the library */
+ if(vol_obj->connector->cls->value != H5VL_NATIVE_VALUE) {
+ H5P_genplist_t *dxpl;
+
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL")
+ if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list");
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL")
+ if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL")
+ } /* end if */
+
/* Set the initial number of bytes required */
vlen_bufsize.size = 0;
@@ -805,14 +819,17 @@ done:
if(mspace && H5S_close(mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id")
- if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id")
+ if(vlen_bufsize.fspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id")
+ if(vlen_bufsize.mspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id")
if(vlen_bufsize.fl_tbuf != NULL)
vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf);
if(vlen_bufsize.vl_tbuf != NULL)
vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf);
+ if(vlen_bufsize.dxpl_id != H5P_DATASET_XFER_DEFAULT)
+ if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list")
FUNC_LEAVE_API(ret_value)
} /* end H5Dvlen_get_buf_size() */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 0acb030..c3d4398 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2639,7 +2639,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0)
+ if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index ff43880..02121e6 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -524,6 +524,7 @@ typedef struct {
void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
hsize_t size; /* Accumulated number of bytes for the selection */
+ hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */
} H5D_vlen_bufsize_t;