summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Gdeprec.c45
-rw-r--r--src/H5L.c128
-rw-r--r--src/H5Lexternal.c3
-rw-r--r--src/H5O.c9
-rw-r--r--src/H5VLcallback.c365
-rw-r--r--src/H5VLprivate.h12
-rw-r--r--test/testfiles/error_test_117
7 files changed, 382 insertions, 197 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index df5a1d8..769ec42 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -349,6 +349,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.obj_type = H5I_get_type(cur_loc_id);
@@ -369,11 +370,14 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
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.plugin = vol_obj->plugin;
+
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->plugin->cls,
- 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) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end if */
else if(type == H5L_TYPE_SOFT) {
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
@@ -392,10 +396,9 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls,
- 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) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end else-if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
@@ -467,10 +470,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name")
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->plugin->cls,
- 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) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end if */
else if(type == H5L_TYPE_SOFT) {
H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
@@ -494,10 +496,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name")
/* Create the link through the VOL */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls,
- 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) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
- }
+ } /* end else-if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type")
@@ -542,8 +543,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Move the link */
- if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->plugin->cls,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_move(vol_obj, loc_params1, NULL, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link")
done:
@@ -580,27 +580,24 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
loc_params1.loc_data.loc_by_name.name = src_name;
loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
loc_params1.obj_type = H5I_get_type(src_loc_id);
+
/* Set location parameter for destination object */
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.loc_data.loc_by_name.name = dst_name;
loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT;
loc_params2.obj_type = H5I_get_type(dst_loc_id);
- if(H5L_SAME_LOC != src_loc_id) {
+ if(H5L_SAME_LOC != src_loc_id)
/* get the location object */
if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
- if(H5L_SAME_LOC != dst_loc_id) {
+ if(H5L_SAME_LOC != dst_loc_id)
/* get the location object */
if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- }
/* Move the link */
- if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2,
- vol_obj1->plugin->cls, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
@@ -643,8 +640,7 @@ H5Gunlink(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Delete the link */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
@@ -688,8 +684,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link value */
- if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0)
+ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value")
done:
diff --git a/src/H5L.c b/src/H5L.c
index 37561d3..d3d8707 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -279,7 +279,6 @@ 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;
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -331,28 +330,11 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked")
- /* Set wrapper info in API context */
- {
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
-
- vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2);
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
- }
-
/* Move the link */
- if (H5VL_link_move((vol_obj1 ? vol_obj1->data : NULL), loc_params1,
- (vol_obj2 ? vol_obj2->data : NULL), loc_params2,
- (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls),
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_move(vol_obj1, 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:
- /* Reset object wrapping info in API context */
- if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Lmove() */
@@ -379,7 +361,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;
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -405,7 +387,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
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;
@@ -432,28 +413,15 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked")
- /* Set wrapper info in API context */
- {
- H5VL_object_t *vol_obj = NULL; /* object token of loc_id */
-
- vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2);
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
- }
+ /* Construct a temporary source VOL object */
+ tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL);
+ tmp_vol_obj.plugin = (vol_obj1 ? vol_obj1->plugin : vol_obj2->plugin);
/* Copy the link */
- if(H5VL_link_copy((vol_obj1 ? vol_obj1->data : NULL), loc_params1,
- (vol_obj2 ? vol_obj2->data : NULL), loc_params2,
- (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls),
- lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_copy(&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 copy link")
done:
- /* Reset object wrapping info in API context */
- if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Lcopy() */
@@ -483,7 +451,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 */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -529,21 +496,11 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
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")
- /* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Create the link */
- if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls,
- 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) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
- /* Reset object wrapping info in API context */
- if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Lcreate_soft() */
@@ -568,8 +525,9 @@ herr_t
H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t *vol_obj1 = NULL; /* object token of cur_loc_id */
- H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */
+ H5VL_object_t *vol_obj1 = NULL; /* Object token of cur_loc_id */
+ H5VL_object_t *vol_obj2 = NULL; /* Object token of new_loc_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 */
@@ -636,10 +594,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
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.plugin = (vol_obj1 != NULL ? vol_obj1->plugin : vol_obj2->plugin);
+
/* Create the link */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (vol_obj2 ? (vol_obj2->data) : NULL), loc_params2,
- (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls),
- 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) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
@@ -675,11 +635,10 @@ herr_t
H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
- 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 */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata,
@@ -720,21 +679,11 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
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")
- /* Set wrapper info in API context */
- if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Create external link */
- if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls,
- 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) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
- /* Reset object wrapping info in API context */
- if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Lcreate_ud() */
@@ -791,8 +740,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
vol_wrapper_set = TRUE;
/* Unlink */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -859,8 +807,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Delete the link */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -922,8 +869,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
vol_wrapper_set = TRUE;
/* Get the link value */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
+ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
done:
@@ -991,8 +937,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the link value */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
+ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -1049,8 +994,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id)
vol_wrapper_set = TRUE;
/* Check for the existence of the link */
- if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_EXISTS,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1111,8 +1055,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
vol_wrapper_set = TRUE;
/* Get the link information */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
+ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1182,8 +1125,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
vol_wrapper_set = TRUE;
/* Get the link information */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
+ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1383,8 +1325,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get the link information */
- if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_NAME,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
+ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name")
done:
@@ -1448,9 +1389,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
vol_wrapper_set = TRUE;
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- FALSE, idx_type, order, idx_p, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1530,8 +1469,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
vol_wrapper_set = TRUE;
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1609,9 +1547,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
vol_wrapper_set = TRUE;
/* Iterate over the links */
- if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -1696,9 +1632,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
vol_wrapper_set = TRUE;
/* Visit the links */
- if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index ff045c8..1c69c53 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -422,8 +422,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist")
/* Create an external link */
- if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls,
- 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) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link")
done:
diff --git a/src/H5O.c b/src/H5O.c
index 64c9e00..567fce4 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -322,6 +322,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
{
H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */
H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_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 */
@@ -383,10 +384,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_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.plugin = (vol_obj1 != NULL ? vol_obj1->plugin : vol_obj2->plugin);
+
/* Create a link to the object */
- if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2,
- (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls),
- 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) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 24d9c5c..ff0e0fd 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -117,6 +117,23 @@ static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxp
void **req, va_list arguments);
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,
+ 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);
+static herr_t H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1,
+ void *dst_obj, 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);
+static herr_t H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1,
+ void *dst_obj, 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);
+static herr_t H5VL__link_get(void *obj, H5VL_loc_params_t loc_params,
+ const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params,
+ const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id,
+ void **req, va_list arguments);
+static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments);
/*********************/
@@ -3671,22 +3688,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_link_create
+ * Function: H5VL__link_create
*
- * Purpose: Creates a hard link through the VOL
+ * Purpose: Creates a link through the VOL
+ *
+ * Note: The 'obj' parameter is allowed to be NULL
*
* Return: Success: Non-negative
* Failure: Negative
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params,
+static herr_t
+H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, 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)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
/* Check if the corresponding VOL callback exists */
if(NULL == cls->link_cls.create)
@@ -3698,13 +3717,67 @@ H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_create
+ *
+ * Purpose: Creates a link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
+ H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
+ void **req)
+{
+ H5VL_object_t tmp_vol_obj; /* Temporary object token of */
+ 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)
+
+ /* Special case for hard links */
+ if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) {
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ /* 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 plugin info")
+ } /* end if */
+ else
+ /* Use the VOL object passed in */
+ tmp_vol_obj.data = vol_obj->data;
+ tmp_vol_obj.plugin = vol_obj->plugin;
+
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.plugin) < 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_create(create_type, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
+
+done:
+ /* 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")
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_link_create() */
/*-------------------------------------------------------------------------
* Function: H5VLlink_create
*
- * Purpose: Creates a hard link
+ * Purpose: Creates a link
*
* Note: The 'obj' parameter is allowed to be NULL
*
@@ -3729,7 +3802,7 @@ H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin 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) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link")
done:
@@ -3738,7 +3811,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_link_copy
+ * Function: H5VL__link_copy
*
* Purpose: Copys a link from src to dst.
*
@@ -3747,14 +3820,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
+static herr_t
+H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
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)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
/* Check if the corresponding VOL callback exists */
if(NULL == cls->link_cls.copy)
@@ -3766,6 +3839,46 @@ H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_copy
+ *
+ * Purpose: Copys a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1,
+ const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ const H5VL_object_t *vol_obj; /* VOL object for object with data */
+ 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)
+
+ /* Set wrapper info in API context */
+ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj);
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 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_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed")
+
+done:
+ /* 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")
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_link_copy() */
@@ -3798,7 +3911,7 @@ H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
- if(H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ if(H5VL__link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
@@ -3807,7 +3920,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_link_move
+ * Function: H5VL__link_move
*
* Purpose: Moves a link from src to dst.
*
@@ -3816,14 +3929,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
+static herr_t
+H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
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)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
/* Check if the corresponding VOL callback exists */
if(NULL == cls->link_cls.move)
@@ -3835,6 +3948,46 @@ H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
done:
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_link_move
+ *
+ * Purpose: Moves a link from src to dst.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1,
+ const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ const H5VL_object_t *vol_obj; /* VOL object for object with data */
+ 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)
+
+ /* Set wrapper info in API context */
+ vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj);
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 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->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed")
+
+done:
+ /* 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")
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_link_move() */
@@ -3867,7 +4020,7 @@ H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
/* Call the corresponding internal VOL routine */
- if(H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
+ if(H5VL__link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object")
done:
@@ -3876,6 +4029,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__link_get
+ *
+ * Purpose: Get specific information about the link through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls,
+ H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.get)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_get() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_link_get
*
* Purpose: Get specific information about the link through the VOL
@@ -3886,23 +4070,25 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params,
+ H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...)
{
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)
- /* Check if the corresponding VOL callback exists */
- if(NULL == cls->link_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method")
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
- /* Call the corresponding VOL callback */
+ /* Call the corresponding internal VOL routine */
va_start(arguments, req);
arg_started = TRUE;
- if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ if(H5VL__link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
done:
@@ -3910,6 +4096,10 @@ done:
if(arg_started)
va_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")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_link_get() */
@@ -3941,12 +4131,8 @@ H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
- /* Check if the corresponding VOL callback exists */
- if(NULL == cls->link_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link get' method")
-
- /* Bypass the H5VLint layer, calling the VOL callback directly */
- if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback")
done:
@@ -3955,9 +4141,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__link_specific
+ *
+ * Purpose: Specific operation on links through the VOL
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls,
+ H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.specific)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method")
+
+ /* Call the corresponding VOL callback */
+ if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_specific() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_link_specific
*
- * Purpose: specific operation on links through the VOL
+ * Purpose: Specific operation on links through the VOL
*
* Return: Success: Non-negative
* Failure: Negative
@@ -3965,23 +4182,25 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls,
+H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params,
H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...)
{
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)
- /* Check if the corresponding VOL callback exists */
- if(NULL == cls->link_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method")
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
- /* Call the corresponding VOL callback */
+ /* Call the corresponding internal VOL routine */
va_start(arguments, req);
arg_started = TRUE;
- if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
+ if((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
done:
@@ -3989,6 +4208,10 @@ done:
if(arg_started)
va_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")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_link_specific() */
@@ -4020,12 +4243,8 @@ H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id,
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
- /* Check if the corresponding VOL callback exists */
- if(NULL == cls->link_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link specific' method")
-
- /* Bypass the H5VLint layer, calling the VOL callback directly */
- if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
+ /* Call the corresponding internal VOL routine */
+ if((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
done:
@@ -4034,9 +4253,40 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__link_optional
+ *
+ * Purpose: Optional operation specific to plugins.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the corresponding VOL callback exists */
+ if(NULL == cls->link_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method")
+
+ /* Call the corresponding VOL callback */
+ if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__link_optional() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL_link_optional
*
- * Purpose: optional operation specific to plugins.
+ * Purpose: Optional operation specific to plugins.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -4044,23 +4294,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
- void **req, ...)
+H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...)
{
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)
- /* Check if the corresponding VOL callback exists */
- if(NULL == cls->link_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method")
+ /* Set wrapper info in API context */
+ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
- /* Call the corresponding VOL callback */
+ /* Call the corresponding internal VOL routine */
va_start(arguments, req);
arg_started = TRUE;
- if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ if(H5VL__link_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -4068,6 +4319,10 @@ done:
if(arg_started)
va_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")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_link_optional() */
@@ -4097,12 +4352,8 @@ H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list
if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID")
- /* Check if the corresponding VOL callback exists */
- if(NULL == cls->link_cls.optional)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link optional' method")
-
- /* Bypass the H5VLint layer, calling the VOL callback directly */
- if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0)
+ /* Call the corresponding internal VOL routine */
+ if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index fab4bbf..546c3ca 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -139,12 +139,12 @@ 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, void *obj, 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);
-H5_DLL herr_t H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, 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);
-H5_DLL herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, 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);
-H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_link_optional(void *obj, const H5VL_class_t *cls, 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, 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, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, 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, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, 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, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...);
/* Object functions */
H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1
index 7838c9c..f0e4a62 100644
--- a/test/testfiles/error_test_1
+++ b/test/testfiles/error_test_1
@@ -41,25 +41,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Dread(): can't read data
major: Dataset
minor: Read failed
- #001: (file name) line (number) in H5VL_dataset_read(): read failed
+ #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed
major: Virtual Object Layer
minor: Read failed
- #002: (file name) line (number) in H5VL__native_dataset_read(): can't read data
+ #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed
+ major: Virtual Object Layer
+ minor: Read failed
+ #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data
major: Dataset
minor: Read failed
- #003: (file name) line (number) in H5D__read(): can't read data
+ #004: (file name) line (number) in H5D__read(): can't read data
major: Dataset
minor: Read failed
- #004: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk
+ #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk
major: Low-level I/O
minor: Read failed
- #005: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed
+ #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed
major: Dataset
minor: Filter operation failed
- #006: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered
+ #007: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered
major: Data filters
minor: Read failed
- #007: (file name) line (number) in H5PL_load(): filter plugins disabled
+ #008: (file name) line (number) in H5PL_load(): filter plugins disabled
major: Plugin for dynamically loaded library
minor: Unable to load metadata into cache