diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2019-02-23 23:02:29 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2019-02-23 23:02:29 (GMT) |
commit | d6663b95ac7e9e378b24bd721ea4403ca98d4adf (patch) | |
tree | 1eee70b0795b04dba9bd751ce70406bd6edd1c22 | |
parent | 7e792d7795ffa286bd29bfcdc3025f2cb74faf59 (diff) | |
download | hdf5-d6663b95ac7e9e378b24bd721ea4403ca98d4adf.zip hdf5-d6663b95ac7e9e378b24bd721ea4403ca98d4adf.tar.gz hdf5-d6663b95ac7e9e378b24bd721ea4403ca98d4adf.tar.bz2 |
Revise "management" VOL callbacks into 'info' and object 'wrap / retrieval'
classes.
-rw-r--r-- | src/H5Pfapl.c | 2 | ||||
-rw-r--r-- | src/H5VL.c | 4 | ||||
-rw-r--r-- | src/H5VLcallback.c | 44 | ||||
-rw-r--r-- | src/H5VLint.c | 18 | ||||
-rw-r--r-- | src/H5VLnative.c | 24 | ||||
-rw-r--r-- | src/H5VLpassthru.c | 132 | ||||
-rw-r--r-- | src/H5VLpublic.h | 62 | ||||
-rw-r--r-- | test/vol.c | 24 |
8 files changed, 170 insertions, 140 deletions
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 452ea3f..bfb52ff 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5231,7 +5231,7 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED /* Use one of the classes (cls1) info comparison routines to compare the * info objects */ - HDassert(cls1->info_cmp == cls2->info_cmp); + HDassert(cls1->info_cls.cmp == cls2->info_cls.cmp); status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info); HDassert(status >= 0); @@ -156,9 +156,9 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer") if (0 == HDstrlen(cls->name)) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string") - if (cls->info_copy && !cls->info_free) + if (cls->info_cls.copy && !cls->info_cls.free) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for VOL info objects when a copy callback is provided") - if (cls->get_wrap_ctx && !cls->free_wrap_ctx) + if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index e1030b2..5a5d9ee 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -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); + HDmemcpy(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: @@ -518,8 +518,8 @@ H5VL_free_connector_info(const H5VL_class_t *connector, void *info) /* 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(connector->info_cls.free) { + if((connector->info_cls.free)(info) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed") } /* end if */ else @@ -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 @@ -632,8 +632,8 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info) 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) + if(cls->info_cls.from_str) { + if((cls->info_cls.from_str)(str, info) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info") } /* end if */ else @@ -673,8 +673,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 +706,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 @@ -777,7 +777,7 @@ H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) /* Only free wrap context, if it's non-NULL */ if(wrap_ctx) { /* Free the connector's object wrapping context */ - if((connector->free_wrap_ctx)(wrap_ctx) < 0) + 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 */ @@ -843,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, obj_type, wrap_ctx))) + 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 diff --git a/src/H5VLint.c b/src/H5VLint.c index f22fdb6..5aa25d2 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -740,8 +740,8 @@ H5VL_object_data(const H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check for 'get_object' callback in connector */ - if(vol_obj->connector->cls->get_object) - ret_value = (vol_obj->connector->cls->get_object)(vol_obj->data); + if(vol_obj->connector->cls->wrap_cls.get_object) + ret_value = (vol_obj->connector->cls->wrap_cls.get_object)(vol_obj->data); else ret_value = vol_obj->data; @@ -933,15 +933,15 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas HDassert(cls1->version == cls2->version); /* Compare connector info */ - if(cls1->info_size < cls2->info_size) { + if(cls1->info_cls.size < cls2->info_cls.size) { *cmp_value = -1; HGOTO_DONE(SUCCEED) } /* end if */ - if(cls1->info_size > cls2->info_size) { + if(cls1->info_cls.size > cls2->info_cls.size) { *cmp_value = 1; HGOTO_DONE(SUCCEED) } /* end if */ - HDassert(cls1->info_size == cls2->info_size); + HDassert(cls1->info_cls.size == cls2->info_cls.size); /* Set comparison value to 'equal' */ *cmp_value = 0; @@ -980,12 +980,12 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector) /* Check for existing wrapping context */ if(NULL == vol_wrap_ctx) { /* Check if the connector can create a wrap context */ - if(connector->cls->get_wrap_ctx) { + if(connector->cls->wrap_cls.get_wrap_ctx) { /* Sanity check */ - HDassert(connector->cls->free_wrap_ctx); + HDassert(connector->cls->wrap_cls.free_wrap_ctx); /* Get the wrap context from the connector */ - if((connector->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + if((connector->cls->wrap_cls.get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context") } /* end if */ @@ -1048,7 +1048,7 @@ H5VL_reset_vol_wrapper(void) /* If there is a VOL connector object wrapping context, release it */ if(vol_wrap_ctx->obj_wrap_ctx) { /* Release the VOL connector's object wrapping context */ - if((*vol_wrap_ctx->connector->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) + if((*vol_wrap_ctx->connector->cls->wrap_cls.free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context") } /* end if */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index fe0fd4e..f4f3b5f 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -38,16 +38,20 @@ static H5VL_class_t H5VL_native_cls_g = { 0, /* capability flags */ NULL, /* initialize */ H5VL__native_term, /* terminate */ - (size_t)0, /* info size */ - NULL, /* info copy */ - NULL, /* info compare */ - NULL, /* info free */ - NULL, /* info to str */ - NULL, /* str to info */ - NULL, /* get_object */ - NULL, /* get_wrap_ctx */ - NULL, /* wrap_object */ - NULL, /* free_wrap_ctx */ + { /* info_cls */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* info to str */ + NULL /* str to info */ + }, + { /* wrap_cls */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL /* free_wrap_ctx */ + }, { /* attribute_cls */ H5VL__native_attr_create, /* create */ H5VL__native_attr_open, /* open */ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index f7f9058..fe72000 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -82,11 +82,15 @@ static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj); /* "Management" callbacks */ static herr_t H5VL_pass_through_init(hid_t vipl_id); static herr_t H5VL_pass_through_term(void); + +/* VOL info callbacks */ static void *H5VL_pass_through_info_copy(const void *info); static herr_t H5VL_pass_through_info_cmp(int *cmp_value, const void *info1, const void *info2); static herr_t H5VL_pass_through_info_free(void *info); static herr_t H5VL_pass_through_info_to_str(const void *info, char **str); static herr_t H5VL_pass_through_str_to_info(const char *str, void **info); + +/* VOL object wrap / retrieval callbacks */ 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); @@ -173,82 +177,86 @@ static const H5VL_class_t H5VL_pass_through_g = { 0, /* capability flags */ H5VL_pass_through_init, /* initialize */ H5VL_pass_through_term, /* terminate */ - sizeof(H5VL_pass_through_info_t), /* info size */ - H5VL_pass_through_info_copy, /* info copy */ - H5VL_pass_through_info_cmp, /* info compare */ - H5VL_pass_through_info_free, /* info free */ - H5VL_pass_through_info_to_str, /* info to str */ - H5VL_pass_through_str_to_info, /* str to info */ - H5VL_pass_through_get_object, /* get_object */ - H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */ - H5VL_pass_through_wrap_object, /* wrap_object */ - H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */ + { /* info_cls */ + sizeof(H5VL_pass_through_info_t), /* size */ + H5VL_pass_through_info_copy, /* copy */ + H5VL_pass_through_info_cmp, /* compare */ + H5VL_pass_through_info_free, /* free */ + H5VL_pass_through_info_to_str, /* to_str */ + H5VL_pass_through_str_to_info, /* from_str */ + }, + { /* wrap_cls */ + H5VL_pass_through_get_object, /* get_object */ + H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */ + H5VL_pass_through_wrap_object, /* wrap_object */ + H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */ + }, { /* attribute_cls */ - H5VL_pass_through_attr_create, /* create */ - H5VL_pass_through_attr_open, /* open */ - H5VL_pass_through_attr_read, /* read */ - H5VL_pass_through_attr_write, /* write */ - H5VL_pass_through_attr_get, /* get */ - H5VL_pass_through_attr_specific, /* specific */ - H5VL_pass_through_attr_optional, /* optional */ - H5VL_pass_through_attr_close /* close */ + H5VL_pass_through_attr_create, /* create */ + H5VL_pass_through_attr_open, /* open */ + H5VL_pass_through_attr_read, /* read */ + H5VL_pass_through_attr_write, /* write */ + H5VL_pass_through_attr_get, /* get */ + H5VL_pass_through_attr_specific, /* specific */ + H5VL_pass_through_attr_optional, /* optional */ + H5VL_pass_through_attr_close /* close */ }, { /* dataset_cls */ - H5VL_pass_through_dataset_create, /* create */ - H5VL_pass_through_dataset_open, /* open */ - H5VL_pass_through_dataset_read, /* read */ - H5VL_pass_through_dataset_write, /* write */ - H5VL_pass_through_dataset_get, /* get */ - H5VL_pass_through_dataset_specific, /* specific */ - H5VL_pass_through_dataset_optional, /* optional */ - H5VL_pass_through_dataset_close /* close */ + H5VL_pass_through_dataset_create, /* create */ + H5VL_pass_through_dataset_open, /* open */ + H5VL_pass_through_dataset_read, /* read */ + H5VL_pass_through_dataset_write, /* write */ + H5VL_pass_through_dataset_get, /* get */ + H5VL_pass_through_dataset_specific, /* specific */ + H5VL_pass_through_dataset_optional, /* optional */ + H5VL_pass_through_dataset_close /* close */ }, - { /* datatype_cls */ - H5VL_pass_through_datatype_commit, /* commit */ - H5VL_pass_through_datatype_open, /* open */ - H5VL_pass_through_datatype_get, /* get_size */ - H5VL_pass_through_datatype_specific, /* specific */ - H5VL_pass_through_datatype_optional, /* optional */ - H5VL_pass_through_datatype_close /* close */ + { /* datatype_cls */ + H5VL_pass_through_datatype_commit, /* commit */ + H5VL_pass_through_datatype_open, /* open */ + H5VL_pass_through_datatype_get, /* get_size */ + H5VL_pass_through_datatype_specific, /* specific */ + H5VL_pass_through_datatype_optional, /* optional */ + H5VL_pass_through_datatype_close /* close */ }, { /* file_cls */ - H5VL_pass_through_file_create, /* create */ - H5VL_pass_through_file_open, /* open */ - H5VL_pass_through_file_get, /* get */ - H5VL_pass_through_file_specific, /* specific */ - H5VL_pass_through_file_optional, /* optional */ - H5VL_pass_through_file_close /* close */ + H5VL_pass_through_file_create, /* create */ + H5VL_pass_through_file_open, /* open */ + H5VL_pass_through_file_get, /* get */ + H5VL_pass_through_file_specific, /* specific */ + H5VL_pass_through_file_optional, /* optional */ + H5VL_pass_through_file_close /* close */ }, { /* group_cls */ - H5VL_pass_through_group_create, /* create */ - H5VL_pass_through_group_open, /* open */ - H5VL_pass_through_group_get, /* get */ - H5VL_pass_through_group_specific, /* specific */ - H5VL_pass_through_group_optional, /* optional */ - H5VL_pass_through_group_close /* close */ + H5VL_pass_through_group_create, /* create */ + H5VL_pass_through_group_open, /* open */ + H5VL_pass_through_group_get, /* get */ + H5VL_pass_through_group_specific, /* specific */ + H5VL_pass_through_group_optional, /* optional */ + H5VL_pass_through_group_close /* close */ }, { /* link_cls */ - H5VL_pass_through_link_create, /* create */ - H5VL_pass_through_link_copy, /* copy */ - H5VL_pass_through_link_move, /* move */ - H5VL_pass_through_link_get, /* get */ - H5VL_pass_through_link_specific, /* specific */ - H5VL_pass_through_link_optional, /* optional */ + H5VL_pass_through_link_create, /* create */ + H5VL_pass_through_link_copy, /* copy */ + H5VL_pass_through_link_move, /* move */ + H5VL_pass_through_link_get, /* get */ + H5VL_pass_through_link_specific, /* specific */ + H5VL_pass_through_link_optional, /* optional */ }, { /* object_cls */ - H5VL_pass_through_object_open, /* open */ - H5VL_pass_through_object_copy, /* copy */ - H5VL_pass_through_object_get, /* get */ - H5VL_pass_through_object_specific, /* specific */ - H5VL_pass_through_object_optional, /* optional */ + H5VL_pass_through_object_open, /* open */ + H5VL_pass_through_object_copy, /* copy */ + H5VL_pass_through_object_get, /* get */ + H5VL_pass_through_object_specific, /* specific */ + H5VL_pass_through_object_optional, /* optional */ }, { /* request_cls */ - H5VL_pass_through_request_wait, /* wait */ - H5VL_pass_through_request_notify, /* notify */ - H5VL_pass_through_request_cancel, /* cancel */ - H5VL_pass_through_request_specific, /* specific */ - H5VL_pass_through_request_optional, /* optional */ - H5VL_pass_through_request_free /* free */ + H5VL_pass_through_request_wait, /* wait */ + H5VL_pass_through_request_notify, /* notify */ + H5VL_pass_through_request_cancel, /* cancel */ + H5VL_pass_through_request_specific, /* specific */ + H5VL_pass_through_request_optional, /* optional */ + H5VL_pass_through_request_free /* free */ }, NULL /* optional */ }; diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 6ea9fc1..72e69b8 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -236,6 +236,25 @@ typedef struct H5VL_loc_params_t { } loc_data; } H5VL_loc_params_t; +/* VOL connector info fields & callbacks */ +typedef struct H5VL_info_class_t { + size_t size; /* Size of the VOL info */ + void * (*copy)(const void *info); /* Callback to create a copy of the VOL info */ + herr_t (*cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */ + herr_t (*free)(void *info); /* Callback to release a VOL info */ + herr_t (*to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */ + herr_t (*from_str)(const char *str, void **info); /* Callback to deserialize a string into connector's info */ +} H5VL_info_class_t; + +/* VOL object wrap / retrieval callbacks */ +/* (These only need to be implemented by "pass through" VOL connectors) */ +typedef struct H5VL_wrap_class_t { + 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, 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 */ +} H5VL_wrap_class_t; + /* H5A routines */ typedef struct H5VL_attr_class_t { void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, @@ -370,34 +389,29 @@ typedef int H5VL_class_value_t; /* Class information for each VOL connector */ typedef struct H5VL_class_t { - unsigned int version; /* VOL connector class struct version # */ - H5VL_class_value_t value; /* Value to identify connector */ - const char *name; /* Connector name (MUST be unique!) */ - unsigned cap_flags; /* Capability flags for connector */ - herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */ - herr_t (*terminate)(void); /* Connector termination callback */ - size_t info_size; /* Size of the VOL info */ - void * (*info_copy)(const void *info); /* Callback to create a copy of the VOL info */ - herr_t (*info_cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */ - herr_t (*info_free)(void *info); /* Callback to release the VOL info copy */ - herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */ - 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, 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 */ + /* Overall connector fields & callbacks */ + unsigned int version; /* VOL connector class struct version # */ + H5VL_class_value_t value; /* Value to identify connector */ + const char *name; /* Connector name (MUST be unique!) */ + unsigned cap_flags; /* Capability flags for connector */ + herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */ + herr_t (*terminate)(void); /* Connector termination callback */ + + /* VOL framework */ + H5VL_info_class_t info_cls; /* VOL info fields & callbacks */ + H5VL_wrap_class_t wrap_cls; /* VOL object wrap / retrieval callbacks */ /* Data Model */ - H5VL_attr_class_t attr_cls; /* attribute class callbacks */ - H5VL_dataset_class_t dataset_cls; /* dataset class callbacks */ - H5VL_datatype_class_t datatype_cls; /* datatype class callbacks */ - H5VL_file_class_t file_cls; /* file class callbacks */ - H5VL_group_class_t group_cls; /* group class callbacks */ - H5VL_link_class_t link_cls; /* link class callbacks */ - H5VL_object_class_t object_cls; /* object class callbacks */ + H5VL_attr_class_t attr_cls; /* Attribute (H5A*) class callbacks */ + H5VL_dataset_class_t dataset_cls; /* Dataset (H5D*) class callbacks */ + H5VL_datatype_class_t datatype_cls; /* Datatype (H5T*) class callbacks */ + H5VL_file_class_t file_cls; /* File (H5F*) class callbacks */ + H5VL_group_class_t group_cls; /* Group (H5G*) class callbacks */ + H5VL_link_class_t link_cls; /* Link (H5L*) class callbacks */ + H5VL_object_class_t object_cls; /* Object (H5O*) class callbacks */ /* Services */ - H5VL_request_class_t request_cls; /* asynchronous request class callbacks */ + H5VL_request_class_t request_cls; /* Asynchronous request class callbacks */ /* Catch-all */ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ @@ -49,16 +49,20 @@ static const H5VL_class_t fake_vol_g = { 0, /* capability flags */ NULL, /* initialize */ NULL, /* terminate */ - (size_t)0, /* info size */ - NULL, /* info copy */ - NULL, /* info compare */ - NULL, /* info free */ - NULL, /* info to str */ - NULL, /* str to info */ - NULL, /* get_object */ - NULL, /* get_wrap_ctx */ - NULL, /* wrap_object */ - NULL, /* free_wrap_ctx */ + { /* info_cls */ + (size_t)0, /* size */ + NULL, /* copy */ + NULL, /* compare */ + NULL, /* free */ + NULL, /* to_str */ + NULL, /* from_str */ + }, + { /* wrap_cls */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* free_wrap_ctx */ + }, { /* attribute_cls */ NULL, /* create */ NULL, /* open */ |