diff options
Diffstat (limited to 'src/H5VLcallback.c')
-rw-r--r-- | src/H5VLcallback.c | 360 |
1 files changed, 217 insertions, 143 deletions
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 2d6ac33..696ccab 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -57,8 +57,8 @@ /* Local Prototypes */ /********************/ static void *H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, - const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id, - hid_t dxpl_id, void **req); + const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t space_id, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); static void *H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); @@ -76,8 +76,8 @@ static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, - const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, - hid_t dxpl_id, void **req); + const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t type_id, + hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); @@ -108,8 +108,8 @@ static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl 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, const 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); + const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t gcpl_id, + hid_t gapl_id, hid_t dxpl_id, void **req); static void *H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); @@ -123,7 +123,7 @@ 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, const 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); + hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const 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); @@ -348,14 +348,14 @@ H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, /* Check for actual source info */ if(src_info) { /* Allow the connector to copy or do it ourselves */ - if(connector->info_copy) { - if(NULL == (new_connector_info = (connector->info_copy)(src_info))) + if(connector->info_cls.copy) { + if(NULL == (new_connector_info = (connector->info_cls.copy)(src_info))) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed") } /* end if */ - else if(connector->info_size > 0) { - if(NULL == (new_connector_info = H5MM_malloc(connector->info_size))) + else if(connector->info_cls.size > 0) { + if(NULL == (new_connector_info = H5MM_malloc(connector->info_cls.size))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed") - HDmemcpy(new_connector_info, src_info, connector->info_size); + H5MM_memcpy(new_connector_info, src_info, connector->info_cls.size); } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info") @@ -444,13 +444,13 @@ H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, * if there is a a callback, otherwise just compare the info objects as * memory buffers */ - if(connector->info_cmp) { - if((connector->info_cmp)(cmp_value, info1, info2) < 0) + if(connector->info_cls.cmp) { + if((connector->info_cls.cmp)(cmp_value, info1, info2) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info") } /* end if */ else { - HDassert(connector->info_size > 0); - *cmp_value = HDmemcmp(info1, info2, connector->info_size); + HDassert(connector->info_cls.size > 0); + *cmp_value = HDmemcmp(info1, info2, connector->info_cls.size); } /* end else */ done: @@ -506,20 +506,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_free_connector_info(const H5VL_class_t *connector, void *info) +H5VL_free_connector_info(hid_t connector_id, void *info) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Sanity checks */ - HDassert(connector); + /* Sanity check */ + HDassert(connector_id > 0); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Only free info object, if it's non-NULL */ if(info) { /* Allow the connector to free info or do it ourselves */ - if(connector->info_free) { - if((connector->info_free)(info) < 0) + if(cls->info_cls.free) { + if((cls->info_cls.free)(info) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed") } /* end if */ else @@ -544,18 +549,13 @@ done: herr_t H5VLfree_connector_info(hid_t connector_id, void *info) { - H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT H5TRACE2("e", "i*x", connector_id, info); - /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Free the VOL connector info object */ - if(H5VL_free_connector_info(cls, info) < 0) + if(H5VL_free_connector_info(connector_id, info) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") done: @@ -590,8 +590,8 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Allow the connector to serialize info */ - if(cls->info_to_str) { - if((cls->info_to_str)(info, str) < 0) + if(cls->info_cls.to_str) { + if((cls->info_cls.to_str)(info, str) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info") } /* end if */ else @@ -623,24 +623,9 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info) FUNC_ENTER_API_NOINIT H5TRACE3("e", "*si**x", str, connector_id, info); - /* Only deserialize string, if it's non-NULL */ - if(str) { - H5VL_class_t *cls; /* VOL connector's class struct */ - - /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Allow the connector to deserialize info */ - if(cls->str_to_info) { - if((cls->str_to_info)(str, info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info") - } /* end if */ - else - *info = NULL; - } /* end if */ - else - *info = NULL; + /* Call internal routine */ + if(H5VL__connector_str_to_info(str, connector_id, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -673,8 +658,8 @@ H5VLget_object(void *obj, hid_t connector_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Check for 'get_object' callback in connector */ - if(cls->get_object) - ret_value = (cls->get_object)(obj); + if(cls->wrap_cls.get_object) + ret_value = (cls->wrap_cls.get_object)(obj); else ret_value = obj; @@ -706,12 +691,12 @@ H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx) HDassert(wrap_ctx); /* Allow the connector to copy or do it ourselves */ - if(connector->get_wrap_ctx) { + if(connector->wrap_cls.get_wrap_ctx) { /* Sanity check */ - HDassert(connector->free_wrap_ctx); + HDassert(connector->wrap_cls.free_wrap_ctx); /* Invoke connector's callback */ - if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0) + if((connector->wrap_cls.get_wrap_ctx)(obj, wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed") } /* end if */ else @@ -755,84 +740,89 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_free_wrap_ctx + * Function: H5VL_wrap_object * - * Purpose: Free object wrapping context for a connector + * Purpose: Wrap an object with connector * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-NULL + * Failure: NULL * *------------------------------------------------------------------------- */ -herr_t -H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) +void * +H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, + H5I_type_t obj_type) { - herr_t ret_value = SUCCEED; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ HDassert(connector); + HDassert(obj); - /* Only free wrap context, if it's non-NULL */ + /* Only wrap object if there's a wrap context */ if(wrap_ctx) { - /* Free the connector's object wrapping context */ - if((connector->free_wrap_ctx)(wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed") + /* Ask the connector to wrap the object */ + if(NULL == (ret_value = (connector->wrap_cls.wrap_object)(obj, obj_type, wrap_ctx))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") } /* end if */ + else + ret_value = obj; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_free_wrap_ctx() */ +} /* end H5VL_wrap_object() */ /*--------------------------------------------------------------------------- - * Function: H5VLfree_wrap_ctx + * Function: H5VLwrap_object * - * Purpose: Release a VOL connector's object wrapping context + * Purpose: Asks a connector to wrap an underlying object. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-NULL + * Failure: NULL * *--------------------------------------------------------------------------- */ -herr_t -H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) +void * +H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "*xi", wrap_ctx, connector_id); + H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx); /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Release the VOL connector's object wrapper */ - if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") + /* Wrap the object */ + if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLfree_wrap_ctx() */ +} /* H5VLwrap_object */ /*------------------------------------------------------------------------- - * Function: H5VL_wrap_object + * Function: H5VL_unwrap_object * - * Purpose: Wrap an object with connector + * Purpose: Unwrap an object from connector * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-NULL + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, - H5I_type_t obj_type) +H5VL_unwrap_object(const H5VL_class_t *connector, void *obj) { - void *ret_value = SUCCEED; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -840,24 +830,24 @@ H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, HDassert(connector); HDassert(obj); - /* Only wrap object if there's a wrap context */ - if(wrap_ctx) { - /* Ask the connector to wrap the object */ - if(NULL == (ret_value = (connector->wrap_object)(obj, obj_type, wrap_ctx))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + /* Only unwrap object if there's an unwrap callback */ + if(connector->wrap_cls.wrap_object) { + /* Ask the connector to unwrap the object */ + if(NULL == (ret_value = (connector->wrap_cls.unwrap_object)(obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object") } /* end if */ else ret_value = obj; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_wrap_object() */ +} /* end H5VL_unwrap_object() */ /*--------------------------------------------------------------------------- - * Function: H5VLwrap_object + * Function: H5VLunwrap_object * - * Purpose: Asks a connector to wrap an underlying object. + * Purpose: Unwrap an object from connector * * Return: Success: Non-NULL * Failure: NULL @@ -865,13 +855,13 @@ done: *--------------------------------------------------------------------------- */ void * -H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_ctx) +H5VLunwrap_object(void *obj, hid_t connector_id) { H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx); + H5TRACE2("*x", "*xi", obj, connector_id); /* Check args and get class pointer */ if(NULL == obj) @@ -879,13 +869,77 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Wrap the object */ - if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") + /* Unwrap the object */ + if(NULL == (ret_value = H5VL_unwrap_object(cls, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLwrap_object */ +} /* H5VLunwrap_object */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_wrap_ctx + * + * Purpose: Free object wrapping context for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Only free wrap context, if it's non-NULL */ + if(wrap_ctx) { + /* Free the connector's object wrapping context */ + if((connector->wrap_cls.free_wrap_ctx)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_wrap_ctx + * + * Purpose: Release a VOL connector's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", wrap_ctx, connector_id); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Release the VOL connector's object wrapper */ + if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_wrap_ctx() */ /*------------------------------------------------------------------------- @@ -900,7 +954,8 @@ done: */ static void * H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) + const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, + hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -911,12 +966,12 @@ H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cla HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method") /* Call the corresponding VOL callback */ - if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_create() */ +} /* end H5VL__attr_create() */ /*------------------------------------------------------------------------- @@ -931,7 +986,8 @@ done: */ void * H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) + const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, + hid_t aapl_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 */ @@ -944,7 +1000,7 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_para vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") done: @@ -968,14 +1024,15 @@ done: */ void * H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, - const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) + const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, + hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, acpl_id, - aapl_id, dxpl_id, req); + H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name, + type_id, space_id, acpl_id, aapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) @@ -984,7 +1041,7 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") done: @@ -1740,7 +1797,8 @@ done: */ static void * H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) + const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1751,7 +1809,7 @@ H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method") /* Call the corresponding VOL callback */ - if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) + if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") done: @@ -1771,7 +1829,8 @@ done: */ void * H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) + const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, + hid_t dcpl_id, hid_t dapl_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 */ @@ -1784,7 +1843,7 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_p vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") done: @@ -1808,14 +1867,15 @@ done: */ void * H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, - const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) + const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, dcpl_id, - dapl_id, dxpl_id, req); + H5TRACE11("*x", "*x*xi*siiiiii**x", obj, loc_params, connector_id, name, + lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) @@ -1824,7 +1884,7 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") done: @@ -2981,7 +3041,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t arg_started = TRUE; /* Special treatment of file access check */ - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ va_list tmp_args; /* argument list passed from the API call */ @@ -2989,7 +3049,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t /* Get the file access property list to access the file */ HDva_copy(tmp_args, arguments); - fapl_id = va_arg(tmp_args, hid_t); + fapl_id = HDva_arg(tmp_args, hid_t); HDva_end(tmp_args); /* Get the VOL info from the FAPL */ @@ -3294,7 +3354,8 @@ done: */ static void * H5VL__group_create(void *obj, const 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) + const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, + hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -3305,7 +3366,7 @@ H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cl HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method") /* Call the corresponding VOL callback */ - if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) + if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") done: @@ -3325,7 +3386,8 @@ done: */ void * H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) + const char *name, hid_t lcpl_id, 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 */ @@ -3338,7 +3400,7 @@ H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") done: @@ -3361,15 +3423,16 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,hid_t dxpl_id, + void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, gcpl_id, - gapl_id, dxpl_id, req); + H5TRACE9("*x", "*x*xi*siiii**x", obj, loc_params, connector_id, name, lcpl_id, + gcpl_id, gapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) @@ -3378,7 +3441,7 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector 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, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") done: @@ -3942,7 +4005,8 @@ done: */ static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const 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) + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, + va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3953,7 +4017,7 @@ H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method") /* Call the corresponding VOL callback */ - if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0) + if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") done: @@ -3974,23 +4038,28 @@ done: herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, - void **req) + void **req, ...) { H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + 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) + /* Start the varargs, so they can be copied */ + HDva_start(arguments, req); + arg_started = TRUE; + /* Special case for hard links */ if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) { - H5P_genplist_t *plist; /* Property list pointer */ + va_list tmp_arguments; /* Copy of argument list passed in */ - /* 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 connector info") + /* Get the VOL data pointer from the varargs */ + HDva_copy(tmp_arguments, arguments); + tmp_vol_obj.data = HDva_arg(tmp_arguments, void *); + HDva_end(tmp_arguments); } /* end if */ else /* Use the VOL object passed in */ @@ -4003,10 +4072,14 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_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") @@ -4029,21 +4102,22 @@ done: */ herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, - hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) + hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, + va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "Vk*x*xiiii**x", create_type, obj, loc_params, connector_id, - lcpl_id, lapl_id, dxpl_id, req); + H5TRACE9("e", "Vk*x*xiiii**xx", create_type, obj, loc_params, connector_id, + lcpl_id, lapl_id, dxpl_id, req, arguments); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector 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, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") done: |