From 163dcebec5d853b720dcb64b5e9828670b963773 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 7 Feb 2019 14:31:26 -0600 Subject: Add ID type (of eventual hid_t) to the VOL "wrap" callback. --- src/H5VLcallback.c | 11 ++++++----- src/H5VLint.c | 10 +++++----- src/H5VLpassthru.c | 7 ++++--- src/H5VLprivate.h | 2 +- src/H5VLpublic.h | 6 ++++-- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 811162d..2d6ac33 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -829,7 +829,8 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj) +H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, + H5I_type_t obj_type) { void *ret_value = SUCCEED; /* Return value */ @@ -842,7 +843,7 @@ H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *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, wrap_ctx))) + if(NULL == (ret_value = (connector->wrap_object)(obj, obj_type, wrap_ctx))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") } /* end if */ else @@ -864,13 +865,13 @@ done: *--------------------------------------------------------------------------- */ void * -H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx) +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 */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("*x", "*xi*x", obj, connector_id, wrap_ctx); + H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx); /* Check args and get class pointer */ if(NULL == obj) @@ -879,7 +880,7 @@ H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx) 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))) + 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: diff --git a/src/H5VLint.c b/src/H5VLint.c index bdb2908..f22fdb6 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -65,7 +65,7 @@ typedef struct H5VL_wrap_ctx_t { /* Local Prototypes */ /********************/ static herr_t H5VL__free_cls(H5VL_class_t *cls); -static void *H5VL__wrap_obj(void *obj); +static void *H5VL__wrap_obj(void *obj, H5I_type_t obj_type); static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t wrap_obj); static void *H5VL__object(hid_t id, H5I_type_t obj_type); @@ -248,7 +248,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__wrap_obj(void *obj) +H5VL__wrap_obj(void *obj, H5I_type_t obj_type) { H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ void *ret_value = NULL; /* Return value */ @@ -265,7 +265,7 @@ H5VL__wrap_obj(void *obj) /* If there is a VOL object wrapping context, wrap the object */ if(vol_wrap_ctx) { /* Wrap object, using the VOL callback */ - if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj, obj_type))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") } /* end if */ else @@ -310,7 +310,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") new_vol_obj->connector = vol_connector; if(wrap_obj) { - if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object))) + if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object, type))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object") } /* end if */ else @@ -1099,7 +1099,7 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") /* Wrap the object with VOL connector info */ - if(NULL == (new_obj = H5VL__wrap_obj(obj))) + if(NULL == (new_obj = H5VL__wrap_obj(obj, type))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") /* Retrieve the VOL object wrapping context */ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 13d8d8e..f7f9058 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -90,7 +90,8 @@ static herr_t H5VL_pass_through_str_to_info(const char *str, void **info); static void *H5VL_pass_through_get_object(const void *obj); static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx); static herr_t H5VL_pass_through_free_wrap_ctx(void *obj); -static void *H5VL_pass_through_wrap_object(void *obj, void *wrap_ctx); +static void *H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, + void *wrap_ctx); /* Attribute callbacks */ static void *H5VL_pass_through_attr_create(void *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); @@ -660,7 +661,7 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx) *--------------------------------------------------------------------------- */ static void * -H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx) +H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx) { H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx; H5VL_pass_through_t *new_obj; @@ -671,7 +672,7 @@ H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx) #endif /* Wrap the object with the underlying VOL */ - under = H5VLwrap_object(obj, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx); + under = H5VLwrap_object(obj, obj_type, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx); if(under) new_obj = H5VL_pass_through_new_obj(under, wrap_ctx->under_vol_id); else diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index ef5a81e..283c77a 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -95,7 +95,7 @@ H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx); H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector); H5_DLL herr_t H5VL_reset_vol_wrapper(void); H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, - void *obj); + void *obj, H5I_type_t obj_type); /* ID registration functions */ H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index dd1ed54..6ea9fc1 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -22,6 +22,7 @@ #include "H5Apublic.h" /* Attributes */ #include "H5ESpublic.h" /* Event Stack */ #include "H5Fpublic.h" /* Files */ +#include "H5Ipublic.h" /* IDs */ #include "H5Lpublic.h" /* Links */ #include "H5Opublic.h" /* Objects */ #include "H5Rpublic.h" /* References */ @@ -383,7 +384,7 @@ typedef struct H5VL_class_t { herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */ void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */ herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */ - void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap a library object */ + void* (*wrap_object)(void *obj, H5I_type_t obj_type, void *wrap_ctx); /* Callback to wrap a library object */ herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */ /* Data Model */ @@ -450,7 +451,8 @@ H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, ch H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info); H5_DLL void *H5VLget_object(void *obj, hid_t connector_id); H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx); -H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx); +H5_DLL void *H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, + void *wrap_ctx); H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); /* Public wrappers for attribute callbacks */ -- cgit v0.12