diff options
-rw-r--r-- | src/H5G.c | 59 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 10 | ||||
-rw-r--r-- | src/H5VLcallback.c | 341 | ||||
-rw-r--r-- | src/H5VLprivate.h | 12 |
4 files changed, 307 insertions, 115 deletions
@@ -278,7 +278,7 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj) HDassert(grp_vol_obj); /* Close the group */ - if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") /* Free the VOL object */ @@ -321,7 +321,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_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 */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -365,14 +364,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, - gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, name, 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 */ @@ -380,12 +373,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -455,8 +444,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->data, loc_params, vol_obj->plugin->cls, NULL, - gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, NULL, 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 */ @@ -466,7 +454,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -492,10 +480,9 @@ hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { void *grp = NULL; /* Group opened */ - 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; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); @@ -518,13 +505,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ @@ -532,12 +513,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -571,8 +548,7 @@ H5Gget_create_plist(hid_t group_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") /* Get the group creation property list for the group */ - if(H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_GCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: @@ -614,8 +590,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) /* Retrieve the group's information */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = id_type; - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -667,8 +642,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -728,8 +702,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -800,8 +773,7 @@ H5Gflush(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush group's metadata to file */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) + if(H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: @@ -845,8 +817,7 @@ H5Grefresh(hid_t group_id) vol_wrapper_set = TRUE; /* Refresh group's metadata */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_REFRESH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) + if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index d207bc1..df5a1d8 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -235,8 +235,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->data, loc_params, vol_obj->plugin->cls, 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, 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 */ @@ -249,7 +248,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -297,8 +296,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ @@ -307,7 +305,7 @@ H5Gopen1(hid_t loc_id, const char *name) done: if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 6d28f83..24d9c5c 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -103,6 +103,20 @@ static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl void **req, va_list arguments); 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, 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); +static void *H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req); /*********************/ @@ -3012,7 +3026,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_group_create + * Function: H5VL__group_create * * Purpose: Creates a group through the VOL * @@ -3021,13 +3035,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +static void * +H5VL__group_create(void *obj, 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) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.create) @@ -3039,6 +3053,43 @@ H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *c done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: Pointer to new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, 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 */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group 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, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_create() */ @@ -3070,7 +3121,7 @@ H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin 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, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") done: @@ -3079,7 +3130,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_group_open + * Function: H5VL__group_open * * Purpose: Opens a group through the VOL * @@ -3088,13 +3139,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +static void * +H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.open) @@ -3106,6 +3157,43 @@ H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: Pointer to group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, 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 */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_open() */ @@ -3137,7 +3225,7 @@ H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const c HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") done: @@ -3146,6 +3234,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_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->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_group_get * * Purpose: Get specific information about the group through the VOL @@ -3156,23 +3275,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, +H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_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->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group 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->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__group_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") done: @@ -3180,6 +3301,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_group_get() */ @@ -3210,12 +3335,8 @@ H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, 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->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") done: @@ -3224,6 +3345,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__group_specific + * + * Purpose: Specific operation on groups through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_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->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_group_specific * * Purpose: Specific operation on groups through the VOL @@ -3234,23 +3386,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, +H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_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->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group 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((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + if(H5VL__group_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: @@ -3258,6 +3412,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_group_specific() */ @@ -3289,12 +3447,8 @@ H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_ty 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->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: @@ -3303,6 +3457,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__group_optional + * + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_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->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_group_optional * * Purpose: Optional operation specific to plugins. @@ -3313,23 +3498,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, ...) +H5VL_group_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->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group 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->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if(H5VL__group_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3337,6 +3523,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_group_optional() */ @@ -3352,7 +3542,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, + va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3366,12 +3557,8 @@ H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_lis 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->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__group_optional(obj, cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3380,7 +3567,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_group_close + * Function: H5VL__group_close * * Purpose: Closes a group through the VOL * @@ -3389,27 +3576,63 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +static herr_t +H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ /* Sanity check */ - HDassert(grp); + HDassert(obj); HDassert(cls); - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group close' method") /* Call the corresponding VOL callback */ - if((cls->group_cls.close)(grp, dxpl_id, req) < 0) + if((cls->group_cls.close)(obj, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_close + * + * Purpose: Closes a group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + 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 */ + 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__group_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close 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_group_close() */ @@ -3424,22 +3647,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLgroup_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", grp, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); /* Check args and get class pointer */ - if(NULL == grp) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") 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") /* Call the corresponding internal VOL routine */ - if(H5VL_group_close(grp, cls, dxpl_id, req) < 0) + if(H5VL__group_close(obj, cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") done: diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 1e91523..fab4bbf 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -131,12 +131,12 @@ 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(void *obj, 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); -H5_DLL void *H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, 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_open(const H5VL_object_t *vol_obj, 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, ...); +H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +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); |