summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2019-10-10 01:05:48 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2019-10-10 01:22:45 (GMT)
commit54d149061f36eaadf5308839a3627f9158d24458 (patch)
tree03a411c3634a7f0a4415dacc81f61c58462f1bb4 /src
parent35062073449be67956c3df0a4c6f56cad05e63bf (diff)
downloadhdf5-54d149061f36eaadf5308839a3627f9158d24458.zip
hdf5-54d149061f36eaadf5308839a3627f9158d24458.tar.gz
hdf5-54d149061f36eaadf5308839a3627f9158d24458.tar.bz2
Unify code between H5Lcopy and H5Lmove
Diffstat (limited to 'src')
-rw-r--r--src/H5L.c17
-rw-r--r--src/H5VLcallback.c6
2 files changed, 14 insertions, 9 deletions
diff --git a/src/H5L.c b/src/H5L.c
index 24836d2..1e554a9 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -278,6 +278,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
H5VL_loc_params_t loc_params1;
H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
H5VL_loc_params_t loc_params2;
+ H5VL_object_t tmp_vol_obj; /* Temporary object token */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -329,8 +330,12 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_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")
+ /* Construct a temporary source VOL object */
+ tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL);
+ tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector);
+
/* Move the link */
- if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_move(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
done:
@@ -360,7 +365,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
H5VL_loc_params_t loc_params1;
H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */
H5VL_loc_params_t loc_params2;
- H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ H5VL_object_t tmp_vol_obj; /* Temporary object token */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -377,15 +382,15 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
+ /* Check the link create property list */
+ if(H5P_DEFAULT == lcpl_id)
+ lcpl_id = H5P_LINK_CREATE_DEFAULT;
+
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC,
((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Check the link create property list */
- if(H5P_DEFAULT == lcpl_id)
- lcpl_id = H5P_LINK_CREATE_DEFAULT;
-
/* Set location paramter for source object */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.loc_data.loc_by_name.name = src_name;
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 5400356..e486fde 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -4190,7 +4190,7 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__link_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ if(H5VL__link_copy(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed")
done:
@@ -4293,13 +4293,13 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa
FUNC_ENTER_NOAPI(FAIL)
/* Set wrapper info in API context */
- vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj);
+ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj);
if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if(H5VL__link_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ if(H5VL__link_move(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed")
done: